diff options
| author | Aiden Cline <[email protected]> | 2026-05-01 11:15:17 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-05-01 11:15:17 -0500 |
| commit | 29ec07700c43c18c7fdfb46a594c1c8e4a1d8524 (patch) | |
| tree | e286792f8905356eabc96b9b633032c495c7fba5 | |
| parent | bcae852d28d08598bc013c8fbca9cb8522704881 (diff) | |
| download | opencode-29ec07700c43c18c7fdfb46a594c1c8e4a1d8524.tar.gz opencode-29ec07700c43c18c7fdfb46a594c1c8e4a1d8524.zip | |
fix: bedrock reasoning issue (#25303)
| -rw-r--r-- | packages/opencode/src/session/message-v2.ts | 10 | ||||
| -rw-r--r-- | packages/opencode/test/session/message-v2.test.ts | 8 |
2 files changed, 17 insertions, 1 deletions
diff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.ts index a017ead1e..5f97074b2 100644 --- a/packages/opencode/src/session/message-v2.ts +++ b/packages/opencode/src/session/message-v2.ts @@ -938,10 +938,18 @@ export const toModelMessagesEffect = Effect.fnUntraced(function* ( }) } if (part.type === "reasoning") { + if (differentModel) { + if (part.text.trim().length > 0) + assistantMessage.parts.push({ + type: "text", + text: part.text, + }) + continue + } assistantMessage.parts.push({ type: "reasoning", text: part.text, - ...(differentModel ? {} : { providerMetadata: part.metadata }), + providerMetadata: part.metadata, }) } } diff --git a/packages/opencode/test/session/message-v2.test.ts b/packages/opencode/test/session/message-v2.test.ts index 89bae246a..afd24e7e1 100644 --- a/packages/opencode/test/session/message-v2.test.ts +++ b/packages/opencode/test/session/message-v2.test.ts @@ -469,6 +469,13 @@ describe("session.message-v2.toModelMessage", () => { }, { ...basePart(assistantID, "a2"), + type: "reasoning", + text: "thinking", + metadata: { openai: { reasoning: "meta" } }, + time: { start: 0 }, + }, + { + ...basePart(assistantID, "a3"), type: "tool", callID: "call-1", tool: "bash", @@ -495,6 +502,7 @@ describe("session.message-v2.toModelMessage", () => { role: "assistant", content: [ { type: "text", text: "done" }, + { type: "text", text: "thinking" }, { type: "tool-call", toolCallId: "call-1", |
