Repository navigation
fix(ai): retain compaction-only replay checkpoints - #127106
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 7:00 AM ET / 11:00 UTC. ClawSweeper reviewWhat this changesThe PR retains OpenAI Responses compaction replay checkpoints when history sanitization projects an already-empty assistant message, while retaining checkpoint removal when non-empty owner content is removed. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking line-level defect was found: the shared owner-boundary predicate correctly distinguishes unchanged empty content from actual removal. Keep this stacked, maintainer-labeled PR open for parent landing order and direct contract verification unavailable in this review environment. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherProvider compaction state is persisted with an assistant message and reused when OpenClaw builds the next Responses request. History sanitization may project that message into a fresh content array before the provider transport emits the continuation request. flowchart LR
A[Persisted assistant turn] --> B[History sanitizer]
B --> C[Replay owner rewrite]
C --> D{Content actually removed?}
D -->|Yes| E[Drop checkpoint and use full history]
D -->|No| F[Retain checkpoint]
F --> G[Responses continuation request]
Decision needed
Why: Repository policy requires the acting reviewer to inspect the sibling Codex source when the PR relies on that contract, but that checkout was unavailable in this read-only environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +8. Total +11 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: After #127094 resolves, retain the repair in the shared rewrite helper, directly verify the cited contract, then rebase and rerun the exact-head Gateway replay E2E plus the sanitizer removal coverage. Do we have a high-confidence way to reproduce the issue? Yes for a source-level reproduction: current main strips a checkpoint when both the original and projected owner contents are empty; the focused Gateway E2E reaches this path after its stacked startup prerequisite is present. Is this the best way to solve the issue? Yes. Repairing the shared replay-owner rewrite preserves the invariant for its sanitizer caller while retaining the existing destructive-removal invalidation path; downstream transport workarounds would be less maintainable. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75c44b2b98d5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
ee16d57 to
0a6e6ba
Compare
01e8494 to
8e8b736
Compare
|
Restacked onto exact parent #127094 head The old Proof:
Direct Codex contract proof: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* test(gateway): publish runtime in agent E2Es * test(gateway): leave replay fix to owner PR * fix(ai): retain compaction-only replay checkpoints * fix(ai): preserve empty compaction replay checkpoints
Summary
Root cause
OpenAI Responses can finish a turn with only a provider compaction item, so the durable assistant owner legitimately has
content: []plusproviderReplay. The shared image/history sanitizer projects assistant content into a fresh array before the next request.replaceCompactionReplayOwnerContenttreated every empty projected array as destructive content removal and stripped the checkpoint, even when both the source and projection were unchanged empty arrays.The transport then received the original user history and continuation prompt without the compaction item. The fix belongs in the shared replay-owner rewrite helper: unchanged projections retain provider state, while actual removals still invalidate prefix-bound state.
This PR is stacked on #127094 so that the E2E reaches the model transport. #127094 now remains focused on the independent prepared-runtime publication failure in the embedded cursor E2E; this PR owns the compaction test's full-startup opt-in and replay repair.
Proof
Pre-fix, in the original run order after enabling full startup:
Post-fix:
Additional verification:
Original release-validation failure: https://github.com/openclaw/openclaw/actions/runs/32457175968/job/96697080014
Scope