Repository navigation
fix: keep compacted sessions usable after transcript rewrites - #123485
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 6:16 AM ET / 10:16 UTC. ClawSweeper reviewWhat this changesThe PR reindexes or removes server-compaction replay checkpoints after assistant transcript rewrites, and durably removes a rejected OpenAI Responses checkpoint during fallback recovery. Merge readinessNo blocking code defect was found in the latest head; the prior missing OpenAI tool-ID rewrite coverage is now routed through the shared checkpoint-rewrite helper. Keep this maintainer-authored, session-state-sensitive PR open for exact-head CI and the required maintainer decision on live OpenAI Responses verification. Priority: P2 Review scores
Verification
How this fits togetherAssistant transcript messages retain provider replay checkpoints that let later OpenAI Responses calls replace an earlier prefix. Sanitizers, tool-ID repair, and provider recovery rewrite those messages before the session manager persists the active transcript branch. flowchart LR
A[Session transcript] --> B[Transcript rewrites]
B --> C[Checkpoint reindex or removal]
C --> D[OpenAI Responses request]
D --> E[Rejected checkpoint recovery]
E --> F[Durable session transcript]
Decision needed
Why: The source repair and durable regression coverage are coherent, but the provider's encrypted-compaction rejection behavior is an external API contract that local mock tests cannot establish. Before merge
Agent review detailsSecurityNone. PR surfaceSource +172, Tests +413. Total +585 across 33 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared checkpoint-rewrite helper and existing transcript-rewrite owner, then add a redacted live OpenAI Responses rejection/recovery trace before landing; no smaller net-neutral owner boundary was identified because the repair must cover several independent transcript mutators plus durable recovery. Do we have a high-confidence way to reproduce the issue? Yes, from source: rebuilding an assistant message after removing a pre-checkpoint block previously retained its old replay index; the added regression exercises that state transition and durable recovery, though this read-only review did not execute it. Is this the best way to solve the issue? Yes, with the live-provider proof caveat: repairing checkpoint state at transcript mutation and session-rewrite owners is better than compensating in request construction, and the latest head covers the prior OpenAI ID-rewrite gap. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b28ff3e0a29a. 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 (4 earlier review cycles)
|
cd1d594 to
3bf9da8
Compare
|
Merged via squash.
|
…aw#123485) * fix: keep compaction checkpoints aligned through rewrites * fix: persist rejected compaction invalidation * chore: drop release-only changelog edit * fix: align compaction replay with repository guards * fix: invalidate checkpoints after OpenAI ID rewrites
What Problem This Solves
Fixes an issue where OpenAI Responses users could lose replayed tool calls after transcript sanitizers removed or rebuilt assistant content before a server-compaction checkpoint. It also prevents a provider-rejected encrypted checkpoint from remaining in persisted history when the stripped retry later fails, which otherwise made later turns repeatedly pay the same rejection and recovery cost.
Why This Change Was Made
Content mutators now reindex unambiguous prefix-bound checkpoints and strip them when a rewrite is empty or ambiguous, covering the complete mutator neighborhood rather than compensating in the request builder. Provider rejection carries the exact ephemeral checkpoint identity to the existing runner transcript-rewrite owner, which branches and re-appends the active SQLite suffix without adding another persistence path. The in-flight suppression tombstone remains in place as a second safeguard.
No persisted replay fields, worker-protocol fields, config/default surfaces, or SQLite schema changes are introduced.
User Impact
Compacted OpenAI Responses sessions keep tool calls and results paired after transcript cleanup. If a server rejects a stale checkpoint, the rejection is removed durably before retry-stream failure, so process restart and later turns rebuild from full history instead of replaying the rejected ciphertext again.
Evidence
replayIndex0but received1; an emptied owner also retained its checkpoint. Both intended failures passed after the owner repair.mainrebase: 249 focused tests passed.pnpm tsgopassed on the exact head.git diff --check origin/main...HEADpassed.+397/-223(net+174); tests:+369/-24(net+345); changelog:+1/-0. The production growth is the approved owner-boundary capability covering all active mutators plus durable rejection repair; nearby replay validation, identity matching, and sanitizer branches were consolidated rather than deleting coverage to game the count.