Repository navigation
fix(agent-hooks): reconcile Claude request waits across reconnects - #28187
Closed
thebestmensch wants to merge 4 commits into
Closed
thebestmensch wants to merge 4 commits into
thebestmensch wants to merge 4 commits into
Conversation
This was referenced Oct 16, 2026
Merged
Contributor
|
Thank you @thebestmensch for this work and for the careful write-up in #28186. Your reproduction and ownership checks made the split much easier. We need these fixes sooner than a full review of a ~3,000-line draft would allow, so we've split it into smaller PRs and credited you as co-author on each:
Not carried over, and why:
Closing in favour of the PRs above. Thanks again! |
nwparker
added a commit
that referenced
this pull request
Oct 16, 2026
…tive-wait query (#29488) getTerminalInteractiveWait read only the line tail, which drops the rows below the cursor Claude parks inside its dialog, so the query answered "no wait" while the trust dialog owned the screen. For Claude panes it now reads the rendered screen (bounded, discarded if newer output or a pane exit overtakes the read) and lets a dialog seen there stand unless a newer working or explicit idle signal clears it. Other agents keep the synchronous path, so concurrent queries still share one hook probe. Ported from #28187 onto the split runtime modules. Co-authored-by: JMensch <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Orca can keep showing a Claude permission request after that request has finished, or report no wait while a workspace-trust dialog is visible. This change makes those reports follow the exact request and current terminal screen.
What Changed
PostToolUseFailureclears the pending request even when Claude has cleared the tool's display fields.Why
A missing hook or network interruption should not require another user prompt to repair status. Exact ownership and transcript-branch checks let the execution host reconcile completed requests without guessing a permission decision. Reusing the existing status store, scheduler, screen reader and replay metadata avoids a second source of agent status.
Linked Issue
Fixes #28186.
Related to the Claude dialog portions of #25854 and #25623; this PR does not claim to fix those issues' other providers or CodeBuddy injection.
Visual Proof
Pending installed-runtime before/after capture. Existing raw PTY fixtures cover wide, narrow and answered Claude workspace-trust dialogs in headless replay. This draft is not evidence of an installed UI fix.
Testing
Automated checks ran on macOS:
runtime-serve-terminal-smoke.mjspaired a client to the built Electron server, created a disposable worktree and terminal, executed a command and observed its output, then shut down and cleaned up. This verifies the built terminal path, not real Claude permission or Windows-client acceptance.pnpm run buildpassed, including the configured TypeScript checks, relay, CLI, desktop, mobile-web and macOS native builds. Changed-file oxlint, diff checks, and normal commit hooks also passed. Broader test coverage and upstream CI remain pending.The first full build stopped at missing mobile-workspace dependencies. Installing that workspace with
pnpm install --frozen-lockfileresolved it; package manifests and lockfiles remain unchanged. The optional globalorca-devsymlink could not be installed, so the build used the checkout's output without changing the running app.The final regression first reproduced an old result with retained facts changing a later completed row back to working. The fix limits retained-fact settlement to a pending request and preserves the existing strict restatement checks for already-settled rows.
AI Disclosure
Codex assisted implementation and testing. Claude performed a read-only review of the working-tree candidate.
Review
The latest independent review approved the complete 10-file restart-recovery diff with no concrete findings. It had no tool access and could not independently verify tests or surrounding scheduler behavior. A subsequent fixture-only correction replaced an invalid false value with undefined; that final type-corrected test and full build passed. Earlier concrete findings were reproduced and fixed.
Agent skill upstream boundary
Notes
A live rendered-screen probe on October 13 found an additional unresolved dialog: Claude's Auto Mode classifier confirmation (Yes/No, with 20 blocked actions) is visible while the installed runtime reports a null agentWait. Passing that same captured rendered text to this branch's detectTerminalWaitBlockedReason also returns null. The workspace-trust fix therefore does not cover this Auto Mode dialog. No dialog input was sent. A raw PTY fixture and detector repair are still required; the rendered-text diagnostic is not a raw-terminal replay or installed acceptance test.
This remains a draft pending real persisted Claude transcript validation, installed Windows-to-Mac operation, and a hands-off workflow canary. Execution-host restart recovery is now implemented and covered by the real hook-server restart test with a synthetic transcript and mocked process verdict. That test first reproduced a saved wait remaining stuck after restart with no fresh hook; it now settles the exact request. Missing or revoked ownership, unresolved parallel requests, sibling-child results, unverifiable or exited processes, newer waits, disabled hooks and pane teardown cannot use this recovery path to clear the wait. This does not establish installed-runtime acceptance.
Transcript fixtures are synthetic; existing SDK stream captures do not establish persisted JSONL ancestry. Local inspection of a real transcript was blocked by the environment's path guard and was not retried through another route.
The 16-result replay bound is conservative: an older pending request whose proof has fallen out of the retained set may remain held. No permission settings, approval dialogs, credentials, or installed runtime are changed by this PR. Actual Windows/Linux/SSH acceptance remains unverified; remote tests use the real relay and main servers locally.
Checklist