Skip to content

fix(openai): replay reasoning text signatures - #14

Open
arjunkmrm wants to merge 2 commits into
clavia/ai-providersfrom
fix/openai-reasoning-text-signatures
Open

arjunkmrm wants to merge 2 commits into
clavia/ai-providersfrom
fix/openai-reasoning-text-signatures

Conversation

@arjunkmrm

@arjunkmrm arjunkmrm commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Responses-compatible gateways that serve Anthropic models return thinking as reasoning_text content with a signature on the reasoning item, and leave encrypted_content empty. The provider decoded away the signature and never replayed reasoning content, so with store: false the next request carried an empty reasoning item and the model lost its prior thinking every turn.

  • OpenAiSchema: reasoning_text content accepts an optional signature.
  • OpenAiLanguageModel: reasoning content is kept as reasoningContent metadata on non-streamed reasoning parts and on streamed reasoning-end (from output_item.done), and replayed as content on the reasoning input item. Items without content are unchanged.
  • @tardie/ai-openai-compat: declares the same reasoningContent field, since both providers augment the shared Prompt and Response metadata types and the declarations must match.
  • CLAVIA_PATCHES.md: new "Reasoning text signatures" row.
  • Two tests: non-streamed replay sends the signed content back; streamed reasoning-end and Prompt.fromResponseParts keep it. Both fail without the change. Release workflow steps pass locally: lint, check, provider tests (377), build, pack and the packed consumer check.

This branch has not been deployed

No deployments
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