Repository navigation
fix(agent-hooks): clear a Claude permission wait when its approved tool fails - #29387
Merged
Merged
Conversation
…ol fails Orca keeps a Claude permission wait visible until it sees the exact tool it was waiting on resume. A tool that fails reports PostToolUseFailure, whose tool name and input Orca clears, so the resume check never matched and the pane kept showing "needs permission" while Claude was already working. The exact tool_use_id and owner now settle the wait for a failure as well. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
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 |
Merged
7 of 9 tasks
5 of 9 tasks
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
If you approved a Claude tool and that tool then failed (for example, a command exited with an error), Orca kept showing the pane as "needs permission" even though Claude had already moved on. Now the wait clears as soon as Claude reports that exact tool failed.
What Changed
PreToolUse/PostToolUsewith the same tool name and input. A failed tool reportsPostToolUseFailure, and Orca's Claude parser clears the tool name and input for that event, so the check could never match. The wait stayed until some later unrelated hook happened to replace it.PostToolUseFailurecarrying the waiting request's exacttool_use_id, from the same owner (the lead, or the same subagent id and type), settles the wait. The row then shows the state Claude reported, which is working. A failure from a different tool use, or from a subagent reusing the id, leaves the wait in place.isClaudePermissionResumingApprovedTool(src/main/agent-hooks/server/server-claude-status-rules.ts), on the execution host's hook server, the single store every reader subscribes to.Why
The exact request id plus owner is the narrowest evidence that the waiting request is over. It doesn't infer an approval, a cancellation, or the end of a turn. Matching on tool name or input isn't possible for this event, and loosening the existing name/input rule would let a sibling tool's failure clear an unrelated wait.
This is one of the cases listed in #28186. It does not close that issue. The headline case (a transcript result observed during a disconnect that a later hook replaces before the desktop reconnects) needs the transcript-result reconciliation proposed in draft #28187. That draft is not taken over here: it is about 3,000 lines across 37 files, conflicts with main, mixes in unrelated workspace-trust and restart-recovery work, and its author notes that it hasn't been validated against real persisted Claude transcripts.
Linked Issue
Part of #28186. It does not close it.
Visual Proof
N/A: there's no layout change. The pane's status simply leaves the permission state, which the hook-server tests assert directly.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New
src/main/agent-hooks/server-claude-permission-tool-failure.test.tsdrives the real hook server over HTTP. With an exact-id failure the wait clears (this test fails on main: the row stayswaiting). A sibling tool's failure and a subagent's failure with the same id keep the wait.Ran the existing
server-claude-permission-visibility,server-claude-child-permission-lifecycleandserver-claude-normalizationsuites: all pass.src/main/claude/claude-structured-*is not touched, so the real-CLI suite does not apply.AI Disclosure
Review
Codex review (gpt-6.1-sol, high) found no issues.
Agent skill upstream boundary
Notes
SSH: the rule runs on the execution host's hook server, so it applies to local, WSL and managed SSH hosts alike. Remote clients receive the corrected row through the existing status stream. No wire change.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)