Repository navigation
fix(agent-status): show Claude/Codex panes waiting on the folder-trust dialog - #33804
Conversation
…t dialog Hooks only start after a folder is trusted, so a pane parked on Claude's or Codex's trust dialog had no sidebar row (or an idle one) even though agentWait already reported agent-trust-workspace. Main's headless-screen observer now runs the same blocked-text detector on the screen and projects a waiting row while the dialog shows, settling it with a session-boundary done once the dialog leaves. The row is not first-party evidence: it skips the prompt lifecycle and lastExplicitAgentStatus. Refs #25854 Co-Authored-By: Claude <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

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:
c9057453-3311-4604-838d-4fe5066efb44
Files selected for processing: 4-
src/main/runtime/startup-dialog-terminal-status.test.tssrc/main/runtime/startup-dialog-terminal-status.tssrc/main/runtime/terminal/output/headless-terminal-hydration.tssrc/main/runtime/terminal/output/terminal-derived-agent-facts.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
| // Runs every chunk: its scan tracks when the dialog leaves the screen. | ||
| this.observeTrustDialogStatus(ptyId, pty, state, chunk, readStatus) |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
sed -n 60,200p src/main/runtime/terminal/output/headless-terminal-hydration.ts cat src/main/runtime/startup-dialog-terminal-status.ts rg -n "maybeHydrateHeadlessFromRenderer|seedHeadless|hydrateHeadless" src/main/runtime | head -30
Repository: stablyai/orca
Length of output: 14396
Script executed:
set -o pipefail printf '%s\n' '--- hydration declaration and seed block ---' nl -ba src/main/runtime/terminal/output/headless-terminal-hydration.ts | sed -n '1,150p' printf '%s\n' '--- observer call and status publication ---' nl -ba src/main/runtime/terminal/output/headless-terminal-hydration.ts | sed -n '150,280p' printf '%s\n' '--- hydration call sites ---' rg -n -F --glob '*.ts' -e 'maybeHydrateHeadlessFromRenderer' -e 'serializeBuffer' -e 'headlessHydrationState' src/main src/renderer || test "$?" -eq 1 printf '%s\n' '--- surrounding caller definitions ---' rg -n -F --glob '*.ts' -e 'hydrateHeadlessFromRenderer' -e 'renderer hydration' -e 'serializeBuffer!' src/main/runtime src/main | head -120
Repository: stablyai/orca
Length of output: 41741
Script executed:
set -o pipefail printf '%s\n' '--- direct hydration callers ---' rg -n -F --glob '*.ts' -- 'maybeHydrateHeadlessFromRenderer' src || test "$?" -eq 1 printf '%s\n' '--- surrounding ingestion callers ---' rg -n -F --glob '*.ts' -e 'trackHeadlessTerminalData(' -e 'hasRendererSerializer(' -e 'registerSerializer' src/main src/renderer | head -160 printf '%s\n' '--- serializer implementation ---' nl -ba src/main/ipc/pty/runtime/controller.ts | sed -n '60,115p' nl -ba src/main/ipc/pty/ipc/serialize-buffer.ts | sed -n '80,125p' printf '%s\n' '--- relevant caller context ---' python3 - <<'PY' from pathlib import Path for p in Path('src').rglob('*.ts'): text = p.read_text(errors='replace') needle = 'maybeHydrateHeadlessFromRenderer' if needle in text: lines = text.splitlines() for i, line in enumerate(lines): if needle in line: print(f'--- {p}:{i+1} ---') for n in range(max(0, i-8), min(len(lines), i+14)): print(f'{n+1}: {lines[n]}') PY
Repository: stablyai/orca
Length of output: 11271
Observe trust dialogs restored from renderer snapshots.
If hydration restores a snapshot that already shows a trust dialog, the seed write bypasses observeTrustDialogStatus. A later chunk without trust also does not detect the dialog because the scan is not marked as shown. The sidebar can therefore miss the waiting row.
Run the trust-dialog observer after the seed completes. Keep this projection separate from prompt-lifecycle evidence.
… on agent exit Require the dialog's key footer and trust choice so quoted wording in a reply cannot raise a waiting row, settle the row once a killed agent's pane is back at a shell, and cover dismissal with a Codex 0.164 recording. Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Publish trust-dialog projections per mounted leaf. · headless-terminal-hydration.ts:221-240
src/main/runtime/terminal/output/headless-terminal-hydration.ts:221-240
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPublish trust-dialog projections per mounted leaf.
readPtyAgentStatusRowreads only the first leaf’s row, whileemitTerminalAgentStatusEventssends the projection to every mounted leaf. The receiver resolves each event by its target pane key, but this projection does not carry the fields required by the hook-precedence guards. A trust-dialog update can overwrite a live hook-owned row on another leaf or use the first leaf’s row to omit that leaf’s waiting or settlement update.Select the row and publish the projection for the same target leaf instead of using one PTY-wide decision.

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:
c79d32fe-742e-4b7a-8b0d-c84a239114e1
Files selected for processing: 5-
src/main/runtime/__fixtures__/codex-0-164-0-trustprompt-answered.meta.jsonsrc/main/runtime/__fixtures__/codex-0-164-0-trustprompt-answered.txtsrc/main/runtime/startup-dialog-terminal-status.test.tssrc/main/runtime/startup-dialog-terminal-status.tssrc/main/runtime/terminal/output/headless-terminal-hydration.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
ASCII-escape the dialog regexes for the orcad build, settle only after a quiet settled screen without the dialog or a proven shell foreground (readLaunchedAgentForeground, which is the only shell-alone proof on Windows), so a resize repaint split across reads no longer flips the row and re-notifies. Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2

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:
be87a91e-1a15-4836-99c3-54b1a159824d
Files selected for processing: 3-
src/main/runtime/startup-dialog-terminal-status.test.tssrc/main/runtime/startup-dialog-terminal-status.tssrc/main/runtime/terminal/output/headless-terminal-hydration.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.
-
| if (row && row.observation?.origin === 'hook' && !row.providerSessionOnly) { | ||
| return null | ||
| } |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
#!/bin/bash # Check how hook-origin rows are cleared when an agent exits or a new agent launches in the same pane. rg -nP --type=ts -C3 'getAgentStatusSnapshotForPane|clearAgentStatus|retireAgentStatus|removeAgentStatus' src/main -g '!**/*.test.ts' | head -120 rg -nP --type=ts -C3 "origin:\s*'hook'" src/main src/shared -g '!**/*.test.ts' | head -80
Repository: stablyai/orca
Length of output: 8193
Script executed:
#!/bin/bash set -e printf '%s\n' '--- trust status module ---' nl -ba src/main/runtime/startup-dialog-terminal-status.ts | sed -n '1,190p' printf '%s\n' '--- snapshot implementation and status lifecycle symbols ---' rg -n -F --glob '*.ts' \ -e 'getStatusSnapshotForPane' \ -e 'getStatusSnapshot()' \ -e 'setAgentStatus' \ -e 'clearAgentStatus' \ -e 'retireAgentStatus' \ -e 'removeAgentStatus' \ -e 'statusByPane' \ -e 'statusRows' \ -e 'origin: '\''hook'\''' \ src/main/agent-hooks src/shared src/main/runtime printf '%s\n' '--- candidate server declarations ---' rg -l -F --glob '*.ts' 'getStatusSnapshotForPane' src/main/agent-hooks src/shared src/main/runtime | while read -r f; do printf '\n### %s\n' "$f" nl -ba "$f" | sed -n '1,260p' done
Repository: stablyai/orca
Length of output: 45665
Script executed:
#!/bin/bash set -e printf '%s\n' '--- non-test definitions ---' rg -n -F --glob '*.ts' --glob '!*.test.ts' \ -e 'getStatusSnapshotForPane' \ -e 'getStatusSnapshot()' \ -e 'clearPaneState' \ -e 'clearStatus' \ -e 'statusByPane' \ -e 'rowsByPane' \ -e 'Map<string, AgentStatus' \ src/main/agent-hooks printf '%s\n' '--- server files ---' rg --files src/main/agent-hooks | rg '/server($|/)|server\.ts$|status' printf '%s\n' '--- likely implementation excerpts ---' for f in src/main/agent-hooks/server.ts src/main/agent-hooks/server/index.ts src/main/agent-hooks/server/status-store.ts src/main/agent-hooks/server/agent-status-store.ts; do if [ -f "$f" ]; then printf '\n### %s\n' "$f" nl -ba "$f" | sed -n '1,280p' fi done
Repository: stablyai/orca
Length of output: 9624
Script executed:
#!/bin/bash set -e printf '%s\n' '--- snapshot methods ---' nl -ba src/main/agent-hooks/server/server-listeners.ts | sed -n '180,245p' printf '%s\n' '--- server state declarations and snapshot-related helpers ---' nl -ba src/main/agent-hooks/server/server-state.ts | sed -n '1,180p' nl -ba src/main/agent-hooks/server/server-state.ts | sed -n '240,330p' printf '%s\n' '--- terminal status ingestion ---' nl -ba src/main/agent-hooks/server/server-ingest-terminal.ts | sed -n '1,300p' printf '%s\n' '--- terminal status update/application ---' nl -ba src/main/agent-hooks/server/server-status-update.ts | sed -n '1,320p' printf '%s\n' '--- pane cleanup ---' nl -ba src/main/agent-hooks/server/server-tab-cleanup.ts | sed -n '110,205p' nl -ba src/main/agent-hooks/server/server-cleanup.ts | sed -n '1,190p'
Repository: stablyai/orca
Length of output: 43481
Script executed:
#!/bin/bash set -e printf '%s\n' '--- launch identity implementation and callers ---' rg -n -F --glob '*.ts' \ -e 'recordLaunchResumeIdentity' \ -e 'trustDialogWaitingStatus' \ -e 'lastStatusByPaneKey' \ src/main src/shared printf '%s\n' '--- launch identity body ---' nl -ba src/main/agent-hooks/server/server-ingest-terminal.ts | sed -n '20,115p' printf '%s\n' '--- launch identity callers ---' rg -l -F --glob '*.ts' 'recordLaunchResumeIdentity' src/main src/shared | while read -r f; do printf '\n### %s\n' "$f" rg -n -F -C8 'recordLaunchResumeIdentity' "$f" done printf '%s\n' '--- trust status callers ---' rg -l -F --glob '*.ts' 'trustDialogWaitingStatus' src/main src/shared | while read -r f; do printf '\n### %s\n' "$f" rg -n -F -C14 'trustDialogWaitingStatus' "$f" done
Repository: stablyai/orca
Length of output: 39483
Script executed:
#!/bin/bash set -e printf '%s\n' '--- resume identity launch helper ---' nl -ba src/main/ipc/pty/pane/resume-launch-identity.ts | sed -n '1,85p' printf '%s\n' '--- callers of the launch helper ---' rg -n -F -C12 --glob '*.ts' 'seedResumeLaunchIdentityFromSpawn' src/main printf '%s\n' '--- production clearPaneState callers in launch/runtime scopes ---' rg -n -F --glob '*.ts' --glob '!*.test.ts' 'clearPaneState(' src/main/ipc src/main/runtime src/main/pty src/main | head -160
Repository: stablyai/orca
Length of output: 13859
Do not let a completed hook row suppress the trust-dialog row.
When a pane starts a fresh launch without a resumable provider session, its previous done hook row can remain in the pane snapshot. The current guard then returns null, so the trust-dialog row is not published.
🐛 Suggested fix
-
--- "a/src/main/runtime/startup-dialog-terminal-status.ts" +++ "b/src/main/runtime/startup-dialog-terminal-status.ts" @@ -105,9 +105,14 @@ if (agent !== 'claude' && agent !== 'codex') { return null } - if (row && row.observation?.origin === 'hook' && !row.providerSessionOnly) { + if ( + row && + row.state !== 'done' && + row.observation?.origin === 'hook' && + !row.providerSessionOnly + ) { return null } return { state: 'waiting', agentType: agent, prompt: '', toolInput: TRUST_DIALOG_TOOL_INPUT } }
Committable suggestion
-
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.Suggested changeif (row && row.observation?.origin === 'hook' && !row.providerSessionOnly) { return null } if ( row && row.state !== 'done' && row.observation?.origin === 'hook' && !row.providerSessionOnly ) { return null }
| private readPtyAgentStatusRow( | ||
| ptyId: string, | ||
| pty: RuntimePtyWorktreeRecord | ||
| ): AgentStatusIpcPayload | undefined { | ||
| const paneKey = | ||
| this.getLeavesForPty(ptyId).map((leaf) => this.makeRuntimePaneKey(leaf))[0] ?? | ||
| this.paneOfPty(pty).paneKey | ||
| return paneKey ? this.getAgentStatusSnapshotForPaneFn?.(paneKey)[0] : undefined | ||
| } | ||
|
|
||
| /** A sidebar projection of the blocked text agentWait already reads, never first-party agent evidence. */ | ||
| private publishTrustDialogStatus(ptyId: string, payload: ParsedAgentStatusPayload): void { | ||
| this.emitTerminalAgentStatusEvents( | ||
| ptyId, | ||
| { cleanData: '', payloads: [payload], lastPayloadCleanOffset: null }, | ||
| undefined, | ||
| false | ||
| ) | ||
| } | ||
|
|
||
| private observeTrustDialogStatus( | ||
| ptyId: string, | ||
| pty: RuntimePtyWorktreeRecord, | ||
| state: RuntimeHeadlessTerminal, | ||
| chunk: string, | ||
| readStatus: () => AgentStatusIpcPayload | undefined | ||
| ): void { | ||
| const read = observeTrustDialogScreenChange(state.emulator, chunk) | ||
| if (read === null) { | ||
| return | ||
| } | ||
| if (read !== 'appeared') { | ||
| this.scheduleTrustDialogSettleCheck(ptyId, pty, state) | ||
| return | ||
| } | ||
| const agent = this.getPaneAgentForTuiIdle(ptyId) | ||
| if (agent) { | ||
| const waiting = trustDialogWaitingStatus(agent, readStatus()) | ||
| if (waiting) { | ||
| this.publishTrustDialogStatus(ptyId, waiting) | ||
| } | ||
| return | ||
| } | ||
| // An agent typed into a shell paints its dialog before the foreground-process probe names it. | ||
| void this.ptyForegroundAgent.refresh(ptyId).then(() => { | ||
| if (!this.isTrustDialogStillShown(ptyId, pty, state)) { | ||
| return | ||
| } | ||
| const waiting = trustDialogWaitingStatus( | ||
| this.getPaneAgentForTuiIdle(ptyId), | ||
| this.readPtyAgentStatusRow(ptyId, pty) | ||
| ) | ||
| if (waiting) { | ||
| this.publishTrustDialogStatus(ptyId, waiting) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| private isTrustDialogStillShown( | ||
| ptyId: string, | ||
| pty: RuntimePtyWorktreeRecord, | ||
| state: RuntimeHeadlessTerminal | ||
| ): boolean { | ||
| return ( | ||
| this.ptysById.get(ptyId) === pty && | ||
| this.headlessTerminals.get(ptyId) === state && | ||
| isTrustDialogShown(state.emulator) | ||
| ) | ||
| } | ||
|
|
||
| /** Settles only on positive evidence once output goes quiet, so a repaint split across reads never re-notifies. */ | ||
| private scheduleTrustDialogSettleCheck( | ||
| ptyId: string, | ||
| pty: RuntimePtyWorktreeRecord, | ||
| state: RuntimeHeadlessTerminal | ||
| ): void { | ||
| clearTimeout(this.trustDialogSettleTimers.get(ptyId)) | ||
| const timer = setTimeout(() => { | ||
| this.trustDialogSettleTimers.delete(ptyId) | ||
| void this.settleTrustDialog(ptyId, pty, state) | ||
| }, TUI_IDLE_QUIESCENCE_MS) | ||
| timer.unref?.() | ||
| this.trustDialogSettleTimers.set(ptyId, timer) | ||
| } | ||
|
|
||
| private async settleTrustDialog( | ||
| ptyId: string, | ||
| pty: RuntimePtyWorktreeRecord, | ||
| state: RuntimeHeadlessTerminal | ||
| ): Promise<void> { | ||
| if (!this.isTrustDialogStillShown(ptyId, pty, state)) { | ||
| return | ||
| } | ||
| const settled = trustDialogSettledStatus(this.readPtyAgentStatusRow(ptyId, pty)) | ||
| const agent = | ||
| settled?.agentType === 'claude' ? 'claude' : settled?.agentType === 'codex' ? 'codex' : null | ||
| // A hook that reported since owns the pane: stop tracking without touching its row. | ||
| if (!agent) { | ||
| forgetTrustDialog(state.emulator) | ||
| return | ||
| } | ||
| if (!confirmTrustDialogGone(state.emulator)) { | ||
| // A killed agent can leave its frame painted above the shell prompt; only a proven shell foreground settles it. | ||
| const foreground = await this.readLaunchedAgentForeground(ptyId, agent) | ||
| if (foreground !== 'shell' || !this.isTrustDialogStillShown(ptyId, pty, state)) { | ||
| return | ||
| } | ||
| forgetTrustDialog(state.emulator) | ||
| } | ||
| const stillOurs = trustDialogSettledStatus(this.readPtyAgentStatusRow(ptyId, pty)) | ||
| if (stillOurs) { | ||
| this.publishTrustDialogStatus(ptyId, stillOurs) | ||
| } | ||
| } |
There was a problem hiding this comment.
Fix the CI failure: the file exceeds the line limit.
The pipeline reports that node node_modules/oxlint/bin/oxlint fails with a "too many lines" error for this file. The error reports 323 lines against the limit. The new trust-dialog methods add about 115 lines, which pushes the file over the limit. This blocks the static analysis job.
Move the trust-dialog state (trustDialogSettleTimers) and the methods observeTrustDialogStatus, isTrustDialogStillShown, scheduleTrustDialogSettleCheck, settleTrustDialog and publishTrustDialogStatus into a separate module. For example, use a small controller class in startup-dialog-terminal-status-controller.ts that takes the runtime hooks it needs: the ptysById and headlessTerminals lookups, getPaneAgentForTuiIdle, ptyForegroundAgent.refresh, readLaunchedAgentForeground, readPtyAgentStatusRow and the emit function. The hydration class then only calls controller.observe(...) at Line 230.
Do not raise the lint limit. The repository has max-lines ratchets (check:max-lines-ratchet).
Source: Pipeline failures
…adless hydration Keeps headless-terminal-hydration.ts under the max-lines lint limit. Co-Authored-By: Claude <[email protected]>
…mers Co-Authored-By: Claude <[email protected]>
…om/stablyai/orca into nwparker/agint-25854-trust-sidebar
…uzz rejects Its replay trips known serialize I2 diffs; cover Codex dismissal with a composer repaint over the existing 0.158 capture, and compare only appearance/absence. Co-Authored-By: Claude <[email protected]>
…om/stablyai/orca into nwparker/agint-25854-trust-sidebar
…debounced screen reads Keys state by ptyId so an emulator swap no longer strands the row, owns the row by its receipt stamp instead of a toolInput tag, drops tracking as soon as another writer replaces the row, and clears after two debounced reads without the dialog instead of 3 s of total quiet.
There was a problem hiding this comment.
Actionable comments posted: 1

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:
20c7bec6-d52f-496a-bbf3-265f3da805df
Files selected for processing: 5-
src/main/runtime/terminal/lifecycle/floating-session-liveness.tssrc/main/runtime/terminal/lifecycle/pty-exit-lifecycle.tssrc/main/runtime/terminal/output/headless-terminal-hydration.tssrc/main/runtime/trust-dialog-status-observer.test.tssrc/main/runtime/trust-dialog-status-observer.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
| pane.readTimer = setTimeout(() => { | ||
| void this.read(ptyId, pane).then((again) => { | ||
| pane.readTimer = undefined | ||
| if (again && this.panes.get(ptyId) === pane) { | ||
| this.scheduleRead(ptyId, pane) | ||
| } | ||
| }) |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
#!/bin/bash # Check whether readLaunchedAgentForeground can reject or hang. rg -nP -C8 '\breadLaunchedAgentForeground\s*\(' src/main/runtime --glob '!**/*.test.ts'
Repository: stablyai/orca
Length of output: 11117
Script executed:
#!/bin/bash set -e printf '%s\n' '--- observer ---' nl -ba src/main/runtime/trust-dialog-status-observer.ts | sed -n '1,235p' printf '%s\n' '--- foreground implementation ---' nl -ba src/main/runtime/launched-agent-foreground.ts | sed -n '1,220p' printf '%s\n' '--- dependency wiring and status helpers ---' nl -ba src/main/runtime/terminal/output/headless-terminal-hydration.ts | sed -n '25,75p' printf '%s\n' '--- observer tests and foreground-related fixtures ---' rg -n -F -e 'foregroundProbeHangs' -e 'readLaunchedAgentForeground' -e 'TrustDialogStatusObserver' src/main/runtime --glob '*.test.ts' --glob '*.ts' || test "$?" -eq 1
Repository: stablyai/orca
Length of output: 23416
Script executed:
#!/bin/bash set -e printf '%s\n' '--- foreground process group helper ---' nl -ba src/main/runtime/terminal-foreground-group.ts | sed -n '1,260p' printf '%s\n' '--- controller method declarations and implementations ---' rg -n -F -e 'listProcesses' -e 'inspectProcess' -e 'getForegroundProcess' -e 'confirmShellForeground' src/main/runtime --glob '*.ts' --glob '!**/*.test.ts' | head -n 160 printf '%s\n' '--- observer tests ---' nl -ba src/main/runtime/trust-dialog-status-observer.test.ts | sed -n '1,280p' printf '%s\n' '--- hanging fixture ---' nl -ba src/main/runtime/agent-transcript-pane-test-harness.ts | sed -n '1,125p'
Repository: stablyai/orca
Length of output: 37469
Script executed:
#!/bin/bash set -e printf '%s\n' '--- controller contract ---' nl -ba src/main/runtime/runtime-pty-controller-contract.ts | sed -n '1,260p' printf '%s\n' '--- foreground-related provider definitions ---' rg -n -F -e 'confirmShellForeground' -e 'getForegroundProcess' -e 'inspectProcess' src/main --glob '*.ts' --glob '!**/*.test.ts' --glob '!**/*.spec.ts' | head -n 220 printf '%s\n' '--- runtime controller construction ---' rg -n -F -e 'setPtyController' -e 'ptyController:' src/main/runtime/construction src/main/runtime --glob '*.ts' --glob '!**/*.test.ts' --glob '!**/*.spec.ts' | head -n 180
Repository: stablyai/orca
Length of output: 33192
Prevent a pending foreground probe from blocking status checks.
The rejection concern does not apply to the production binding. readLaunchedAgentForeground catches controller errors and returns 'unknown'.
A pending foreground probe remains a valid failure path. When the dialog remains visible, read() awaits the probe. The scheduled callback clears pane.readTimer only after read() fulfills. A pending probe can therefore prevent later debounced reads.
Bound the foreground probe with a timeout and clear pane.readTimer in a finally block. Treat a timeout as 'unknown'.
ELI5
When Claude Code or Codex opens in a folder it doesn't trust yet, it stops and asks "do you trust this folder?". Orca's CLI already noticed this (
agentWait: agent-trust-workspace), but the sidebar didn't: the pane had no agent row (Claude) or showed Codex - Idle. Now the sidebar shows Waiting for input while the dialog is up, and the row clears within about a second of the dialog leaving the screen.Root cause
Agents only run hooks after the folder is trusted, so no hook can report the dialog. Claude reads
hasTrustDialogAcceptedbefore it loads hooks. Codex (codex-rs/hooks) has no hook event for the trust screen. The existing blocked-text detector (findTerminalWaitBlockedSignal) found the dialog, but onlygetTerminalInteractiveWaitread it, so nothing turned it into a status row.What changed
trust-dialog-status-observer.ts: one class with per-ptyIdstate, run from the same per-chunk screen-observer loop as the Freebuff and Codex-capacity screen statuses (!pty.connectionIdgate). It reusesfindTerminalWaitBlockedSignal,readLaunchedAgentForegroundandptyForegroundAgent.trust, carried across reads; Ink paints words apart with cursor moves) opens a 4 KB paint budget. Only then is the screen read and confirmed by the detector, and only when the dialog's key footer is the last line with the trust choice just above it (quoted wording in a reply doesn't match). It then publisheswaitingfor Claude/Codex unless a live hook row exists. An agent typed into a shell refreshes the foreground probe first.receivedAtof the row our publish produced, the same write identity the hook-silence recheck uses (row.receivedAt === yieldedTo). No display field is used as a tag.done+sessionBoundaryonce two consecutive debounced reads no longer show the dialog (a resize clear read before Claude's redraw is one miss, not a clear), or once the shell is proven to be the foreground (readLaunchedAgentForeground; on WindowsconfirmShellForeground). A working agent's spinner no longer holds the row.recordsPromptLifecycleflag onemitTerminalAgentStatusEvents) andlastExplicitAgentStatus, soagentWaitand tui-idle are unchanged. The payload is a plainwaiting/donerow, so older clients render it as-is.isPtyAwaitingUserInputis now true for the pane, so orchestration mailbox delivery waits instead of typing into the dialog. This is intended.waitingrow behaves like a permission prompt (needs-input alert; desktop skips it when that workspace is focused, phones are notified).Verification
Screenshots below are from the earlier revision of this PR; appearance is unchanged, only the clear timing and bookkeeping changed.
Before (main): Codex shows Idle while the CLI reports


agentWait: agent-trust-workspace. The Claude pane had no row at all.After: both panes show Waiting for input, with the tab marked as action required.


After you trust the folder, the Codex row settles (no waiting badge). Pressing Esc on Claude's dialog exits Claude, and its row is removed.

trust-dialog-status-observer.test.ts, fake timers, through the real runtime):claude-dialog-trust-workspace{,-narrow}andcodex-0-158-0-trustpromptin 1-byte chunks show onewaiting;claude-dialog-trust-workspace-answeredgoeswaitingthendone.waiting, no flip; then an erase clears it.done.pnpm tc✅,check:code-quality:changed✅,codex-notice-terminal-status.test.tspasses.Trade-offs / risk
receivedAt: if something republished an identicalwaitingrow for the pane, we'd treat the row as no longer ours and leave it.agentWaitstill reports it).Refs #25854. Plain-text end-of-turn questions (the other open item on #25854) are not addressed: Codex's
Stop/notifypayloads carry onlylast_assistant_message, andrequest_user_inputis Plan-mode only.