Repository navigation
fix(claude): failed advisor calls no longer show as completed - #24254
Conversation
An advisor server tool call that ends in an advisor_tool_result_error (overloaded, max uses exceeded, and so on) was settled as "completed", because the typed tool-result error list covered every server tool's error block except the advisor's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a one-line production fix that correctly marks existing Claude advisor error results as failed, backed by a focused regression test. It does not introduce a new capability, change defaults, or affect unrelated tool handling. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Classify and test advisor results apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts |
The typed tool-result error switch now treats advisor_tool_result_error as an error. The test checks failed status for an overload error and completed status for a successful result. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#24328: Both changes update Claude result classification. This PR handles
message.is_errorresult frames when the terminal reason is missing orcompleted.
Suggested reviewers: juliusmarminge, t3dotgg
Merge Risk: 
Minimal · up to d2b76
-
The adapter change is mergeable; live advisor-provider behavior remains unverified but no source-level risk is established.
Pre-merge checks: 
4
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Note Written by @MarcoDotIO, thanks for finding the missing advisor error discriminator and covering both error and success. i kept your implementation and tests unchanged, and merged current main into your branch without rewriting your commits. the final diff is still one production line plus 60 lines in the existing adapter test file. verification at
unverified: a live claude advisor call, because claude is unauthenticated on this vm; electron, mobile, relay and tunnel were not launched. the server adapter supplies the same status contract to all clients. no contracts, other providers, controls or docs changed. the screenshots below show the real web client at 1440 × 1000 with matching seeded tool data. they demonstrate rendering only; the adapter regression tests prove classification through sdk frames. the error row changes to the failed color while the successful advisor row remains unchanged. |
|
Note Written by Verified in a real dev environmentchecked on the pr head, claude sonnet 5.5 and codex the existing advisor regression cases passed through blacksmith-check: 2 passed, covering error -> failed and success -> completed. these synthetic sdk-frame tests do not establish live advisor behavior. cafe reports 28 successful ci contexts, no failures or pending checks. no source changes or pushes were made. Not verifiedthe changed advisor classification remains unverified. set these matching-prompt captures show that environment limitation, not a successful before/after reproduction: native electron, ios/android, relay and tunnel were not exercised. this pass cannot certify the pr's changed behavior; it needs an environment that exposes the real claude advisor tool. uploaded video playback and seeking were checked in chrome. |
Keeps main's new Claude MCP elicitation tests (pingdotgg#21903) and this branch's advisor result test as separate blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>




Problem
When Claude's
advisortool call fails, the Anthropic API returns anadvisor_tool_resultwhose content is anadvisor_tool_result_error(for exampleoverloaded,too_many_requestsormax_uses_exceeded). The Claude adapter still settled that tool row as completed, so a failed advisor consult looked like a successful one.To reproduce, set
"advisorModel"in~/.claude/settings.json. Then run a Claude thread where the model callsadvisorand the advisor call fails. The row shows as completed.Change
isClaudeTypedToolResultErrorContentinClaudeAdapterV2.tslists the*_tool_result_errorcontent types for server tool results. It already handlesadvisor_tool_resultblocks, but its error check covered every server tool's error block except the advisor's. The switch has adefault: falsearm, so the type checker never caught the gap. This change addsadvisor_tool_result_errorto the list, so the row settles asfailed.Scope and approval
This is a one-line fix for an obvious omission. The advisor result block is already handled in
outputFromClaudeToolResult,isClaudeToolResultErrorandtoolNameFromClaudeToolResult, and its error variant (BetaAdvisorToolResultErrorin@anthropic-ai/sdk) has the same shape as the other*_tool_result_errortypes already in the list. No behavior changes for any other tool. I found no existing issue or PR for it (searched "advisor_tool_result_error", "advisor tool result error", "advisor failed claude", "advisor completed error"; #24129 and #24139 are about advisor usage accounting, not tool status).Verification
I added a focused adapter test,
settles an advisor call from its result content, inClaudeAdapterV2.test.ts. It streams aserver_tool_useadvisor call and then anadvisor_tool_resultthrough the wake harness, and checks how thedynamic_toolrow settles: an error result must end asfailedand anadvisor_resultmust end ascompleted.git show upstream/main:<ClaudeAdapterV2.ts>),node_modules/.bin/vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts -t advisor:× settles an advisor call from its result content: failedwithAssertionError: expected 'completed' to equal 'failed'(1 failed, 1 passed).vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts src/orchestration-v2/testkit/ClaudeReplayFixtures.integration.test.ts: 2 files, 248 tests passed.vp lint --report-unused-disable-directives apps/server/src/orchestration-v2/Adapters: no new findings. Twono-unused-varswarnings already exist on lines this change does not touch.vp fmt --check apps/server/src/orchestration-v2/Adapters: clean.tsc --noEmitinapps/server: exit 0.I did not check this against a live advisor failure. The test uses the API's documented block shapes.
Claude Opus 5.5 (Claude Code desktop app)
🤖 Generated with Claude Code