fix(openai): drop encrypted reasoning from history for Responses-family APIs (fixes #90093)#92857
Conversation
…ly APIs openai-chatgpt-responses (and other Responses-family APIs) request encrypted reasoning content via include: ["reasoning.encrypted_content"]. When replaying prior assistant turns, the encrypted thinkingSignature is sent back to the ChatGPT/Codex backend, which rejects it with 400 invalid_encrypted_content because it cannot verify stale encrypted content from a previous session. Set dropReasoningFromHistory: true for all Responses-family APIs so reasoning blocks are stripped before replay, matching the existing behavior for openai-completions. Fixes openclaw#90093
|
Codex review: needs real behavior proof before merge. Reviewed June 13, 2026, 11:52 PM ET / 03:52 UTC. Summary PR surface: Source +1, Tests +1. Total +2 across 2 files. Reproducibility: yes. at source level with linked live reports: current main can persist and replay encrypted Responses reasoning, and the linked issue shows released multi-turn sessions failing with Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Narrow the fix to the native ChatGPT/Codex encrypted-replay failure path, or add explicit maintainer-backed proof that every OpenAI Responses-family route must drop reasoning history. Do we have a high-confidence way to reproduce the issue? Yes, at source level with linked live reports: current main can persist and replay encrypted Responses reasoning, and the linked issue shows released multi-turn sessions failing with Is this the best way to solve the issue? No. The plugin-owned replay-policy hook is a plausible location, but applying Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 889bc52ba5b3. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1, Tests +1. Total +2 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closing as superseded by the narrower fix already merged in #90682 ( This PR's blanket Thanks for isolating the replay-policy surface and adding focused coverage; the final fix belongs at the opaque transcript-field boundary instead. |
Summary
Responses-family APIs (
openai-chatgpt-responses,openai-responses,azure-openai-responses) request encrypted reasoning content viainclude: ["reasoning.encrypted_content"]. When replaying prior assistant turns, the encryptedthinkingSignatureis sent back to the ChatGPT/Codex backend, which rejects it with400 invalid_encrypted_contentbecause it cannot verify stale encrypted content from a previous session.Set
dropReasoningFromHistory: truefor all Responses-family APIs so reasoning blocks are stripped before replay, matching the existing behavior foropenai-completions.Root cause
buildOpenAIReplayPolicyinextensions/openai/replay-policy.tsdid not setdropReasoningFromHistoryfor Responses-family APIs. The core fallback insrc/agents/transcript-policy.ts:130only sets it foropenai-completions. This leftopenai-chatgpt-responsessessions replaying stale encrypted reasoning that the backend can no longer decrypt.Fix
One line in
extensions/openai/replay-policy.ts: adddropReasoningFromHistory: truefor Responses-family APIs alongside the existingallowSyntheticToolResults: true.Test
Updated the existing
buildReplayPolicytest expectation inopenai-provider.test.tsto include the new field.Real behavior proof
node scripts/run-vitest.mjs run extensions/openai/openai-provider.test.tspnpm builddropReasoningFromHistory: trueforopenai-chatgpt-responsesdropReasoningFromHistory: truefor all Responses-family APIs.openai-chatgpt-responsessessions will strip reasoning blocks before replay, preventing the400 invalid_encrypted_contenterror.