From e1714ba4f0a6e9e5feb0b62b94b95a93d9fd33a5 Mon Sep 17 00:00:00 2001 From: Robin1987China <41602358+Robin1987China@users.noreply.github.com> Date: Tue, 30 Jun 2026 18:37:01 +0800 Subject: [PATCH] fix(llm): inject _noop tool for all providers when messages contain tool history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bedrock (and other providers) requires a toolConfig when messages contain toolUse/toolResult content blocks, even if no active tools are being used. Previously the _noop tool injection was limited to github-copilot, but the underlying constraint affects Compaction on Bedrock-backed providers too (e.g. Portkey) — resulting in "toolConfig field must be defined" errors. Remove the github-copilot-specific guard so the _noop tool is injected whenever messages contain prior tool calls but no current tools are active. Closes #34089 --- packages/opencode/src/session/llm/request.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/opencode/src/session/llm/request.ts b/packages/opencode/src/session/llm/request.ts index 4f93411107df..4cd18be3a101 100644 --- a/packages/opencode/src/session/llm/request.ts +++ b/packages/opencode/src/session/llm/request.ts @@ -157,11 +157,9 @@ export const prepare = Effect.fn("LLMRequestPrep.prepare")(function* (input: Pre for (const key of Object.keys(tools)) tools[key] = { ...tools[key], strict: false } } if ( - input.model.providerID.includes("github-copilot") && Object.keys(tools).length === 0 && hasToolCalls(input.messages) ) { - // Copilot needs a tools field when replaying prior tool calls, even if no tools are currently enabled. tools["_noop"] = aiTool({ description: "Do not call this tool. It exists only for API compatibility and must never be invoked.", inputSchema: jsonSchema({