Skip to content

Commit ae20309

Browse files
committed
fix: preserve reasoning metadata across model switches
The differentModel guard strips providerMetadata from all parts when the current model differs from the stored message model. For reasoning parts this removes thinking block signatures, causing Anthropic to reject the history. Reasoning parts now always preserve their metadata since it is provider-scoped and harmless to other providers.
1 parent f954854 commit ae20309

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/opencode/src/session/message-v2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ export namespace MessageV2 {
795795
assistantMessage.parts.push({
796796
type: "reasoning",
797797
text: part.text,
798-
...(differentModel ? {} : { providerMetadata: part.metadata }),
798+
providerMetadata: part.metadata,
799799
})
800800
}
801801
}

0 commit comments

Comments
 (0)