Repository navigation
fix(sessions): preserve rollback-journal commit waits - #160887
Conversation
Follow up #160801. Keep BEGIN admission yielding while restoring the original native timeout before the synchronous write and COMMIT, so session patches retain their bounded chance to commit after a rollback-journal reader finishes.
|
🦞👀 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 28, 2026, 10:03 PM ET / September 29, 2026, 02:03 UTC. ClawSweeper reviewWhat this changesThe PR restores the SQLite connection’s bounded commit wait for session-entry patches, adds a regression case, and updates the database-access documentation. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open. Current main still has the commit-time timeout problem, and the merged writer-admission PR does not cover this rollback-journal case. The proposed repair is narrow and remains useful. Priority: P2 Review scores
Verification
How this fits togetherSession-entry patches turn agent activity into rows in an agent’s SQLite database. A writer queue admits each patch, SQLite commits it, and post-commit publications refresh session state. flowchart LR
A[Session patch] --> B[Writer queue]
B --> C[SQLite writer admission]
C --> D[Session row update]
D --> E[SQLite commit]
E --> F[Published session state]
G[Connection timeout] --> C
G --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -2, Tests +33, Docs +2. Total +33 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Preserve yielding BEGIN admission and the connection’s bounded COMMIT policy within the existing session writer owner. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows why a rollback-journal reader can make COMMIT fail immediately, and the PR reports a before-and-after native probe; this reviewer did not execute it. Is this the best way to solve the issue? Yes. Removing the redundant outer timeout scope lets the existing transaction owner restore the connection policy without changing queueing, authority checks, or stored data. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6b3033b65ca9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Follow up openclaw#160801. Keep BEGIN admission yielding while restoring the original native timeout before the synchronous write and COMMIT, so session patches retain their bounded chance to commit after a rollback-journal reader finishes.
What Problem This Solves
Follow-up to #160801: a rollback-journal reader could make a session patch fail immediately at COMMIT, even if it released the read lock within the existing busy timeout.
User Impact
Session patches retain nonblocking write-lock admission and regain the existing bounded commit wait on rollback-journal storage. Schemas, configuration, durability, and update behavior are unchanged. Commit waiting remains synchronous and retains its existing bounded policy.
Why This Change Was Made
The existing admission helper temporarily sets a zero timeout for BEGIN, then restores the original connection policy before the synchronous callback and COMMIT. The adapter's redundant outer zero-timeout scope made that restoration restore zero. Remove that override and report the actual original policy in diagnostics. FIFO, connection/authority checks, synchronous callbacks, and non-replay stay with their existing owners.
Evidence
Blacksmith Testbox (
blacksmith-testbox,openclaw-check) leasetbx_01m3nbpgcvkhfchrjnwhjkhqkq(run):SQLITE_BUSYafter 9.3 ms, unchanged row, one callback. After: committed after 109.0 ms, updated row, one callback, original 5,000 ms budget retained. The timer exists only in this one-off proof, not the CI regression.The original performance measurement remains 262.19 ms → 0.94 ms event-loop callback delay under writer contention. This follow-up changes only the admitted write/commit policy, retaining the yielding BEGIN path.
Independent Codex autoreview is scoped-clean with no actionable P0–P2 findings.
node scripts/check-changed.mjs --base d4be6500114cff6fcbf72f323fc520861a06c6c9 -- <three changed paths>andpnpm lint:tmp:sqlite-transaction-boundaryboth passed, including all selected core test typecheck shards.Measured cost:
pnpm test src/config/sessions/session-accessor.sqlite-entry-revalidation.test.ts --maxWorkers=1passed 38 tests in 11.35 s wall (the added case: 118 ms including fixture). The Testbox lease is stopped.