From 7c20059ef48bf14b367ab55680020cd43e309699 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Fri, 29 May 2026 15:01:26 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20remove=20redundant=20advi?= =?UTF-8?q?sor=20pending-call=20handoff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the serialized advisor(...) pending tool call from the advisor handoff while preserving the prose question and same-step context. --- _Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `4.70`_ --- src/node/services/tools/advisor.test.ts | 7 +++++-- src/node/services/tools/advisor.ts | 14 -------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/node/services/tools/advisor.test.ts b/src/node/services/tools/advisor.test.ts index ab308ae02a..2237e148d2 100644 --- a/src/node/services/tools/advisor.test.ts +++ b/src/node/services/tools/advisor.test.ts @@ -345,10 +345,13 @@ describe("advisor tool", () => { "## Advisor Handoff\n\n" + `**Question:** ${question}\n\n` + "**Current-step commentary:**\nVisible commentary about the current step.\n\n" + - "**Current-step reasoning:**\nInternal reasoning about coordination and race conditions.\n\n" + - `**Pending tool call:**\nadvisor(${JSON.stringify(snapshot.input)})`, + "**Current-step reasoning:**\nInternal reasoning about coordination and race conditions.", }, ]); + + const handoffText = getHandoffText(streamTextSpy); + expect(handoffText).not.toContain("**Pending tool call:**"); + expect(handoffText).not.toContain('advisor({"question":'); }); it("consumes the frozen snapshot exactly once for the current tool call", async () => { diff --git a/src/node/services/tools/advisor.ts b/src/node/services/tools/advisor.ts index 83557ba44f..83940bcec9 100644 --- a/src/node/services/tools/advisor.ts +++ b/src/node/services/tools/advisor.ts @@ -41,12 +41,6 @@ function tailTruncate(value: string, maxChars: number): string { return `...${value.slice(-(maxChars - 3))}`; } -function formatPendingToolCall(input: Record): string { - const serializedInput = JSON.stringify(input); - assert(serializedInput != null, "advisor handoff input must be JSON serializable"); - return `advisor(${serializedInput})`; -} - function buildAdvisorHandoffMessage( question: string | undefined, snapshot: AdvisorToolCallSnapshot | undefined @@ -78,14 +72,6 @@ function buildAdvisorHandoffMessage( sections.push(`**Current-step reasoning:**\n${stepReasoning}`); } - if (snapshot != null) { - assert( - snapshot.toolName === "advisor", - "advisor handoff snapshot must come from the advisor tool" - ); - sections.push(`**Pending tool call:**\n${formatPendingToolCall(snapshot.input)}`); - } - return { role: "user", content: sections.join("\n\n"),