Repository navigation
Conversation
…en dialog Claude keeps its rest title (`✳ ...`) while an AskUserQuestion, permission, or plan-approval dialog is open, so the mailbox delivery gate read the pane as idle and typed the pointer plus a delayed Enter into the dialog. The Enter picked the dialog's first option. Delivery now reads the pane's hook row: while the agent's hooks report a wait (`waiting`/`blocked`), the pre-write gate refuses and re-arms its recheck, and the delayed Enter is deferred until the next idle edge, where it rechecks.
An unanswered question posts no further hooks, so the 30-minute freshness bound on the hook turn reader would have let mail answer a question left open longer than that. The hold now reads the pane's newest live hook row with no age bound, retired only by a newer row or a respawn.
📝 WalkthroughWalkthroughThe runtime selects explicit hook-status rows and checks whether the newest row indicates that a PTY is waiting for user input. Mailbox-pointer submission now defers when that check is true, and delivery settlement also rejects a leaf whose PTY is waiting. Tests cover open Claude questions, deferred submission, and submission after the question closes. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to Mail delivery could remain queued after a respawn if an old prompt status is replayed. The timestamp check should be corrected before merge if that replay path is supported. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
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:
68e0ff54-7d5b-46ad-8a77-76668604010d
📒 Files selected for processing (11)
src/main/runtime/orca-runtime-resolve-authoritative-terminal-wait-permission.tssrc/main/runtime/orca-runtime-resolve-exit-waiters.tssrc/main/runtime/orca-runtime-stop-requested-pty-ids.tssrc/main/runtime/orchestration-mailbox-notification-test-harness.tssrc/main/runtime/orchestration-open-dialog-delivery-hold.test.tssrc/main/runtime/orchestration/mailbox-pointer-delivery-contract.tssrc/main/runtime/orchestration/mailbox-pointer-stage.test.tssrc/main/runtime/orchestration/mailbox-pointer-stage.tssrc/main/runtime/orchestration/mailbox-pointer-submit.test.tssrc/main/runtime/orchestration/mailbox-pointer-submit.tssrc/main/runtime/runtime-hook-agent-row-selection.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.
| const row = join ? selectNewestExplicitAgentStatusRow(join) : null | ||
| return ( | ||
| row !== null && | ||
| row.receivedAt >= (this.agentPromptExplicitStatusFloorByPtyId.get(ptyId) ?? -1) && |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect the respawn-floor assignment and relay replay's row provenance.
rg -n -C 4 'agentPromptExplicitStatusFloorByPtyId|evidenceObservedAt|restoredUnconfirmed' src/main/runtime src/main/agent-hooks src/sharedRepository: stablyai/orca
Length of output: 42563
🏁 Script executed:
set -e
printf '%s\n' '--- target resolver ---'
nl -ba src/main/runtime/orca-runtime-resolve-authoritative-terminal-wait-permission.ts | sed -n '95,155p'
printf '%s\n' '--- floor assignment ---'
rg -n -C 12 -F -- 'agentPromptExplicitStatusFloorByPtyId' src/main/runtime
printf '%s\n' '--- status application ---'
nl -ba src/main/agent-hooks/server-status-application.ts | sed -n '135,205p'
printf '%s\n' '--- row source projection ---'
nl -ba src/main/runtime/runtime-worktree-pty-agent-sources.ts | sed -n '1,75p'
printf '%s\n' '--- newest-row and join references ---'
rg -n -C 8 'selectNewestExplicitAgentStatusRow|isPtyAwaitingUserInput|hookRows' src/main/runtime/orca-runtime-resolve-authoritative-terminal-wait-permission.ts src/main/runtimeRepository: stablyai/orca
Length of output: 42767
🏁 Script executed:
echo waiting for the previously requested focused source inspectionRepository: stablyai/orca
Length of output: 214
🏁 Script executed:
set -e
printf '%s\n' '--- newest explicit row selector ---'
nl -ba src/main/runtime/runtime-hook-agent-row-selection.ts | sed -n '1,82p'
printf '%s\n' '--- focused tui-idle scenarios ---'
rg -n -C 8 'prior-process|respawn|launchToken|waiting|blocked' src/main/runtime/tui-idle-hook-lane.test.ts
printf '%s\n' '--- replay stamping implementation candidates ---'
rg -n -C 8 'evidenceObservedAt|receivedAt.*now|isReplay|replay' src/main/agent-hooks src/shared | head -240Repository: stablyai/orca
Length of output: 34755
🏁 Script executed:
set -e
rg -n -F -- 'resolveEvidenceObservedAt' src
rg -n -F -- 'ingestRemote' src/main/agent-hooks src/shared
rg -n -F -- 'isReplay' src/main/agent-hooks src/shared | head -120Repository: stablyai/orca
Length of output: 39053
Reject pre-respawn prompt evidence at the PTY floor.
selectNewestExplicitAgentStatusRow accepts old live rows and orders them by receivedAt. Replay can restamp receivedAt while preserving an earlier evidenceObservedAt. The current check can therefore accept a pre-respawn waiting or blocked row and keep mail parked.
Compare row.evidenceObservedAt ?? row.receivedAt with the floor, or match the row to the current launch identity.
Suggested timestamp fix
--- "a/src/main/runtime/orca-runtime-resolve-authoritative-terminal-wait-permission.ts"
+++ "b/src/main/runtime/orca-runtime-resolve-authoritative-terminal-wait-permission.ts"
@@ -127,7 +127,8 @@
const row = join ? selectNewestExplicitAgentStatusRow(join) : null
return (
row !== null &&
- row.receivedAt >= (this.agentPromptExplicitStatusFloorByPtyId.get(ptyId) ?? -1) &&
+ (row.evidenceObservedAt ?? row.receivedAt) >=
+ (this.agentPromptExplicitStatusFloorByPtyId.get(ptyId) ?? -1) &&
(row.state === 'waiting' || row.state === 'blocked')
)
}📝 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.
| row.receivedAt >= (this.agentPromptExplicitStatusFloorByPtyId.get(ptyId) ?? -1) && | |
| (row.evidenceObservedAt ?? row.receivedAt) >= | |
| (this.agentPromptExplicitStatusFloorByPtyId.get(ptyId) ?? -1) && |
|
Thanks @yasyf! Your approach landed via #33366 (your commits kept, plus Co-authored-by on the squash), with a bounded hold: it holds only while Claude's dialog is on screen (or a fresh waiting row when the screen can't be read), capped at 10 min, so an Esc-dismissed question can't hold mail forever. Closing as superseded. |
…en dialog (#21745) (#33366) Orchestration mailbox pointers (typing and the delayed Enter) are held while a Claude pane shows an open dialog (AskUserQuestion / permission / plan approval chrome on screen, or a fresh waiting row when the screen can't be read), capped at 10 minutes, so mail no longer answers the dialog. Recheck backs off to 2s while held. Fixes #21745. Supersedes #26928, #21880. Co-authored-by: yasyf <[email protected]>
ELI5
When Claude Code stops to ask the user a question, its terminal title still says it is at rest. If orchestration mail arrived at that moment, Orca typed "You have N orchestration messages..." into the pane and pressed Enter half a second later. That Enter answered the question with whichever option was highlighted. With this change, Orca waits until the question is gone before it types anything or presses Enter.
What Changed
✳rest title while anAskUserQuestion, permission, or plan-approval dialog is open, and Orca has no screen rule for that dialog, so the pane counted as idle. Delivery typed the mail pointer, and the delayed Enter only checked that the title still read idle or working. In our own Claude coordinator session, two heartbeat deliveries landed within a second of two question answers, and both answers were the first option.PreToolUseforAskUserQuestion,PermissionRequestfor permissions and plan approval), and both arrive aswaiting. While the row readswaitingorblocked, the gate refuses and re-arms its existing recheck. The delayed Enter rechecks the same row. If a dialog opened after the pointer was typed, the Enter is deferred to the next idle edge, where it is rechecked before it is sent.isPtyAwaitingUserInput(ptyId)reads the pane's newest live hook row, joined on its pane keys and terminal handles. Rows from before a respawn are ignored, and there is no age bound: an unanswered question posts no further hooks, so a 30-minute freshness cutoff would let mail answer a question left open that long.isAgentSettledForDeliveryrefuses while that check holds.submitOrchestrationMailboxPointertakes the check as a new dependency and sends the deferred Enter down the samedeferFlightUntilIdlepath that a neutral title already uses.selectFreshExplicitAgentStatusRowand the newselectNewestExplicitAgentStatusRowshare one selector. The fresh one keeps its 30-minute bound, so the tui-idle hook lane is unchanged.Why
Mail typed into an open dialog is worse than late mail. It picks an answer nobody gave and the pointer itself is lost. The hook row is the only signal Orca has for these dialogs. A screen anchor would need a captured transcript for each dialog shape, and the title cannot help because Claude keeps it at rest.
#21880 fixes the same issue with the same signal. The main difference is what happens when a dialog opens between the pointer write and the Enter. #21880 settles the pointer as delivered and sends no Enter, which leaves the text in the composer and marks the mail read. This PR keeps the flight and defers the Enter to the next idle edge, so the pointer is submitted once the dialog closes.
Two smaller differences: #21880 polls a parked pane every 1 s, while this PR keeps the existing quiescence recheck (about 3 s). #21880 also holds on a cached
AskUserQuestiontool name orinteractivePromptfield, while this PR reads onlywaiting/blocked. Either PR closes the issue, and maintainers should pick whichever fits better.Linked Issue
Fixes #21745
Visual Proof
N/A. Nothing visible changes. The fix only stops keystrokes from reaching an open dialog, and a runtime test covers that path, listed below.
Testing
Two new tests, both run locally on macOS (
vitest run), both green:src/main/runtime/orchestration-open-dialog-delivery-hold.test.ts: a Claude pane with a✳title and awaitinghook row gets mail. Nothing is written for 10 s. After the row turnsdone, the pointer and one Enter are written. A second case uses a row older than 30 minutes and holds the same way. With the gate removed, both cases fail.src/main/runtime/orchestration/mailbox-pointer-submit.test.ts, "holds the Enter while a dialog is open and submits once the agent is idle again": the Enter is deferred while the dialog is open, deferred again on an idle edge that comes while it is still open, and sent exactly once after it closes.Also run:
mailbox-pointer-stage.test.tsandtui-idle-hook-lane.test.ts(unchanged behavior), plusoxlintandoxfmton the changed files. The full suite, typecheck, and build are left to CI.Accepted risk: if a
waitingrow is never followed by another hook, mail stays held until the next hook or a respawn, as when the dialog is dismissed in a way that posts nothing. Claude's answer keystroke already clears a question's row, and the next turn's hooks clear the rest. Holding mail is the safe side of that trade.AI Disclosure
Written with Claude (Opus 5.5) in Claude Code, reviewed by the author.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The check reads the hook rows the runtime already has, so SSH and WSL panes work the same way as local ones. No wire or protocol change.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)