Repository navigation
Conversation
…hed commands to their paint (STA-9412) terminal create --command "omp --thinking high" settled tui-idle about 2s after create: readiness only knew the pane's agent from an exact launch-command match or a later OSC title, so the pane read as unknown, and the unknown lane treated a pane with no output clock as quiet. Record the agent the launch command's argv names (env prefixes, paths, quoted Windows paths, .exe/.cmd, user overrides by command words, disabled agents) on the PTY record for readiness only, leaving the startup plan and launchAgent consumers untouched. A command Orca launched that names no agent now waits for its own paint instead of settling on silence. Co-Authored-By: Claude <[email protected]>
…le settles A launched command whose argv names only a wrapper script that execs an agent (DSH via a wrapper) still read as an unknown command: once it painted a splash and went quiet, the foreground poll settled tui-idle before the composer. When the foreground process of a launched pane names an agent the pane does not know yet, refresh the pane's foreground agent instead of settling, so the next evaluation ranks it by that agent's own lanes. Panes Orca did not launch keep the uncorroborated quiet-foreground settle. Test fixtures now use neutral command names. Co-Authored-By: Claude <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe terminal pane harness now records startup commands. PTY paint observation reports the first visible command paint and can trigger foreground-agent refresh. Wrapper processes can be identified through foreground command-line lookup. TUI idle evidence includes launch-command status, and launched unknown or non-TUI panes use the after-paint lane. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to A locally launched wrapper can be reported ready while its agent is still starting, potentially losing an immediate prompt. Resolve or explicitly accept this readiness risk before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3a349a91-d7cf-4200-b5fb-8b56509150fd
📒 Files selected for processing (18)
src/main/runtime/agent-transcript-pane-test-harness.tssrc/main/runtime/orca-runtime-create-terminal-dependencies.tssrc/main/runtime/orca-runtime-create-terminal-desktop.tssrc/main/runtime/orca-runtime-create-terminal.tssrc/main/runtime/orca-runtime-resolve-worktree-removal-target.tssrc/main/runtime/orca-runtime-runtime-id.tssrc/main/runtime/runtime-agent-launch-resolution.test.tssrc/main/runtime/runtime-agent-launch-resolution.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/runtime-terminal-idle-polls.test.tssrc/main/runtime/runtime-terminal-idle-polls.tssrc/main/runtime/runtime-terminal-state-records.tssrc/main/runtime/terminal-wait-name-only-idle.test.tssrc/main/runtime/tui-idle-evidence-source.tssrc/main/runtime/tui-idle-evidence.test.tssrc/main/runtime/tui-idle-evidence.tssrc/main/runtime/tui-idle-launch-command-identity.test.tssrc/shared/agent-process-recognition.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| const pty = runtime.ptysById.get(runtime.handles.get(handle)?.ptyId) | ||
| if (pty && launchOpts.launchCommandIdentity) { | ||
| pty.launchCommandIdentity ??= launchOpts.launchCommandIdentity | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
rg -nP -C12 'waitForTerminalHandle\s*\(' src/main/runtime --type=ts | head -80Repository: stablyai/orca
Length of output: 6127
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- waitForTerminalHandle and nearby declarations ---'
sed -n '90,190p' src/main/runtime/orca-runtime-restore-live-paired-renderer-session-owned-mobile-terminals.ts
printf '%s\n' '--- resolveHandleForTab and related handle/PTY registration references ---'
rg -n -F --glob '*.ts' -e 'resolveHandleForTab' -e 'handles.set' -e 'ptysById.set' -e 'ptyId' src/main/runtime | head -160
printf '%s\n' '--- runtime declarations and graph-sync handlers ---'
rg -n -F --glob '*.ts' -e 'handles:' -e 'ptysById:' -e 'graphSyncCallbacks' -e 'register.*Pty' -e 'register.*Handle' src/main/runtime | head -200Repository: stablyai/orca
Length of output: 35885
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- exact resolveHandleForTab declaration and references ---'
rg -n -F --glob '*.ts' -- 'resolveHandleForTab' src | head -120
printf '%s\n' '--- handle map declarations and writes ---'
rg -n -F --glob '*.ts' -- 'handleByPtyId' src/main/runtime | head -120
rg -n -F --glob '*.ts' -- 'handles.set' src/main/runtime | head -120
printf '%s\n' '--- PTY registration implementation ---'
sed -n '1,180p' src/main/runtime/orca-runtime-register-pty.ts
printf '%s\n' '--- graph sync handler around callback dispatch ---'
sed -n '260,335p' src/main/runtime/orca-runtime-sync-window-graph.tsRepository: stablyai/orca
Length of output: 20520
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- resolveHandleForTab and surrounding methods ---'
sed -n '120,185p' src/main/runtime/orca-runtime-wait-for-leaf-pty-id.ts
printf '%s\n' '--- adoptPreAllocatedHandle declaration and implementation ---'
rg -n -F --glob '*.ts' -- 'adoptPreAllocatedHandle' src/main/runtime
sed -n '1,220p' src/main/runtime/orca-runtime-bind-pty-incarnation-handle.ts
printf '%s\n' '--- handle and PTY map declarations ---'
sed -n '285,315p' src/main/runtime/orca-runtime-runtime-id.ts
rg -n -F --glob '*.ts' -- 'ptysById = ' src/main/runtimeRepository: stablyai/orca
Length of output: 10620
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- issueHandle declaration and callers ---'
rg -n -F --glob '*.ts' -- 'issueHandle' src/main/runtime | head -120
printf '%s\n' '--- likely owning implementation ---'
rg -n -F --glob '*.ts' -- 'protected issueHandle' src/main/runtimeRepository: stablyai/orca
Length of output: 2945
🏁 Script executed:
#!/bin/bash
set -e
sed -n '135,205p' src/main/runtime/orca-runtime-build-pty-terminal-summary.tsRepository: stablyai/orca
Length of output: 2401
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- registerPty call sites ---'
rg -n -F --glob '*.ts' -- 'registerPty(' src/main | head -120
printf '%s\n' '--- graph leaf update and PTY identity handling ---'
rg -n -F --glob '*.ts' -e 'ptyId:' -e 'this.leaves' -e 'setLeaf' src/main/runtime/orca-runtime-sync-window-graph.ts | head -120
sed -n '1,130p' src/main/runtime/orca-runtime-sync-window-graph.tsRepository: stablyai/orca
Length of output: 21762
Do not lose the launch identity before the PTY is registered.
waitForTerminalHandle waits for a non-null leaf ptyId, but it does not require that ID to exist in runtime.ptysById. If graph sync publishes the leaf before registerPty records the PTY, the post-wait lookup skips launchCommandIdentity, and the new readiness handling does not apply. Tie identity assignment to PTY registration, or make waitForTerminalHandle wait for both conditions.
…irst paint Rework of the launch-identity fix onto Orca's existing identity path, per review. Drop the PTY record's launchCommandIdentity slot, the argv first-word resolver, the desktop-create patch and the idle poll's identity side effect. Instead the existing foreground-agent refresh, which ran only after a title observation, also runs when a launched command first paints, so a flagged agent launch or a wrapper that execs an agent is named by its real process via the existing recognizer before tui-idle reads its boot as rest. tui-idle keeps launchAgent ?? foregroundAgent; the poll only evaluates. Whether a pane was launched with a command comes from the existing spawn command map; an unknown launched command keeps the 'after-paint' lane, and panes Orca did not launch keep 'open'. Co-Authored-By: Claude <[email protected]>
… line dsh-tui runs as a `node` process, so the foreground-agent refresh could not name `dsh-tui . --yolo` or a wrapper that execs it, and tui-idle read the pane as an unknown command. When the foreground process is a runtime, read its command line on this host and recognise it there, as the OpenCode run-lifetime reader already does. SSH and WSL panes, whose command line this host cannot read, keep the process-name recognition. Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2c127327-d6a6-4dbf-9acd-b4458c35c56c
📒 Files selected for processing (10)
src/main/runtime/agent-transcript-pane-test-harness.tssrc/main/runtime/orca-runtime-on-pty-data.tssrc/main/runtime/orca-runtime-runtime-id.tssrc/main/runtime/orca-runtime-stop-requested-pty-ids.tssrc/main/runtime/runtime-pty-foreground-agent.test.tssrc/main/runtime/runtime-pty-foreground-agent.tssrc/main/runtime/terminal-command-paint.test.tssrc/main/runtime/terminal-command-paint.tssrc/main/runtime/tui-idle-evidence-source.tssrc/main/runtime/tui-idle-launch-command-identity.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/runtime/tui-idle-evidence-source.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| !pty.foregroundAgent && | ||
| this.terminalSpawnCommandsByPtyId.has(ptyId) | ||
| ) { | ||
| void this.ptyForegroundAgent.refresh(ptyId) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the first-paint refresh pending during quiet readiness.
If a launched wrapper paints a splash and command-line lookup takes longer than the quiescence interval, this fire-and-forget refresh leaves foregroundAgent null. The idle poll can then use the unknown-command after-paint lane, read a non-shell foreground process, and settle before the wrapper’s agent is named. A prompt can reach a TUI that is still booting. Make the poll defer quiet settlement while this refresh is pending, and test with a delayed command-line lookup. The poll’s foreground read does not wait for agent recognition. (raw.githubusercontent.com)
…ignal The flagged-launch and wrapper cases settled DSH through its first-party OSC done, a lane the DSH hook-store work removes. Settle them on Codex's explicit idle title instead, which tui-idle reads for any agent, and make the wrapper case a runtime-hosted agent named from its foreground command line. Both still stay pending on the splash until the agent's own rest signal. Co-Authored-By: Claude <[email protected]>
ELI5
When you start an agent with extra options, like
omp --thinking high, Orca didn't recognise it as an agent. It guessed "ready" about 2 seconds in, before the agent had drawn anything, and the first message you sent was lost. Orca now checks which program is actually running as soon as the launched command first draws something, and waits for that agent properly.What Changed
Before:
terminal create --command "omp --thinking high"→terminal wait --for tui-idlereturned ready about 2 s after creating the terminal, on a blank screen.terminal sendwas silently dropped.-c …flags, and DSH started asdsh-tui . --yoloor through a wrapper script, had the same problem.After: these launches are named by their real foreground process and wait for that agent's own ready signal.
Mechanism, all through existing paths:
launchAgent ?? foregroundAgent.RuntimePtyForegroundAgent.refresh) used to run only after the agent set a terminal title. It now also runs when a command Orca launched first draws to the screen.terminalSpawnCommandsByPtyId).node,python) are named from their command line. This uses the existingreadLocalPtyForegroundCommandLine+recognizeAgentProcessFromCommandLinepair, which OpenCode's run tracking already uses. The local-only check (not SSH or WSL) is now shared with that code.opentoafter-paint. Panes Orca didn't launch keep today's behaviour.launchAgentconsumer (startup plan, prompt gate, resume, mobile status, orchestration);Why
Linked Issue
Fixes #25264
Related: #17291. Its worker-start prompt gate keys on
launchAgent, which this PR deliberately doesn't change.Visual Proof
N/A: no UI change. This changes when a readiness wait settles; live timings are under Testing.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Unit and runtime tests. These fail on the base commit:
These pass on both, as intended:
New foreground-recognition cases cover:
noderunning dsh-tui, a direct process name,noderunning something else, and an unreadable command line.Live, macOS, isolated background dev runtime. DSH rows were run with fix(runtime): settle a cold-started DSH pane on its idle composer #26691's DSH screen rules merged locally:
omp --thinking highpongdeliveredomppongdeliveredcodex -c model_reasoning_effort="high"(folder trusted)pongdeliveredvim/lessdsh-tui . --yolonodenameddshdshpnpm tc,check:code-quality:changed, and 19 related test files (1613 tests) are clean.Review
Agent skill upstream boundary
Notes
after-paintlane.launchAgent, so neither path changes.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)