Skip to content

Key reasoning-signature replay on the issuing provider - #364

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-5594-signature-provenance
Aug 7, 2026
Merged

Key reasoning-signature replay on the issuing provider#364
TheGreatAxios merged 2 commits into
mainfrom
cl-5594-signature-provenance

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • signatureForModel compared only turn.model against the current request's model. provider is a fixed adapter tag but model is arbitrary catalog/user-supplied text, so two distinct backends can declare the same literal model name (proxy aliases, two OpenAI-compatible endpoints both configured as gpt-4o). The old check would replay a foreign signature in that case, reproducing the original decrypt-failure 400 the prior fix (CL-4xxx) was meant to prevent.
  • ConversationTurn has no field for which provider produced a turn, so provenance now rides inside the signature string itself: capture (parseResponse, shared by Codex/Grok/OpenAI-Responses adapters) tags it <provider>:<ciphertext>, and replay (signatureForModel) only unwraps the ciphertext when both the tagged provider and the model match the current request.
  • Keyed on provider, not the per-account InferenceSource.id — a live Codex account switch (codex/abk-labscodex/dirtroad) shares the same decrypting backend, so reasoning continuity across accounts is preserved; a genuine cross-provider model-name collision is now blocked.

Net lines

Net-positive (mostly comments explaining the provenance scheme + two new provider params threaded through the three Responses adapters + test coverage). No code was removable here — the bug is a missing check, not a redundant one.

Test plan

  • Added a failing test first (tests/unit/codex-responses-adapter.test.ts, commit ddedba7) confirming the adapter had no way to express provider-tagged signatures; fix landed in the following commit (4c1d9ff).
  • New test: a signature tagged for a different provider is dropped even when turn.model matches the current request's model.
  • New test: a second account (different sourceId) on the same provider still replays the signature — account-switch continuity preserved.
  • Updated existing round-trip / poisoned-history / SSE-fixture tests to use tagged signatures.
  • bun run typecheck — clean
  • bun run build — clean
  • bun run test — 3985 pass, 0 fail

@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown

CL-5594

A signature tagged as belonging to a different provider than the
current request must never be replayed, even when the historical
turn's bare model string happens to match; a second account on the
same provider must still replay. The adapter has no way to express
provider-tagged signatures yet, so these cases fail to even compile.
signatureForModel compared only turn.model against the current
request's model, but provider is a fixed adapter tag while model is
arbitrary catalog/user-supplied text — two distinct backends can
declare the same literal model name (proxy aliases, two
OpenAI-compatible endpoints both configured as gpt-4o), and the
equality check would treat a foreign signature as safe to replay,
reproducing the original decrypt-failure bug.

ConversationTurn carries no field recording which provider produced
it, so provenance now rides inside the signature string itself:
capture tags it provider:ciphertext, and replay only unwraps the
ciphertext when both the tagged provider and the model match. Keying
on provider rather than the per-account source id means a live
account switch on the same backend (two ChatGPT accounts through the
same Codex service) still preserves reasoning continuity, since the
decrypting backend is shared across accounts.
@TheGreatAxios
TheGreatAxios force-pushed the cl-5594-signature-provenance branch from 4c1d9ff to 40e6c0d Compare August 7, 2026 08:11
@TheGreatAxios
TheGreatAxios merged commit 11b773a 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