Skip to content

Commit 10b68d2

Browse files
olddonkeyclaude
andcommitted
docs(responses): stop asserting a disproven cause for the blob-preservation guard
The guard is sound, but its comments claimed it fixed Grok's `Could not decrypt the provided encrypted_content` failure. Live bisection disproved that: Grok emits summary-channel reasoning natively, so `reasoningItemToSummaryShape` returns early and this rewrite never fires on that route. The real cause was `"content": null` on the replayed reasoning item, fixed separately. A false causal claim in a comment is worse than none — the next reader trusts it. The rule is restated on its own terms: an item carrying opaque provider state should not have its stored shape changed unless that backend has an explicit replay contract, which is why DeepSeek was safe and why the Kimi/GLM/NeuralWatt routes now on `preserveReasoningContentModels` are the ones this actually guards. Comments and prose only; no behaviour change. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 3d11f6f commit 10b68d2

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎src/server/responses-reasoning-summary-rewrite.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ function reasoningTextOf(item: Record<string, unknown>): string {
3434
/** Move a reasoning item's content channel into the summary channel. */
3535
function reasoningItemToSummaryShape(item: Record<string, unknown>): Record<string, unknown> {
3636
if (item.type !== "reasoning") return item;
37-
// An item carrying `encrypted_content` is replayed verbatim by the client, and the backend that
38-
// issued the blob verifies the item it gets back ("Could not decrypt the provided
39-
// encrypted_content. Ensure the value is the unmodified encrypted_content from a previous
40-
// response."). Reshaping it here is a modification the client then replays on every later turn.
41-
// The delta rewrite still gives Codex the expandable trace for the live turn; only the stored
42-
// shape has to stay exactly as the upstream sent it. DeepSeek — the provider this rewrite was
43-
// verified against — is `statelessResponses` and issues no blob, so it is unaffected.
37+
// `encrypted_content` is opaque, state-bearing provider data, so the entire item must retain its
38+
// upstream shape unless that backend has an explicit replay contract permitting a rewrite. This
39+
// defensively protects content-channel backends that do issue blobs when the client replays the
40+
// stored item. The delta rewrite can still provide the expandable trace for the live turn.
41+
// DeepSeek — the provider this rewrite was verified against — is `statelessResponses` and issues
42+
// no blob, so it is unaffected.
4443
if (typeof item.encrypted_content === "string" && item.encrypted_content.length > 0) return item;
4544
const text = reasoningTextOf(item);
4645
// Items that already use the summary channel (or carry no content text at

‎structure/04_transports-and-sidecars.md‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -798,13 +798,14 @@ Codex app, so tool cells group like native models — while the text still round
798798
`devlog/_fin/260709_native_response_pattern/`.
799799

800800
The content-to-summary channel rewrite skips any reasoning item that carries a native
801-
`encrypted_content` blob. Codex replays the reasoning item it received, and a backend that issued
802-
that blob verifies what comes back, so reshaping the stored item makes every later turn fail with
803-
`Could not decrypt the provided encrypted_content`. The rewrite's round trip was verified against
804-
DeepSeek, which is `statelessResponses` and issues no blob; providers that do issue one joined the
805-
same route later through `preserveReasoningContentModels`. Only the stored item is exempt — the
806-
`reasoning_text` delta events carry no blob and still route to the summary channel, so the live
807-
expandable trace is unchanged.
801+
`encrypted_content` blob. The blob is opaque, state-bearing provider data, so the item must
802+
round-trip unchanged unless that backend has an explicit replay contract permitting a rewrite.
803+
This defensively protects providers that issue blobs and later join the route through
804+
`preserveReasoningContentModels`. The rewrite's round trip was verified against DeepSeek, which is
805+
`statelessResponses` and issues no blob. Grok is unaffected in practice because it natively emits
806+
summary-channel reasoning and no `reasoning_text` events, so this content-to-summary item rewrite
807+
does not engage on its route. Only the stored item is exempt — `reasoning_text` delta events carry
808+
no blob and still route to the summary channel, so the live expandable trace is unchanged.
808809

809810
The process-local raw-reasoning fallback is fail-closed unless a request has an explicit client
810811
thread plus an exact provider destination, wire adapter, final model, and physical credential

‎tests/responses-reasoning-summary-rewrite.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ describe("responses reasoning summary channel rewrite", () => {
210210
expect(rewrite("[1,2]")).toBe("[1,2]");
211211
});
212212

213-
// The client replays the reasoning item it received, and a backend that issued
214-
// `encrypted_content` rejects a reshaped item on that replay. This rewrite's round-trip was
215-
// verified against DeepSeek, which is stateless and issues no blob; providers that do issue one
216-
// joined later through `preserveReasoningContentModels`.
213+
// `encrypted_content` is opaque, state-bearing provider data, so preserve the complete item
214+
// shape defensively when the client replays it. This rewrite's round-trip was verified against
215+
// DeepSeek, which is stateless and issues no blob; providers that do issue one joined later
216+
// through `preserveReasoningContentModels`.
217217
describe("items carrying encrypted_content", () => {
218218
const blobItem = {
219219
type: "reasoning",

0 commit comments

Comments
 (0)