Repository navigation
Conversation
Keep pending startup routes unbound during owner hydration, and require a current positive shell observation before publishing title-derived exit facts. Co-authored-by: Codex <noreply@openai.com>
aaca3e1 to
af0b73e
Compare
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Keep the exit candidate when foreground… · terminal-agent-status-and-submission.ts:168-172
src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts:168-172
🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep the exit candidate when foreground inspection is absent.
If no hook-presence checker is configured,
confirmPtyAgentExitpasseskeepOnSilence=false. If the controller is absent, this branch then emitsagent-exitedwithout observing a shell. The new no-controller test uses anunverifiablechecker, so it does not cover this path. Preserve the candidate when a title-derived exit has no foreground evidence.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6affcaad-f838-4363-a10a-90347a83d50d
📒 Files selected for processing: 5
src/main/runtime/orca-runtime-tests/terminal-agent-exit-evidence.spec.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/terminal/input/terminal-agent-status-and-submission.tssrc/renderer/src/components/native-chat/native-chat-leaf-routing.tssrc/renderer/src/components/native-chat/native-chat-startup-routing.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| typeof result.process === 'string' && | ||
| result.process.trim().length > 0 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- changed-file diff ---'
git diff --no-ext-diff 922014afcb8e277c0dc4bd6e13244fb29f01171b af0b73ea3046b032773c924636667df32cef798d -- src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts
printf '%s\n' '--- relevant references ---'
rg -n -F --glob '*.ts' -e 'ptyForegroundAgent' -e 'confirmLegacyPtyAgentExit' -e 'confirmPtyAgentExit' src/main/runtime src/main | head -200
printf '%s\n' '--- changed-file excerpt ---'
nl -ba src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts | sed -n '150,260p'
printf '%s\n' '--- foreground-reader declarations and implementations ---'
rg -n -F --glob '*.ts' -e 'class PtyForeground' -e 'ForegroundAgent' -e 'readForeground' -e 'foregroundProcess' -e 'isAvailable' src/main | head -240Repository: stablyai/orca
Length of output: 39086
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- runtime service foreground agent ---'
nl -ba src/main/runtime/construction/runtime-service-state.ts | sed -n '130,205p'
rg -n -F --glob '*.ts' -e 'class RuntimePtyForegroundAgent' -e 'RuntimePtyForegroundAgent' -e 'ForegroundRead' -e 'foreground read' src | head -200
printf '%s\n' '--- likely implementation files ---'
rg --files src | rg -i 'foreground|pty.*agent|process.*inspection' | head -200
printf '%s\n' '--- terminal-host inspection implementation ---'
nl -ba src/main/daemon/terminal-host-process-inspection.ts | sed -n '1,175p'
nl -ba src/main/daemon/terminal-host-process-inspection-cheap-tier.test.ts | sed -n '240,370p'Repository: stablyai/orca
Length of output: 40359
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- RuntimePtyForegroundAgent ---'
nl -ba src/main/runtime/runtime-pty-foreground-agent.ts | sed -n '1,280p'
printf '%s\n' '--- remote foreground evidence ---'
nl -ba src/main/providers/agent-foreground-process.ts | sed -n '1,280p'
nl -ba src/shared/remote-foreground-evidence-admission.ts | sed -n '1,260p'
nl -ba src/shared/foreground-wrapper-agent.ts | sed -n '1,220p'
nl -ba src/shared/foreground-process-evidence.ts | sed -n '1,220p'
printf '%s\n' '--- controller read binding ---'
nl -ba src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts | sed -n '1,130p'Repository: stablyai/orca
Length of output: 39878
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- controller contract and getForegroundProcess implementations ---'
rg -n -F --glob '*.ts' -e 'getForegroundProcess(ptyId' -e 'getForegroundProcess:' -e 'getForegroundProcess =' -e 'getForegroundProcess(' src/main/runtime src/main/providers src/main/daemon src/main | head -260
nl -ba src/main/runtime/runtime-pty-controller-contract.ts | sed -n '1,220p'
printf '%s\n' '--- controller construction and execution-host bindings ---'
rg -n -F --glob '*.ts' -e 'new RuntimePtyController' -e 'implements RuntimePtyController' -e 'getForegroundProcess' src/main | head -260
rg -n -F --glob '*.ts' -e 'ssh.exe' -e 'wsl.exe' -e 'ssh' -e 'wsl' src/main/runtime src/main/daemon src/main/providers | head -260Repository: stablyai/orca
Length of output: 41422
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- controller contract ---'
rg -n -F --glob '*.ts' -e 'getForegroundProcess' src/main/runtime/runtime-pty-controller-contract.ts src/main/runtime | head -200
nl -ba src/main/runtime/runtime-pty-controller-contract.ts | sed -n '1,180p'
printf '%s\n' '--- controller bindings ---'
rg -n -F --glob '*.ts' -e 'getForegroundProcess:' -e 'getForegroundProcess =' -e 'getForegroundProcess(' src/main | head -260
printf '%s\n' '--- shell predicate ---'
rg -n -F --glob '*.ts' -e 'function isShellProcess' -e 'const isShellProcess' -e 'export { isShellProcess' -e 'isShellProcess' src/shared/agent-detection.ts src/shared/shell-process-detection.ts
nl -ba src/shared/shell-process-detection.ts | sed -n '1,180p'
nl -ba src/shared/agent-detection.ts | sed -n '1,100p'Repository: stablyai/orca
Length of output: 41631
Require a confirmed shell before consuming the exit candidate.
RuntimePtyForegroundAgent.read marks any fulfilled process-name read as available. When keepOnSilence is enabled, answered must also require isShellProcess(result.process). A non-empty wrapper name such as ssh.exe or wsl.exe must remain unverifiable and preserve the exit candidate.
🐛 Suggested fix
--- "a/src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts"
+++ "b/src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts"
@@ -210,11 +210,13 @@
this.restoreDisprovedAgentExit(ptyId, confirmedStatus)
return
}
+import { isShellProcess } from '../../../../shared/shell-process-detection'
+
const answered =
result.controller === this.ptyController &&
result.available &&
typeof result.process === 'string' &&
- result.process.trim().length > 0
+ isShellProcess(result.process)
if (!keepOnSilence || answered) {
if (!recoverCompletedHook) {
this.recordTerminalSideEffectFact(ptyId, { kind: 'agent-exited' })| if (!args.chatLeafId && !confirmedAgentExit) { | ||
| // Host and agent evidence can hydrate after the pane; keep the request unbound until eligible. | ||
| return { chatLeafId: null, exitChat: false } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
rg -n -C 6 'chatLeafHasConfirmedAgentExit|applyNativeChatLeafRoute|agent-exited|agentExited' src/renderer/src/componentsRepository: stablyai/orca
Length of output: 29818
🏁 Script executed:
set -eu
printf '%s\n' '--- native-chat-leaf-routing.ts ---'
nl -ba src/renderer/src/components/native-chat/native-chat-leaf-routing.ts | sed -n '80,145p'
printf '%s\n' '--- use-terminal-pane-chat-state.ts ---'
nl -ba src/renderer/src/components/terminal-pane/use-terminal-pane-chat-state.ts | sed -n '125,215p'
printf '%s\n' '--- use-terminal-pane-projection.ts ---'
nl -ba src/renderer/src/components/terminal-pane/use-terminal-pane-projection.ts | sed -n '100,145p'
printf '%s\n' '--- route references and exit callback references ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'handleConfirmedAgentExit' -e 'onAgentExitedRef' -e 'resolveNativeChatLeafRoute' -e 'setNativeChatViewMode' src/renderer/src/componentsRepository: stablyai/orca
Length of output: 14762
🏁 Script executed:
set -eu
printf '%s\n' '--- changed diff for routing and chat state ---'
git diff --no-ext-diff --unified=35 922014afcb8e277c0dc4bd6e13244fb29f01171b af0b73ea3046b032773c924636667df32cef798d -- \
src/renderer/src/components/native-chat/native-chat-leaf-routing.ts \
src/renderer/src/components/terminal-pane/use-terminal-pane-chat-state.ts \
src/renderer/src/components/terminal-pane/use-terminal-pane-projection.ts
printf '%s\n' '--- exit callback contract and dispatch ---'
nl -ba src/renderer/src/components/terminal-pane/use-terminal-pane-process-exit-actions.ts | sed -n '80,155p'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/agent-idle-working-handlers.ts | sed -n '1,55p'
printf '%s\n' '--- routing tests around exit and startup ---'
nl -ba src/renderer/src/components/native-chat/native-chat-leaf-routing.test.ts | sed -n '100,255p'
nl -ba src/renderer/src/components/native-chat/native-chat-startup-routing.test.ts | sed -n '1,75p'Repository: stablyai/orca
Length of output: 17548
Handle a confirmed exit while Chat is unbound.
When chatLeafId is null, handleConfirmedAgentExit returns before resolveNativeChatLeafRoute receives the confirmed-exit flag. A confirmed exit can therefore leave the pending Chat request open. Keep the mismatch guard for a bound Chat leaf, but allow an unbound request through.
Suggested fix
- if (leafId !== chatLeafId) {
+ if (chatLeafId && leafId !== chatLeafId) {
return
}
ELI5
Chat should stay open while Orca is still finding its agent or cannot verify the foreground process.
What Changed
The execution host emits a title-derived
agent-exitedfact only after its current controller positively identifies a shell. Missing, empty, wrapper-only or replaced-controller results preserve the exit candidate for a later trustworthy observation.The renderer also keeps a requested Chat mode unbound while an initial pane's eligibility hydrates. It still exits for a confirmed agent exit or removal of a previously bound pane; it never binds the composer to a plain shell.
Why
A failed observation is not evidence of process exit. These two small changes preserve the existing host-owned lifecycle and renderer routing model instead of adding a client status cache or inventing a second lifecycle producer.
Linked Issue
Fixes #22707
Visual Proof
Pending: rendered startup/reconnect before/after evidence. This is a draft; source tests are not a desktop interaction recording.
Testing
Windows: 60 focused runtime exit/side-effect cases and 18 renderer routing cases passed. After switching the five new exit cases to upstream-supported Codex, all five passed again. Startup coverage uses Grok. Other runtime cases were excluded by the test-name filter (1,267 skipped in the combined run; 1,307 in the five-case rerun), so this is not a full-suite pass. Node/web typechecks, changed-code quality and lint-staged passed. No live SSH/WSL, macOS/Linux, packaging or rendered Electron checks.
AI Disclosure
Prepared and verified with Codex. Delegated attempts were blocked by account quota and produced no code.
Review
Host/controller provenance, reconnect races, unavailable capabilities, later positive shell evidence and existing pane-close behavior are covered. No Cursor/Antigravity Chat foundation or mobile implementation is included.
Agent skill upstream boundary
Notes
Six files, no wire-format changes. Startup routing remains independent of git worktree versus folder-workspace identity.
Checklist