Repository navigation
refactor(ai): share replay identity hashing - #137280
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 9:39 AM ET / 13:39 UTC. ClawSweeper reviewWhat this changesThe PR centralizes replay-identity hashing used by Anthropic and OpenAI Responses compaction replay, with tests covering equivalent and mismatched identities. Merge readiness⛔ Blocked before merge - 1 item remains Keep open for maintainer judgment: this member-authored, labeled internal refactor remains useful and source inspection found no correctness or security defect. Priority: P3 Review scores
Verification
How this fits togetherCompaction replay restores a saved provider checkpoint into the next model request. A shared replay context fences that checkpoint to the same provider, API, model, endpoint, session, and authentication identity before history is reused. flowchart LR
A[Conversation checkpoint] --> B[Replay identity builder]
C[Active model request] --> B
B --> D[Identity comparison]
D -->|match| E[Reuse compaction checkpoint]
D -->|mismatch| F[Send full history]
Decision needed
Why: The patch is behavior-neutral and technically sound, but the protected maintainer label requires an explicit maintainer decision rather than automated closure. Before merge
Agent review detailsSecurityNone. PR surfaceSource -13, Tests +77. Total +64 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain one private replay-context builder beside the existing shared comparator so both transports continue to construct the same six-field fence. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an internal replay fence rather than reporting a broken user flow; source comparison establishes the claimed equivalence. Is this the best way to solve the issue? Yes. The existing shared replay-context module already owns the matching invariant, so placing the identical construction there removes drift without adding a parallel API or behavior path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f670fb5a6803. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
590527c to
c57ea48
Compare
|
@clawsweeper re-review |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Maintainer decision: accept the shared replay-context owner. The refactor is behavior-neutral, removes duplicated six-field replay identity construction, and keeps production code net-negative. Proceed once the exact-head CI, Testbox, and native merge gates complete. |
|
Merged via squash.
|
Related: #135727
What Problem This Solves
Replay identity construction was duplicated across the OpenAI Responses and Anthropic compaction paths. These fields fence provider replay by provider, API, model, endpoint, session, and authentication identity, so separate builders create avoidable drift risk in a security-sensitive invariant.
Why This Change Was Made
This moves the complete six-field replay-context construction into the shared owner established by #135727. Anthropic now uses that builder directly, while the existing OpenAI builder remains as a thin internal wrapper for its current callers. The shared owner also retains the exact existing trim, blank-to-undefined, and short-hash behavior.
User Impact
No user-visible behavior changes. Replay checkpoints remain fenced to the same provider, API, model, endpoint, session, and authentication identities.
Evidence
+33/-46, net-13; test LOC:+97/-20, net+77.openai/codexatcc4b8bdeb8446144bc6a5e3f6d31b4d5c633c6f4confirmed compaction uses the active provider, authentication, and session identity while the opaque compaction item does not encode those facts, leaving this replay fence correctly owned by OpenClaw.