Repository navigation
fix(runtime): flagged --command agent launches wait for the agent's TUI - #33466
Conversation
`terminal wait --for tui-idle` after `terminal create --command "omp <flags>"` satisfied in ~2s on a blank screen with agentIdentity null, and a prompt sent at that point was silently dropped: the bare-command matcher only recognizes exact launch commands, so any flags left the pane's agent unknown and the wait fell into the agent-null generic lane. Seed each runtime-owned spawn with its launch command line and resolve the pane agent from its first token for the wait ranking and the published identity; retiring the launch authority on exit also clears the seed so a pane returning to a shell prompt is not mistaken for the agent. Managed launches (no flags) are unchanged, no readiness rule is touched, and adopted or restored panes (no seeded command) keep their existing behavior. Fixes #25264 Generated-by: GLM-5.3-Flash (ZCode)
Rebase follow-up for #25320 onto the split runtime modules. Resolve the agent once at spawn instead of re-parsing on every summary/tui-idle read, so non-agent `--command` panes (e.g. `pnpm dev`) seed nothing and never enter launch-authority retirement. Reuse recognizeAgentLaunchCommand (launch-intent recognizer, tolerates `sleep N &&` prefixes), fix the missing record field in a fixture, drop a cast-based test hook and the redundant resolver unit file. Co-authored-by: ggbdpq <67929842+ggbdpq@users.noreply.github.com>
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.ts: 1
233-256:Trivial · Maintainability & Code Quality · Quick win Add a
tui-idlewait assertion for the flagged OMP launch.The new test checks only
listTerminals()identity. It cannot detect an earlywaitForTerminal(..., { condition: 'tui-idle' })result. No other flagged agent-command test combines runtime creation with this wait assertion.Add a deterministic fake-timer test that delays the first TUI output and asserts that
tui-idleresolves only after that output.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b9d05c22-dbdc-4efc-aac5-80e167bc5313
Files selected for processing: 11-
src/main/runtime/construction/runtime-identity-state.tssrc/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.tssrc/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.tssrc/main/runtime/runtime-agent-launch-resolution.tssrc/main/runtime/runtime-mobile-agent-status-first-turn.test.tssrc/main/runtime/runtime-terminal-state-records.tssrc/main/runtime/terminal/identity/pty-worktree-record.tssrc/main/runtime/terminal/launch/terminal-create.tssrc/main/runtime/terminal/launch/terminal-split-surface.tssrc/main/runtime/terminal/output/terminal-orchestration-authority.tssrc/main/runtime/terminal/query/pty-terminal-summary.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
ELI5
orca terminal create --command "omp --thinking high"is an omp pane, but Orca only recognised the exact bare commandomp. With flags the pane had no agent, soterminal wait --for tui-idleused the generic no-agent rule and returned "ready" a few seconds in, before omp had drawn anything. A prompt sent then got lost. Now Orca reads the agent from the launch command's executable, so flagged launches wait like bare ones.Root cause
resolveAgentTerminalCreateOptions(src/main/runtime/runtime-agent-terminal-startup.ts) only plans an agent throughresolveBareAgentLaunchCommand, which needs an exact match. That's intentional: flagged commands stay user-authored shell and are never rewritten. But it meanspty.launchAgentstays null.getPaneAgentForTuiIdle(src/main/runtime/construction/runtime-identity-state.ts) readslaunchAgent ?? foregroundAgent. Until a foreground-process read lands, a flagged launch has neither, so tui-idle goes down the agent-null lane and the publishedagentIdentityis null.What changed
launchCommandAgent: the TUI agent its--commandnames. It's resolved once with the existing launch-intent recognizerrecognizeAgentLaunchCommand, which keeps the headless/one-shot filter, soclaude -p …still resolves to null (codex exec …resolves to codex while it runs, matching what the foreground-process read already reports).launchAgent ?? foregroundAgent ?? launchCommandAgent. Published identity passeslaunchAgent ?? launchCommandAgentinto the existing resolver, where hook and process evidence still rank above it.133;D) clears it, the same way it clearslaunchAgent.--commandpanes such aspnpm devseed nothing, so they never go through launch-authority retirement.Verification (real CLI, dev Orca built from this branch, isolated userData)
I used the issue's repro script with
omp18.10.3, through a PATH shim that adds an 8s cold-start delay. On this machine omp draws in about 0.5s, so without the delay the race never shows. The issue reported 13–21s.--commandomp --thinking highagentIdentity: null, 1 screen line, prompt left unsubmitted in the composer, no reply (2/2)agentIdentity: "omp", 13 lines,pongreceived (2/2)omp --approval-mode yoloomp,pongomp(bare)omp,pongomp,pongomp --version(exits right away):agentIdentitygoes back to null after exit.pnpm tc:nodepasses.expected null to be 'omp').pnpm test src/main/runtime/orca-runtime.test.ts: everything passes except 2 existing-folder import tests. Those fail identically on origin/main (macOS/privatepath).check:code-quality:changedis clean.Risk
Low. The change is identity-only and doesn't change the wire shape:
agentIdentitygains values it was already typed for. SSH and remote runtime spawns go through the same runtime create path. Mobile reads the same published identity. Windows is covered because the recognizer strips.exe/.cmdlauncher extensions.Known limitation, shared with bare managed launches: if the shell emits no
133;Dwhen the agent exits (seen here with bash), the pane keeps the agent identity until the next process read or exit. This PR doesn't change that.Fixes #25264
Supersedes #25320 (credit: @ggbdpq, original commit preserved).