Skip to content

fix(ai): require thinking signature with provider-aware fallback - #44713

Merged
rekram1-node merged 1 commit into
v2from
thinking-signature
Aug 24, 2026
Merged

rekram1-node merged 1 commit into
v2from
thinking-signature

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Anthropic requires ThinkingBlockParam.signature, but some Anthropic-compatible APIs accept unsigned thinking only when it is sent with an empty signature.

This keeps the behavior entirely in packages/ai:

  • require signature in the Anthropic request schema
  • add the optional AI model compatibility override requireSignature
  • when the override is absent, infer empty-signature support provider-wide for Kimi/Moonshot and Xiaomi-compatible models and endpoints
  • preserve unsigned reasoning with signature: "" for compatible APIs; otherwise demote it to text instead of sending an invalid thinking block
  • keep an explicit compatibility value authoritative

Focused Anthropic Messages tests cover the strict default, Kimi coding and Moonshot inference, and explicit override precedence.

@rekram1-node
rekram1-node force-pushed the thinking-signature branch 7 times, most recently from 32aca2a to 3ff1f21 Compare August 24, 2026 17:49
@rekram1-node
rekram1-node merged commit 4780248 into v2 Aug 24, 2026
6 of 7 checks passed
@rekram1-node
rekram1-node deleted the thinking-signature branch August 24, 2026 18:13
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant