Repository navigation
fix: restore session state after nested transcript rollback - #159807
Conversation
|
🦞👀 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. Reviewed September 27, 2026, 9:29 PM ET / September 28, 2026, 01:29 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch restores a session manager’s loaded conversation view when a nested SQLite transcript write rolls back and adds rollback and replay tests. Merge readiness✅ Ready for maintainer review Current main still has the reported rollback gap, and this PR remains a useful fix. The prior review’s blockers have been addressed; I found no actionable defect in the pinned head. Priority: P2 Review scores
Verification
How this fits togetherThe session manager keeps a conversation view in memory while SQLite stores transcript entries. An append updates both; transaction rollback must leave the manager ready to choose the correct parent for the next message. flowchart LR
A[Session append] --> B[Session manager view]
A --> C[SQLite transcript write]
C --> D{Transaction outcome}
D -->|Commit| E[Retained conversation]
D -->|Rollback| F[Restore loaded view]
F --> G[Next message parent]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +100, Tests +483. Total +583 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the manager’s loaded view aligned with SQLite savepoint outcomes so retries and later appends use durable conversation ancestry. Do we have a high-confidence way to reproduce the issue? Yes. Current main lacks manager-view rollback enlistment, and the PR supplies a focused nested-write failure path with reported pre-fix failures; this read-only review did not run it. Is this the best way to solve the issue? Yes. The patch uses the existing SQLite transaction-state owner and checks target rebinding before commit, without adding a persistence owner or changing the stored format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fb2487a903ab. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
18584ef to
f329aab
Compare
|
I reproduced the reported cache observation on The rollback contract here restores the transaction-local loaded view, including bounded or deliberately selected state; it does not promise automatic freshness after an aborted transaction. The reported observation does not establish data loss or incorrect next-parent persistence. The existing view snapshot and reverse-order rollback owner intentionally preserve that boundary. Skipping rollback enlistment for A fresh independent review of the full PR found no actionable P2 issue and agreed that the proposed post-abort freshness requirement was not established. I’m retaining the production implementation and preparing the additional provisional-replay regression for the next update. The current CI failure is a separately owned Codex retry-timer assertion; its original log and test order are retained for diagnosis rather than an unchanged retry. |
27d01fd to
c98913a
Compare
|
/allow-security-sensitive-change |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…#159807) * fix: restore session state after nested transcript rollback * test: cover rollback after provisional user replay * refactor(sessions): isolate transcript write snapshots
What Problem This Solves
A transcript transaction could roll back a nested append while its SessionManager still retained the deleted entry and selected it as the next message’s parent.
User Impact
Retries after a rejected transcript write use the restored conversation state. Nested synchronous reads and successful writes remain visible within their enclosing transaction. Target changes are checked before commit, preserving the selected target’s view. No schema, stored format, or public API changes are required.
Why This Change Was Made
Enlist the manager’s loaded view with the existing SQLite transaction-state owner. Reverse-order restoration preserves nested writes, bounded and deliberate branches, lazy headers, same-target reloads, and provisional keyed replay. Ordinary top-level appends add no SQL read or view copy. The private snapshot kernel retains the existing transaction sequence while keeping the writer within its line limit.
Evidence
The original 12-case regression file fails nine cases on pre-fix production and passes after the repair. A further provisional keyed-replay case also fails causally on the original code. The final candidate passes 13 rollback and nine idempotency cases, with zero unhandled errors, using real incognito and file-backed SQLite. Earlier focused hydration, target, and bounded-view coverage passed 69 cases; broader sibling proof is retained.
The exact six-file candidate passes selected session types, typed lint, formatting, both line-cap checks, and fresh independent P2 review. Final source hashes match the published tree. The snapshot-kernel extraction preserves its function body byte-for-byte apart from its export.
Measured on Linux x64, Node 24.19.0: the 22-case Vitest run took 11.66 seconds. The rollback module took 11.26 seconds from queue to end, including 7.59 seconds of suite execution with hooks. The maintained test command took 26.17 seconds, including worker preparation and verification. These are elapsed measurements, not summed test-body durations.
Exact-head CI run 36362124382 stopped at one independently attributed main-only installer assertion: it expects
assert-release-versionsin the top-level smoke script after main extracted that implementation into a sourced helper. The test, script, and helper are byte-identical in the actual tested main parent and merge. Other tooling groups passed 2,126 cases; the run’s 117 canceled jobs remain missing coverage. Scoped passing proof does not turn that CI result green.