Skip to content

fix: normalize encrypted reasoning replay across storage - #169689

Merged
steipete merged 2 commits into
mainfrom
codex/provider-reasoning-main372-20261011
Oct 12, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/provider-reasoning-main372-20261011

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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-256 c929c7d54132d95a1f32fb6a22c0ea4fddcc5869b5d6902a1fc4240c8e52d27c. 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 55f15b07914f0af860a232eb633fb1d90fb1bf70 failed CI run 38215620973 in 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 is 68f7a9188f232ec98ccfeb5839fd1bffb847f849e8afed97c8f4b8b5a70c807b.

The passing real OpenAI API proof remains bound to base a52a29f82299e563e3a200966a77412dcc3bdc8b and preserved staged patch SHA-256 4376609c326f65264e613121c815dc6a8a9a5876a4f3e0c727cf86749330f60f. 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.

Keep SDK reasoning replay independent of cleartext summaries and field insertion order while preserving native Responses replay semantics.
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Warm SDK continuation includes summary and content, while continuation after transcript preparation omits them.
  • After: Both SDK continuations emit summary: [], omit content, and preserve identical ciphertext and field order.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is correct, resolves the prior finding, and passes current-head CI; inspected behavioral evidence remains an in-process request harness rather than a current-source live trace.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; inspected tests exercise real managed, package, and native request assembly with mocked HTTP, while the reported live OpenAI run remains earlier-source evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: SDK continuation replays a different historical reasoning item after transcript reload.
Reason: The maintainer-authored direction repairs a source-established inconsistency through the existing owner without new configuration, persistence formats, or public APIs.

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
Reviewed head: f697bd3b35783dc4d1b615d71244ad08e670b07a

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The body reports an earlier-source live OpenAI warm/cold run, but no inspectable current-source shipped-entry-point trace is attached.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 17eb646 adds packages/ai/src/transports/openai-responses-replay-messages-internal.ts:127 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 17eb646bb3e1; files: packages/ai/src/transports/openai-responses-replay-messages-internal.ts)
  • Vincent Koc: Raw commit ef68101 adds packages/ai/src/transports/openai-responses-replay-messages-internal.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: ef681015e567; files: packages/ai/src/transports/openai-responses-replay-messages-internal.ts)

PR surface

Source +12, Tests +205, Docs +4. Total +221 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 15 3 +12
Tests 2 260 55 +205
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 279 58 +221

Review metrics

Metric Value Why it matters
Production versus test growth Production +15/-3, net +12; tests +260/-55, net +205. The production growth explicitly shapes SDK replay; tests cover distinct request adapters and extend existing identity controls to native ChatGPT.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a bounded historical-request inconsistency; provider rejection and measured cache or latency impact are not established.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-12T06:56:29.647Z sha 55f15b0 :: needs changes before merge. :: [P2] Update the existing SDK replay expectation for canonical fields
  • reviewed 2026-10-12T07:07:12.788Z sha 55f15b0 :: needs changes before merge. :: [P2] Update the existing SDK replay expectation for canonical fields

Reviewed October 12, 2026, 3:49 AM ET / 07:49 UTC (Revision 3).

@steipete
steipete marked this pull request as ready for review October 12, 2026 07:02
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@steipete
steipete merged commit 438e06c into main Oct 12, 2026
131 of 133 checks passed
@steipete
steipete deleted the codex/provider-reasoning-main372-20261011 branch October 12, 2026 08:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant