Skip to content

Drop reasoning signatures issued by a different model - #354

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-5592-foreign-reasoning-signatures
Aug 7, 2026
Merged

Drop reasoning signatures issued by a different model#354
TheGreatAxios merged 1 commit into
mainfrom
cl-5592-foreign-reasoning-signatures

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Adapters for Codex, Grok, and generic OpenAI Responses echo a thinking block's encrypted signature back to the backend for reasoning continuity within one provider.
  • The signature is opaque ciphertext issued by a specific backend/model; replaying it after a model switch sends one provider's blob to another, which cannot decrypt it and 400s every subsequent turn.
  • Each assistant turn already records the model that produced it (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.
  • Because the check runs on every request, an already-poisoned history heals itself on the next turn instead of failing forever.

Verification

  • bun run typecheck
  • bun run build
  • bun run test (3949 pass, 0 fail) — added a same-model roundtrip regression check, a cross-model drop test, and a poisoned-history recovery test to tests/unit/codex-responses-adapter.test.ts

Closes CL-5592

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.
@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown

CL-5592

@TheGreatAxios
TheGreatAxios merged commit 44297aa into main Aug 7, 2026
2 checks passed
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