fix(orchestration): offer the worker brief to the one launch carry rule

Round-1 review fixes. The worker brief no longer forces its own sensitive
launch file past the host checks. Worker start offers the brief as an ordinary
startup prompt with main's paste (`once-agent-runs`): it rides the agent's
launch line where the line carries it exactly, and is otherwise pasted once the
agent is ready, as main pasted it, so a host that cannot take a launch file no
longer fails the start. With no sensitive file, the agent's hook reports the
brief itself, which status readers compact to its task as on main.

- Created worktrees are agent-first again, as on main: the startup terminal
  keeps the handle the brief names, setup and default tabs follow it, and a
  wait-for-setup sequence still holds the agent until setup succeeds.
- The brief names the CLI command the spawn's own WSL decision will give the
  terminal.
- A launch the shell reports finished, with no agent in front, fails and tears
  down the start. Where hooks are off or never reach the pane, the launch is
  judged by main's evidence: a title turn-start edge, or the agent holding its
  terminal.
This commit is contained in:
Brennan Benson
2026-10-02 08:00:32 -07:00
parent 922d2679f0
commit 5468de16bc
42 changed files with 1231 additions and 706 deletions
@@ -15,6 +15,7 @@ import {
type AgentStartupPlan
} from '../../shared/tui-agent-startup'
import type { LaunchFile } from '../../shared/launch-prompt-file'
import type { LaunchPromptPaste } from '../../shared/launch-prompt-carry'
import { thisOrcaLaunchHost } from './this-orca-launch-host'
import {
detectInstalledAgentsWithShellPathHydration,
@@ -137,6 +138,8 @@ export function buildWorktreeStartupForAgent(
/** Set by a caller that pastes an uncarried prompt itself; reports whether it rode the command,
* and no follow-up is returned for it to paste twice. */
onPromptCarry?: (carried: boolean) => void
/** The caller's paste for what the line leaves; #24257's guarded paste by default. */
promptPaste?: LaunchPromptPaste
}
): {
agent: TuiAgent
@@ -164,7 +167,7 @@ export function buildWorktreeStartupForAgent(
settings
}),
// The caller, or else the host's follow-up, pastes what the line leaves once the agent runs.
paste: 'when-host-proves-agent'
paste: environment.promptPaste ?? 'when-host-proves-agent'
})
if (!planned) {
throw new Error(`Could not build launch command for ${agent}.`)