@devries-cameron20 / t3code-1 / commits / 25dde99a51
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(claude): failed advisor calls no longer show as completed (#24254)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

MarcoDotIO committed Oct 31, 2026 at 04:40 UTC 25dde99a5199b89641ea0b5aef556033ea9201fb
2 files changed +61
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+60
@@ -4577,6 +4577,66 @@ describe("ClaudeAdapterV2 background wake turns", () => {
4577 ),
4578 );
4579
4580 + it.effect.each([
4581 + {
4582 + content: { type: "advisor_tool_result_error", error_code: "overloaded" },
4583 + status: "failed",
4584 + },
4585 + { content: { type: "advisor_result", text: "Looks right." }, status: "completed" },
4586 + ] as const)("settles an advisor call from its result content: $status", ({ content, status }) =>
4587 + Effect.gen(function* () {
4588 + const harness = yield* makeWakeHarness;
4589 + yield* harness.runtime.startTurn(
4590 + makeClaudeTestTurnInput({
4591 + threadId: harness.threadId,
4592 + providerThread: harness.providerThread,
4593 + now: yield* DateTime.now,
4594 + attemptId: RunAttemptId.make("advisor-result"),
4595 + text: "Check the plan with the advisor",
4596 + attachments: [],
4597 + }),
4598 + );
4599 + const id = "srvtoolu_advisor";
4600 + const assistantFrame = (uuid: string, block: unknown) =>
4601 + claudeSdkFrame({
4602 + type: "assistant",
4603 + uuid,
4604 + session_id: WAKE_NATIVE_SESSION,
4605 + parent_tool_use_id: null,
4606 + message: {
4607 + id: "advisor-message",
4608 + type: "message",
4609 + role: "assistant",
4610 + model: "claude-opus-5-5",
4611 + content: [block],
4612 + },
4613 + });
4614 + yield* harness.offerAndWait(
4615 + assistantFrame("advisor-call", { type: "server_tool_use", id, name: "advisor", input: {} }),
4616 + );
4617 + yield* harness.offerAndWait(
4618 + assistantFrame("advisor-result", { type: "advisor_tool_result", tool_use_id: id, content }),
4619 + );
4620 + yield* Queue.offer(
4621 + harness.sdkMessages,
4622 + makeResultFrame({ uuid: "advisor-terminal", result: "Checked" }),
4623 + );
4624 + yield* Queue.take(harness.terminalReceipts);
4625 + const items = harness.events.flatMap((event) =>
4626 + event.type === "turn_item.updated" && event.turnItem.type === "dynamic_tool"
4627 + ? [event.turnItem]
4628 + : [],
4629 + );
4630 + assert.equal(items.at(-1)?.toolName, "advisor");
4631 + assert.equal(items.at(-1)?.status, status);
4632 + }).pipe(
4633 + Effect.scoped,
4634 + Effect.provide(
4635 + Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),
4636 + ),
4637 + ),
4638 + );
4639 +
4640 describe("MCP elicitations", () => {
4641 const testLayer = Layer.mergeAll(
4642 IdAllocator.layer,
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+1
@@ -3188,6 +3188,7 @@ function isClaudeTypedToolResultErrorContent(content: ClaudeTypedToolResultConte
3188 }
3189
3190 switch (content.type) {
3191 + case "advisor_tool_result_error":
3192 case "bash_code_execution_tool_result_error":
3193 case "code_execution_tool_result_error":
3194 case "text_editor_code_execution_tool_result_error":