Repository navigation
fix: normalize encrypted reasoning replay across storage - #169689
Conversation
Keep SDK reasoning replay independent of cleartext summaries and field insertion order while preserving native Responses replay semantics.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes SDK reasoning replay use the same privacy shape before and after transcript preparation while preserving native ChatGPT semantics. Example: The completed reasoning item rs_synthetic_replay contains a summary, cleartext content, and encrypted_content.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: fetched main still has the replay inconsistency, the previous finding is fixed, and the reviewed head has no actionable findings with its CI gate passing. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared Responses converter turns assistant history into outgoing provider input after replay-identity checks; transcript preparation separately canonicalizes stored reasoning signatures. flowchart TD
A[Completed assistant message] --> B[Warm history]
A --> C[Transcript privacy preparation]
C --> D[Reloaded history]
B --> E[Shared Responses converter]
D --> E
E --> F[SDK request]
E --> G[Native ChatGPT request]
Technical reviewBest possible solution: Keep the shared outbound normalization, native replay exception, and identity controls without rewriting persisted history. Do we have a high-confidence way to reproduce the issue? Current-main conversion retains summary/content that storage preparation removes, establishing the discrepancy from source; this read-only review ran no tests or provider requests. Is this the best way to solve the issue? The existing shared converter is the appropriate owner because both SDK request paths consume it and it can preserve the separate native contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against af2c00828eb3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +12, Tests +205, Docs +4. Total +221 across 4 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed October 12, 2026, 3:49 AM ET / 07:49 UTC (Revision 3). |
|
Merged via squash.
|
…9689) * fix: normalize encrypted reasoning replay across storage Keep SDK reasoning replay independent of cleartext summaries and field insertion order while preserving native Responses replay semantics. * test: distinguish SDK privacy from native reasoning replay
What Problem This Solves
Completed SDK Responses reasoning signatures can contain summaries and cleartext content in memory. Canonical transcript preparation removes that cleartext while retaining encrypted reasoning. Continuation before reload and after reload therefore sent different historical reasoning items, including different field order.
User Impact
Warm and reloaded SDK continuations now emit the same historical reasoning item shape. Canonical storage privacy, encrypted reasoning, and replay-identity checks remain intact. Native ChatGPT continues to retain the summary/content semantics used by upstream Codex.
Why This Change Was Made
The existing replay normalizer reconstructs the SDK privacy shape after identity and encryption checks. Its existing API discriminator preserves native replay semantics. Integration retains V2 user-provenance projection and the extracted native request builder. The necessary production growth is 12 lines for explicit shaping and the native discriminator; there are no new retention fields, options, configuration, schema, dependencies, or public APIs. The production repair added 185 test lines and 4 documentation lines; the later CI correction is described below.
Evidence
Initial integration proof is based on
372e20acb6176bb45ca11f679d64413728b70ca1, with staged patch SHA-256c929c7d54132d95a1f32fb6a22c0ea4fddcc5869b5d6902a1fc4240c8e52d27c. All 33 focused cases passed: three actual managed/package/native request boundaries and two canonical redaction controls (native wrapper wall time 34.02 seconds), plus four encryption/identity and 24 V2 compaction controls (4.24 seconds). The three new boundary cases themselves totaled 92 milliseconds; the wrapper includes worker/cache prerequisites. Targeted canonical lint, formatting, and staged diff checks pass. Fresh complete isolated P2 review is scoped-clean with zero findings.The original published head
55f15b07914f0af860a232eb633fb1d90fb1bf70failed CI run38215620973in one existing matching-route SDK replay assertion that expected summary and cleartext content. Local reproduction at that exact head produced the same failure with 47 cases passing in 4.70 seconds. The correction extends the existing metadata table across SDK and native ChatGPT replay: the SDK must emit an empty summary and omit cleartext content, while native ChatGPT retains summary/content. Matching, mismatched, malformed, and embedded metadata controls continue to protect ciphertext replay. This correction adds zero production lines and 20 net test lines.The final repaired candidate passed 80 cases across the complete provider shared suite, encryption/identity sibling, and V2 compaction sibling in 2.43 seconds. Targeted canonical lint, formatting, and diff checks pass. Fresh complete-candidate isolated P2 against the pinned integration base is scoped-clean with zero findings (confidence 0.93). The full candidate patch SHA-256 is
fb07e6134f7a353b380614905a857ab8c797e8a2e5e55b21b23b9ca07e14b011; the test-only correction patch SHA-256 is68f7a9188f232ec98ccfeb5839fd1bffb847f849e8afed97c8f4b8b5a70c807b.The passing real OpenAI API proof remains bound to base
a52a29f82299e563e3a200966a77412dcc3bdc8band preserved staged patch SHA-2564376609c326f65264e613121c815dc6a8a9a5876a4f3e0c727cf86749330f60f. Exactly three HTTP 200 responses produced one tool terminal and two normal terminals, with no error terminal. One completed streamed reasoning signature contained a summary and encrypted reasoning. Canonical storage privacy held, encrypted reasoning was retained, and the warm/cold historical reasoning fingerprints matched. The earlier low-effort fixture lacked a signature; its failed receipt remains preserved. A documented medium-effort synthetic computation completed the diagnostic proof, without attributing an omission bug to the provider.Storage proof exercises canonical preparation and JSON decoding, rather than a SQLite transaction, and makes no general prompt-cache or performance claim. No paid replay or broad compiler graph was run on the integrated source. Earlier compiler results remain prior-source evidence; post-correction hosted CI and current type gates remain publication-workflow gates; prior-head CI results do not qualify the repaired head. Hosted CI seconds have not yet been measured.