Repository navigation
Show Claude's AskUserQuestion card in desktop Chat when the agent runs on a paired headless server - #12223
Conversation
…uns on a paired headless host Three gaps kept the question card off the desktop when the agent ran on a remote `orca serve` host: - The `session.tabs` projection reduced HTTP agent-hook rows to identity only, hard-coding `state: 'done'` and an empty prompt, so `toolName` and the full `interactivePrompt` never left the host. It now publishes the newest fresh hook row's status fields, bounded by the same staleness window `agentType` uses, excluding `providerSessionOnly` resume rows, and yielding to live title evidence unless a question is actually pending. - Nothing republished `session.tabs` when only a hook row changed, and the re-emit carried an unchanged `snapshotVersion` that clients drop on their monotonic gate. Material hook transitions and pane/SSH status clears now bump the version and schedule a coalesced emit. - The desktop card resolved only from live status. It now falls back to the pending ask in the transcript, matching mobile, so a relay gap can no longer leave the composer mounted over a pane parked on a selector. Closes #11761 Co-authored-by: Orca <[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:
📝 WalkthroughWalkthroughThe change adds normalized hook-status projection and live agent-status resolution. It updates mobile session tabs when meaningful pane or provider-session state changes occur and clears tracking during pane or connection cleanup. It adds multi-subscriber pane-clear notifications. Native chat cards can recover unresolved questions from command-boundary-trimmed transcripts while live prompts remain authoritative. Tests cover runtime projection, invalidation, cleanup, precedence, and prompt lifecycle behavior. 🚥 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: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e489e07a-00b3-4b91-b81b-22c25a7d1e5f
📒 Files selected for processing (10)
src/main/agent-hooks/hook-status-session-tabs-invalidation.test.tssrc/main/agent-hooks/hook-status-session-tabs-invalidation.tssrc/main/agent-hooks/server.tssrc/main/index.tssrc/main/runtime/orca-runtime-hook-agent-status-projection.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/native-chat/NativeChatInteractiveCard.test.tsxsrc/renderer/src/components/native-chat/NativeChatInteractiveCard.tsxsrc/renderer/src/components/native-chat/NativeChatView.tsxsrc/shared/agent-status-types.ts
`resolveHookLiveAgentRow` compared a hook `receivedAt` (epoch ms) against title stamps that are title-observation sequence numbers, so the guard could never fire — any fresh hook row overrode live title-derived state, and a manual rename (the one epoch writer) inverted it. Stamp the live OSC title path with wall-clock ms and compare against that alone. The regression test fabricated epoch-valued title stamps production never writes; it now drives the title through `onPtyData`, and a new case pins the opposite direction (hook row newer than the title wins). Co-authored-by: Orca <[email protected]>
…tion card extractPendingAsk pairs tool results to calls by a global FIFO (tool_use_id is dropped at decode time), so one call that never gets a result desyncs the queue for the rest of the transcript and strands an answered ask as pending. Real transcripts also hold asks the user escaped and typed past. On desktop that card replaces the composer, so the pane became unsendable. Drop in-flight calls at a turn boundary — a user turn or the decoders' interrupt row — since the turn that owned them is over. Claude's tool-result turns decode as role 'tool', so normal FIFO resolution is untouched. Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/orca-runtime.ts (1)
29497-29541: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winHook-derived agent status still drops
worktreeIdfor panes with no local PTY.
resolveHookLiveAgentRowdeclares an optionalworktreeIdfield in its return type, but the returned object at Line 29535-29539 never sets it.getHookAgentRowForPaneis the only source ofhookRow.live, and it never extractsworktreeIdfrom the winning entry — it returns onlyproviderSession,agentType,live, and timestamps.The caller in
buildPtyMobileAgentStatusresolves worktree identity aspty?.worktreeId ?? liveRow.worktreeId(Line 29451-29453). Whenptyisnull— the case for a pane whose hook status arrives only through relayed rows with no local PTY record, such as a paired headless host reached over SSH —liveRow.worktreeIdis alwaysundefined, so the publishedagentStatus.worktreeIdstays absent.Thread
entry.worktreeIdfrom the winningliverow throughgetHookAgentRowForPaneand intoresolveHookLiveAgentRow's return so hook status keeps its worktree attribution even when no local PTY backs the pane.🛠️ Proposed fix to thread worktreeId through the hook-status helpers
private getHookAgentRowForPane(rows: readonly AgentStatusIpcPayload[]): { providerSession: AgentProviderSessionMetadata | null providerSessionAgentType: string | null providerSessionReceivedAt: number | null agentType: string | null live: ParsedAgentStatusPayload | null liveReceivedAt: number | null liveStateStartedAt: number | null + liveWorktreeId: string | undefined } { ... return { providerSession: session?.providerSession ?? null, providerSessionAgentType: session?.agentType ?? null, providerSessionReceivedAt: session?.receivedAt ?? null, agentType: agent?.agentType ?? null, live: live ? pickParsedAgentStatusPayload(live) : null, liveReceivedAt: live?.receivedAt ?? null, - liveStateStartedAt: live?.stateStartedAt ?? null + liveStateStartedAt: live?.stateStartedAt ?? null, + liveWorktreeId: live?.worktreeId } } private resolveHookLiveAgentRow( hookRow: { live: ParsedAgentStatusPayload | null liveReceivedAt: number | null liveStateStartedAt: number | null + liveWorktreeId?: string }, pty: RuntimePtyWorktreeRecord | null, nonAgentTitle: boolean ): { payload: ParsedAgentStatusPayload updatedAt: number stateStartedAt: number worktreeId?: string } | null { ... return { payload: live, updatedAt: receivedAt, - stateStartedAt: hookRow.liveStateStartedAt ?? receivedAt + stateStartedAt: hookRow.liveStateStartedAt ?? receivedAt, + worktreeId: hookRow.liveWorktreeId } }Based on learnings, this is the same concern a prior review raised on this hook-status resolution code path ("resolveHookLiveAgentRow exposes an optional
worktreeId, but the returned object never sets it"). As per path instructions, "All changes must support SSH use cases and must not assume local-only execution."Also applies to: 29558-29605
Source: Path instructions
🧹 Nitpick comments (1)
src/shared/native-chat-ask.ts (1)
101-106: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten this comment.
Lines 101-106 explain the mechanism in six lines. Keep only the non-obvious turn-boundary rule.
As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Proposed change
- // A new user turn (or an interrupt row) ends the turn that owns whatever - // calls are still in flight: their results never arrive, and `tool_use_id` - // is dropped at decode time so those orphans can never be matched by id. - // Without this reset one orphan shifts the result FIFO for the rest of the - // transcript and strands an answered ask as a permanent card over the - // composer (`#11761`). Claude's tool-result turns decode as role 'tool'. + // Discard pending calls from an interrupted or superseded turn (`#11761`).Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b8904984-73bd-4cd7-a1a7-0e1f7aa67394
📒 Files selected for processing (6)
src/main/runtime/orca-runtime-hook-agent-status-projection.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/native-chat/NativeChatInteractiveCard.test.tsxsrc/shared/native-chat-ask.test.tssrc/shared/native-chat-ask.tssrc/shared/native-chat-types.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/runtime/orca-runtime-hook-agent-status-projection.test.ts
- src/renderer/src/components/native-chat/NativeChatInteractiveCard.test.tsx
Reuse rather than restate: the invalidator now takes the shared `AgentHookEventPayload` instead of a locally redeclared row shape, and the hook live row is a `Pick<>` of the retained OSC snapshot so one projection branch consumes either carrier. Fold the immediate/coalesced session-tabs emit into one method (also drops a redundant re-emit on the provider-session push). Drop card tests that re-route shared-parser assertions through React. Isolate pane-status-clear subscribers and prove the no-republish case by version arithmetic instead of a timed silence. Co-authored-by: Orca <[email protected]>
|
Follow-up pass on "this is a lot of code" — pushed Reuse instead of restatement
Test bulk
Kept, because it looked removable and is not
Review comments
Verification: |
…ctron Why: the 13 parser unit tests pin extraction, but nothing proved a card actually renders where an inert tool call used to. This spec reproduces the paired-headless topology from the client side — live status carrying agent identity and state 'working' but no interactivePrompt/toolName, with the pending ask present only in the transcript — and fails on main. Refs #11761 Co-authored-by: Orca <[email protected]>
Why: oxlint no-unused-vars fails the lint gate on an unused test parameter. Co-authored-by: Orca <[email protected]>
…spec The env-var screenshot label and the fixed 2s settle only existed to make the pre-fix capture comparable; the card assertion already waits. Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (3)
tests/e2e/native-chat-ask-user-question-card.spec.ts (3)
138-147: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winScope the text locators to the chat root.
getByTextperforms a substring match and returns every matching element.expect(...).toBeVisible()raises a strict-mode violation when the locator resolves to more than one element. BothuserTextandQUESTIONare plain sentences that a chat surface can render in more than one place, for example in a message body and in an enclosing container. A second match would fail the test with a strict-mode error instead of a product signal. Scope both locators to the native chat root and reduce them to a single node.♻️ Proposed locator scoping
- await expect(orcaPage.locator('[data-native-chat-root="true"]')).toBeVisible({ - timeout: 15_000 - }) - await expect(orcaPage.getByText(userText)).toBeVisible({ timeout: 30_000 }) + const chatRoot = orcaPage.locator('[data-native-chat-root="true"]') + await expect(chatRoot).toBeVisible({ timeout: 15_000 }) + await expect(chatRoot.getByText(userText).first()).toBeVisible({ timeout: 30_000 })- await expect(orcaPage.getByText(QUESTION)).toBeVisible({ timeout: 10_000 }) + await expect(chatRoot.getByText(QUESTION).first()).toBeVisible({ timeout: 10_000 })Line 159 keeps
orcaPage.getByText(QUESTION)for the count assertion, or switches tochatRoot.getByText(QUESTION)for symmetry. Count assertions are exempt from strict mode.
139-141: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueReplace the fixed 2-second wait with a state assertion.
waitForTimeoutadds 2 seconds to every run and does not guarantee that hydration finished on a slow machine. Wait for a concrete rendered signal instead, for example the assistant text block or the tool line, then capture the screenshot.
83-96: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd the missing Claude transcript fields to this fixture.
The parsed
tool-useobject keeps Claude fields liketool_use_id, but this fixture representstype: 'tool_use'astype: 'tool-call'and omitsid/tool_use_id. Add anidfield to thetool_useobject if the fixture should remain Claude-format, or rename it totool-callfor a native-chat block if this is intentionally normalized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f355fde9-dd9f-42cc-8fba-4b57f6d8961a
📒 Files selected for processing (1)
tests/e2e/native-chat-ask-user-question-card.spec.ts
…h guard #11203 taught pane lookup to recover a reminted tab id by leaf id, so the old fixture (new tab id, live leaf id) resolved and bumped the snapshot a second time once this branch merged with main. Co-authored-by: Orca <[email protected]>
#12346 landed on main after this branch was cut: a nonterminal row restored from last-status.json is stamped `restoredUnconfirmed` because its transition may have fired while no receiver was up, and every freshness gate treats it as never-fresh. The new headless `live` projection here only checked `receivedAt`, so a restart inside the 30-minute window would republish the hydrated row — resurrecting the AskUserQuestion card with no agent left to answer it. `agentType` still reads those rows: they prove identity, just not liveness. Co-authored-by: Orca <[email protected]>
…s on a paired headless server (stablyai#12223) * fix(native-chat): show Claude's AskUserQuestion card when the agent runs on a paired headless host Three gaps kept the question card off the desktop when the agent ran on a remote `orca serve` host: - The `session.tabs` projection reduced HTTP agent-hook rows to identity only, hard-coding `state: 'done'` and an empty prompt, so `toolName` and the full `interactivePrompt` never left the host. It now publishes the newest fresh hook row's status fields, bounded by the same staleness window `agentType` uses, excluding `providerSessionOnly` resume rows, and yielding to live title evidence unless a question is actually pending. - Nothing republished `session.tabs` when only a hook row changed, and the re-emit carried an unchanged `snapshotVersion` that clients drop on their monotonic gate. Material hook transitions and pane/SSH status clears now bump the version and schedule a coalesced emit. - The desktop card resolved only from live status. It now falls back to the pending ask in the transcript, matching mobile, so a relay gap can no longer leave the composer mounted over a pane parked on a selector. Closes stablyai#11761 Co-authored-by: Orca <[email protected]> * fix(native-chat): date the hook-row recency guard against a real clock `resolveHookLiveAgentRow` compared a hook `receivedAt` (epoch ms) against title stamps that are title-observation sequence numbers, so the guard could never fire — any fresh hook row overrode live title-derived state, and a manual rename (the one epoch writer) inverted it. Stamp the live OSC title path with wall-clock ms and compare against that alone. The regression test fabricated epoch-valued title stamps production never writes; it now drives the title through `onPtyData`, and a new case pins the opposite direction (hook row newer than the title wins). Co-authored-by: Orca <[email protected]> * fix(native-chat): stop an orphaned tool call from pinning a dead question card extractPendingAsk pairs tool results to calls by a global FIFO (tool_use_id is dropped at decode time), so one call that never gets a result desyncs the queue for the rest of the transcript and strands an answered ask as pending. Real transcripts also hold asks the user escaped and typed past. On desktop that card replaces the composer, so the pane became unsendable. Drop in-flight calls at a turn boundary — a user turn or the decoders' interrupt row — since the turn that owned them is over. Claude's tool-result turns decode as role 'tool', so normal FIFO resolution is untouched. Co-authored-by: Orca <[email protected]> * refactor(native-chat): trim the headless AskUserQuestion projection Reuse rather than restate: the invalidator now takes the shared `AgentHookEventPayload` instead of a locally redeclared row shape, and the hook live row is a `Pick<>` of the retained OSC snapshot so one projection branch consumes either carrier. Fold the immediate/coalesced session-tabs emit into one method (also drops a redundant re-emit on the provider-session push). Drop card tests that re-route shared-parser assertions through React. Isolate pane-status-clear subscribers and prove the no-republish case by version arithmetic instead of a timed silence. Co-authored-by: Orca <[email protected]> * test(native-chat): pin the AskUserQuestion card render under real Electron Why: the 13 parser unit tests pin extraction, but nothing proved a card actually renders where an inert tool call used to. This spec reproduces the paired-headless topology from the client side — live status carrying agent identity and state 'working' but no interactivePrompt/toolName, with the pending ask present only in the transcript — and fails on main. Refs stablyai#11761 Co-authored-by: Orca <[email protected]> * test(native-chat): drop the unused testInfo parameter Why: oxlint no-unused-vars fails the lint gate on an unused test parameter. Co-authored-by: Orca <[email protected]> * test(native-chat): drop leftover proof scaffolding from the ask-card spec The env-var screenshot label and the fixed 2s settle only existed to make the pre-fix capture comparable; the card assertion already waits. Co-authored-by: Orca <[email protected]> * test(runtime): use a truly unresolvable pane key in the hook republish guard stablyai#11203 taught pane lookup to recover a reminted tab id by leaf id, so the old fixture (new tab id, live leaf id) resolved and bumped the snapshot a second time once this branch merged with main. Co-authored-by: Orca <[email protected]> * fix(runtime): refuse a hydrated unconfirmed hook row as live pane status stablyai#12346 landed on main after this branch was cut: a nonterminal row restored from last-status.json is stamped `restoredUnconfirmed` because its transition may have fired while no receiver was up, and every freshness gate treats it as never-fresh. The new headless `live` projection here only checked `receivedAt`, so a restart inside the 30-minute window would republish the hydrated row — resurrecting the AskUserQuestion card with no agent left to answer it. `agentType` still reads those rows: they prove identity, just not liveness. Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Orca <[email protected]> Co-authored-by: Neil <[email protected]>
Summary
When Claude ran on a paired headless host (
orca serve, incl. over SSH),AskUserQuestionrendered in the desktop Chat UI as a plain collapsed tool call. No question card appeared, the composer stayed mounted over a pane whose TUI was parked on a selector, and the next typed message committed the highlighted option instead of being sent. Three independent defects had to line up for the card to appear, and all three were broken. A fourth — in the shared transcript parser the new fallback leans on — is fixed here too:The host projection threw the payload away.
buildPtyMobileAgentStatuspublished a full status entry only for retained OSC-9999 rows; a pane whose status arrives over the HTTP agent-hook server fell through to an identity-only branch that hard-codesprompt: ''and derivesstatefrom the pane title alone (doneunlesspty.lastAgentStatusisworking/permission), soagentType+providerSessionwere the only real information it shipped (src/main/runtime/orca-runtime.ts:29378).getHookAgentRowForPane(src/main/runtime/orca-runtime.ts:29538) reduced the row to identity fields, discardingstate,toolName,toolInput,interactivePromptandlastAssistantMessage.It now also returns
live— the newest fresh row's status fields, narrowed by the newpickParsedAgentStatusPayload(src/shared/agent-status-types.ts:186) so hook transport identity (launchToken,connectionId,promptInteractionKey,providerSessionOnly,receivedAt) never reaches a client. Selection already bounds that row byAGENT_STATUS_STALE_AFTER_MSand never takes aproviderSessionOnlyresume row (not even Pi's);resolveHookLiveAgentRow(src/main/runtime/orca-runtime.ts:29504) then decides whether it may be published — never past the#1437non-agent-title suppression unless a question is genuinely pending, and never over live title evidence that is newer than the hook row. Retained OSC rows keep precedence (#7970unchanged), and the identity-only branch stays as the last resort — that is what retires the card when the agent exits.Nothing republished
session.tabson a hook status change, andnotifyMobileSessionTabsChangedre-emits at an unchangedsnapshotVersion, which clients drop on their monotonic gate (src/renderer/src/runtime/web-session-tabs-sync.ts:247).touchMobileSessionTabsForWorktree/touchMobileSessionTabsForPane(src/main/runtime/orca-runtime.ts:6447) bump the version and schedule a coalesced emit;createHookStatusSessionTabsInvalidator(src/main/agent-hooks/hook-status-session-tabs-invalidation.ts:9) keeps a repeated same-state ping free. Teardown is wired to the new additivesubscribePaneStatusClearseam (src/main/agent-hooks/server.ts:654) rather than the window-owned single slot, so it also exists under headless serve and covers the SSH transient-disconnect batch. The provider-session push atsrc/main/index.ts:2107gets the same version bump — it was silently dropped by the client gate for the same reason.The desktop card had no transcript fallback.
NativeChatInteractiveCardresolved only from live status; mobile has always resolvedaskFromStatus ?? extractPendingAsk(messages). It now does the same (src/renderer/src/components/native-chat/NativeChatInteractiveCard.tsx:65), fed the command-boundary-trimmed messages so an ask abandoned via/clearstays gone (src/renderer/src/components/native-chat/NativeChatView.tsx:432).extractPendingAskcould report an ask as pending forever. It matches tool results to tool calls by a global FIFO (tool_use_idis dropped at decode time insrc/main/native-chat/transcript-record-blocks.ts:84, so id pairing is impossible downstream), and a tool call that never gets a result shifts that FIFO for the rest of the transcript. Real transcripts contain such orphans: a tool the user ESC'd, and anAskUserQuestionthe user escaped out of and typed past (measured: 3 of the 400 most recent local Claude transcripts, one of them an orphaned ask). On desktop the resulting card replaces the composer, so a stale ask was unsendable chat, not just a stray card.extractPendingAsk(src/shared/native-chat-ask.ts:97) now drops in-flight calls at a turn boundary — auserturn or the decoders' interrupt row (isInterruptedStatusMessage,src/shared/native-chat-types.ts:137) — because the turn that owned them is over and their results are never coming. Claude's tool-result turns decode as roletool, notuser, so normal FIFO resolution is untouched. Mobile shares this parser and gets the same fix.Closes #11761
ELI5
Claude sometimes stops and asks you to pick between a few options. Orca normally shows that as a little card with buttons. But when Claude was running on a remote machine you were connected to, the remote machine only told your laptop "an agent lives here" — it forgot to pass along the actual question. So your laptop showed a boring grey box, kept the normal message field open, and anything you typed got swallowed as an accidental answer to the question you never saw. This change makes the remote machine send the whole question, makes it tell your laptop promptly when something changed, and — as a backstop — lets your laptop dig the unanswered question out of the conversation it already downloaded. The card now shows up, and it goes away again when the agent stops or the connection drops.
Fix proof
Both repro tests before the fix:
After the fix, promoted into permanent regression suites (
orca-runtime-hook-agent-status-projection.test.ts, and folded into the existingNativeChatInteractiveCard.test.tsx):No regressions
src/main/runtime/orca-runtime.test.ts+ all ofsrc/main/agent-hooks/+ all ofsrc/renderer/src/components/native-chat/:Client-mirror and shared-parser suites (
src/renderer/src/runtime/incl.web-session-tabs-sync.test.tsandsync-runtime-graph-agent-status-projection.test.ts, plussrc/shared/agent-status-types.test.ts,native-chat-ask.test.ts,agent-hook-listener.test.ts):SSH relay hook integration (
src/main/ssh/ssh-relay-session-agent-hooks.integration.test.ts):Session-tabs neighbours (
mobile-session-tabs-notify-coalescer.test.ts,rpc/methods/session-tabs{,-schemas,-move-validation}.test.ts,remote-runtime-session-tabs-inflight.test.ts,web-session-tabs-sync.test.ts,hook-status-session-tabs-invalidation.test.ts):node config/scripts/check-max-lines-ratchet.mjs→max-lines ratchet OK — 352 grandfathered suppression(s), no new bypasses.Trade-offs
AGENT_STATUS_STALE_AFTER_MS(30 min) of hook silence, because the row'sreceivedAtfreezes while the agent blocks. This is deliberate — it is what stops a zombie card after the agent exits — and the transcript fallback keeps the card up past it.state === 'working', because that mirrored channel is exactly what fails in the reported topology. The cost: a transcript that leaves a question tool unresolved can show a card where the composer would otherwise be./clearboundaries are honoured, the card clears when the ask's tool result lands or when the turn ends (a new user turn or an interrupt row — see summary item 4; an earlier version of this description claimed the FIFO alone was enough to clear it, which was false while one orphaned tool call could desync the FIFO permanently), and Cancel restores the composer in one click (writing ESC to the pane, same as today's live-card cancel). What remains: a genuinely unresolved ask at the end of a transcript still shows a card, which is the intended behaviour. A phantom card is recoverable; a missing card re-opens the fabricated-consent hole.NativeChatView.tsxsat exactly on its 400-line budget, solaunchPromptVisiblewas inlined into the one memo that used it. Behaviour is unchanged; this avoids amax-linesdisable.node_modulesis not installed here). No files undermobile/were touched, andmobile/src/session/mobile-native-chat-ask.tsis a bareexport *of the shared parser, so mobile picks up item 4 verbatim.orca servehost — was not exercised end to end; the Linux/Windows and SSH-relay arguments below are code-path reasoning plus the SSH relay integration suite, not a manual repro on that hardware.Screenshots
Captured end-to-end in the real Electron app on macOS via a new Playwright spec (
tests/e2e/native-chat-ask-user-question-card.spec.ts, committed to this branch — Playwright discovers it under theelectron-headlessproject viatestMatch: '**/*.spec.ts', verified with--list, so it runs rather than being silently skipped). The spec reproduces the reported topology from the client's side: live status arrives carrying agent identity andstate: 'working'but nointeractivePrompt/toolName— exactly what the host projection dropped — while the pendingAskUserQuestionexists only in the transcript. Identical spec, identical payload, run againstorigin/mainand against this branch.Before —
origin/main(e8d4818). The ask is present but inert: a collapsed1× AskUserQuestion {"questions":["[…]"]}tool call in the stream, and the ordinarySend a message…composer mounted underneath. This is the reported bug — the session reads as working while the agent is blocked on you. The spec fails here, timing out waiting for the question text:After — this branch (df5d588). Same transcript, same status. The card renders from the transcript fallback and replaces the composer; the collapsed tool call is still visible above it, so the two shots differ only in what this PR adds.
Answerable, not just visible. Selecting
Spaceschecks the option and flips the button fromSkiptoSend answer:Sending it dismisses the card and restores the composer — the visible signal that the answer was accepted:
Scope of this capture, stated plainly. This exercises the desktop half — summary items 3 and 4, the transcript fallback and the parser — end-to-end in the real app. It does not exercise the host projection (items 1 and 2) over a real paired headless
orca serve; that rig was not available, so those remain covered by the unit suites above. The capture deliberately simulates their failure (status arriving without the ask payload) rather than reproducing their cause.Cross-platform
No platform-conditional code, no keyboard accelerators, no filesystem paths, no
path.joinsites, and no Git invocation — so the Git 2.25 baseline andGitCapabilityCacherules do not apply.orca serveand WSL; the renderer change is pure React. The reported topology (Windows desktop client paired to a Linux host) is symmetric with the reverse.paneKeycomparisons stay exact-string viamakePaneKey/parsePaneKey, so no case-folding assumption is introduced.lastStatusByPaneKeycache and get the same projection, enriched-status emit and republish.connectionIdis deliberately dropped bypickParsedAgentStatusPayload, so per-host transport identity is not leaked into client-visible status, and the invalidator'sforgetConnectionmakes the SSH transient-disconnect batch republish every pane on that host instead of stranding awaitingdot and a live card.worktreeId/paneKeyonly.getTerminalWorktreeIdForPaneKeyresolves leaf then PTY records identically for folder workspaces, andmobileSessionTabsByWorktreekeys are the same opaque workspace ids. No git-worktree assumption is added.Performance
session.tabsbuild.interactivePromptis copied by string reference, not deep-cloned.session.tabsemissions on material hook transitions only. Double-bounded by the change detector (same field set the retained-OSC path uses, so a repeated same-state ping costs zero emissions) and by the existingmobileSessionTabsNotifyCoalescer, so cadence stays at or below what the OSC/title path already produces.extractPendingAskwalks the transcript blocks. It is memoized onsessionAfterCommandBoundaries.messagesidentity and skipped entirely whenever a status-derived card exists. That input changes only when the transcript file changes — streaming text lives insessionWithPending, which is deliberately not passed — so it stays off the hot render path. Mobile already runs this same scan on lower-powered devices.Security
No new IPC channels, no command execution, no path handling, no auth surface change. The change is net reducing exposure: the projection previously could not leak hook transport fields because it published nothing, and
pickParsedAgentStatusPayloadis what keeps that true now that it publishes status —launchToken(the hook-authority secret),connectionId,promptInteractionKeyandproviderSessionOnlyare explicitly excluded, and a regression test asserts the exact published key set.providerSessionOnlyresume rows are never projected as live state.AI Review Report
Reviewed by independent subagents in a loop until clean, across two hostile lenses — correctness/regressions and cross-platform + remote + performance.
Finding raised and resolved during the loop (1) — no longer outstanding:
extractPendingAskcould report a permanently-pending ask, and the desktop card that consumes it replaces the composer ({questionActive ? null : <NativeChatComposer/>},NativeChatView.tsx:440), so the pane became unsendable. Confirmed real, and confirmed against real data: scanning the 400 most recent local Claude transcripts found 3 with a non-trailing orphantool_use, one of which is an orphanedAskUserQuestionat record 229 of 11 030 — every render of that conversation after the fallback landed would have pinned a dead question card over the composer for the remaining 10 800 records.src/shared/native-chat-ask.ts(summary item 4). The reviewer's proposed alternative — restoringtool_use_idpairing end-to-end — was not taken: it fixes the orphan-desync half but not the orphaned-ask half (the ask that never gets a result at all, which is the case actually observed in real transcripts), at a much larger blast radius across the block types and every decoder.src/shared/native-chat-ask.test.ts(orphan behind an interrupt row, orphan behind a plain-text interrupt turn, ask abandoned by an interrupt, ask the user typed past). The parser owns this behaviour, so the coverage lives in the parser's own suite rather than being duplicated at the card level. Both Claude interrupt flavours are covered: theinterruptedMessageIdrecord (decodes to a system status row) and the bare[Request interrupted by user]record (decodes to a user turn).Verification of the remediation (
src/shared/native-chat-ask.test.ts+NativeChatInteractiveCard.test.tsx; reverting the turn-boundary reset fails exactly the 4 parser cases listed above and leavesNativeChatInteractiveCard.test.tsxfully green — measured, not assumed)Neighbouring suites — all of
src/shared,src/renderer/src/components/native-chat,src/main/native-chat:This PR's other suites —
src/main/agent-hooks,orca-runtime-hook-agent-status-projection.test.ts,src/renderer/src/runtime:oxlint(default, native-plugins, type-aware--deny-warnings),typecheck:node,typecheck:web,typecheck:cliandcheck-max-lines-ratchet.mjsare all clean.Remediation applied between rounds: 2 pass(es). Findings judged false-positive were rejected with evidence rather than coded around.
Made with Orca 🐋