mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 16:02:50 +00:00
Keep main's providesInitialSurface guard on gated activation callbacks
The merge kept only the branch's tombstone reseed and dropped main's guard, so an explicitly promised surface raced a fallback terminal after the inventory gate. Fold both gated callbacks into one seeding helper.
This commit is contained in:
@@ -30,7 +30,10 @@ import type { ExecutionHostId } from '../../../shared/execution-host'
|
||||
import { findFolderWorkspaceOwner } from './folder-workspace-runtime-owner'
|
||||
import type { WorktreeStartupPayload } from '@/lib/worktree-startup-payload'
|
||||
import type { IssueCommandLaunch } from '@/lib/worktree-setup-issue-command-queue'
|
||||
import { ensureWorktreeHasInitialTerminal } from '@/lib/worktree-initial-terminal-seeding'
|
||||
import {
|
||||
ensureWorktreeHasInitialTerminal,
|
||||
reseedGatedEmptyWorkspace
|
||||
} from '@/lib/worktree-initial-terminal-seeding'
|
||||
import { ensureWebRuntimeWorktreeTerminalAfterWake } from '@/lib/web-runtime-worktree-terminal-after-wake'
|
||||
import { applyWorktreeNavViewEntry } from '@/lib/worktree-nav-view-history-replay'
|
||||
|
||||
@@ -146,12 +149,8 @@ export function activateAndRevealFolderWorkspace(
|
||||
}
|
||||
if (shouldGateAgentActivation) {
|
||||
void gateWorktreeAgentActivation(workspaceKey).then((outcome) => {
|
||||
if (outcome === 'empty' && useAppStore.getState().activeWorktreeId === workspaceKey) {
|
||||
ensureFolderWorkspaceInitialTerminal(
|
||||
folderWorkspace,
|
||||
undefined,
|
||||
opts?.providesInitialSurface
|
||||
)
|
||||
if (outcome === 'empty') {
|
||||
reseedGatedEmptyWorkspace(workspaceKey, opts?.providesInitialSurface)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -264,17 +263,8 @@ export function activateAndRevealWorktree(
|
||||
}
|
||||
if (shouldGateAgentActivation) {
|
||||
void gateWorktreeAgentActivation(worktreeId).then((outcome) => {
|
||||
const currentState = useAppStore.getState()
|
||||
if (outcome === 'empty' && currentState.activeWorktreeId === worktreeId) {
|
||||
ensureWorktreeHasInitialTerminal(
|
||||
currentState,
|
||||
worktreeId,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{ reseedEmptiedWorkspace: opts?.providesInitialSurface !== true }
|
||||
)
|
||||
if (outcome === 'empty') {
|
||||
reseedGatedEmptyWorkspace(worktreeId, opts?.providesInitialSurface)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,6 +35,29 @@ function getSetupRunnerCommandPlatformForLaunch(setup: WorktreeSetupLaunch): 'wi
|
||||
)
|
||||
}
|
||||
|
||||
/** After the async activation gate reports an empty workspace: re-seed a shell unless the caller
|
||||
* promised its own surface or the user has already moved on. */
|
||||
export function reseedGatedEmptyWorkspace(
|
||||
workspaceKey: string,
|
||||
callerProvidesSurface: boolean | undefined
|
||||
): void {
|
||||
const state = useAppStore.getState()
|
||||
if (callerProvidesSurface === true || state.activeWorktreeId !== workspaceKey) {
|
||||
return
|
||||
}
|
||||
ensureWorktreeHasInitialTerminal(
|
||||
state,
|
||||
workspaceKey,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
reseedEmptiedWorkspace: true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export function ensureWorktreeHasInitialTerminal(
|
||||
store: WorktreeActivationStore,
|
||||
worktreeId: string,
|
||||
|
||||
Reference in New Issue
Block a user