Drop reasoning signatures issued by a different model - #354
Merged
Conversation
The Responses-style adapters (Codex, Grok, generic OpenAI Responses) echo a thinking block's encrypted signature back to keep reasoning continuity within one provider. The signature is opaque ciphertext a specific backend issued for a specific model, so replaying it after an operator switches models sends one provider's blob to another, which cannot decrypt it and 400s every subsequent turn. Each assistant turn already records which model produced it. Compare that against the model the current request targets and only replay a signature when they match; otherwise the reasoning item is dropped and the rest of the turn is sent unchanged. Because the check runs at every request, an already-poisoned history heals itself on the next turn instead of failing forever.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AssistantTurn.model); a signature is now replayed only when that matches the model the current request targets, otherwise the reasoning item is dropped and the rest of the turn is sent unchanged.Verification
bun run typecheckbun run buildbun run test(3949 pass, 0 fail) — added a same-model roundtrip regression check, a cross-model drop test, and a poisoned-history recovery test totests/unit/codex-responses-adapter.test.tsCloses CL-5592