Repository navigation
fix(sqlite): retain healthy handles after automatic rollback - #157241
Conversation
Co-authored-by: steipete <[email protected]>
|
🦞👀 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 24, 2026, 7:34 AM ET / 11:34 UTC. ClawSweeper reviewWhat this changesThe branch lets SQLite transaction cleanup retain an open handle after a pre-commit automatic rollback and adds native disk-full and post-commit failure regressions. Merge readiness✅ Ready for maintainer review Current main still closes the SQLite handle after an automatic outer rollback. The focused patch addresses that behavior, and the source review found no blocking defect. Priority: P2 Review scores
Verification
How this fits togetherSQLite transaction helpers wrap reads and writes to OpenClaw’s local databases. They settle native transactions and coordinate staged state before callers reuse a connection. flowchart LR
A[Store operation] --> B[Transaction helper]
B --> C[Native SQLite transaction]
C --> D{Failure phase}
D -->|Transaction ended before commit| E[Discard staged state]
E --> F[Reuse open handle]
D -->|Commit started or state uncertain| G[Fence handle]
C -->|Success| H[Publish committed state]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +13, Tests +77. Total +90 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: A failed outer write should leave its handle reusable only when SQLite ended the transaction before commit processing; staged state must be discarded, while uncertain commits remain fenced. Do we have a high-confidence way to reproduce the issue? Yes. The native max-page-count case gives a concrete SQLITE_FULL path, and current main’s unconditional cleanup explains the closed handle; this read-only review did not run it. Is this the best way to solve the issue? Yes. The patch changes the existing transaction owner and preserves fencing once commit processing starts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a533ff8f836e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash auto-merge.
|
…w#157241) Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes otherwise usable SQLite connections being closed after SQLite automatically rolls back a failed outer transaction, which can invalidate retained read admission during fallback recovery.
User Impact
A failed write is still reported without replay, but subsequent operations can reuse the same healthy database connection. Nested rollback failures and errors after commit starts still fence the handle. No schema, persistence contract, corruption policy, or configuration changes.
Why This Change Was Made
Before commit begins, an open handle with no active transaction means cleanup has no transaction left to roll back. Discard its staged state/publications rather than treating the redundant ROLLBACK error as a broken connection. Track entry into commit processing separately so a durable commit followed by an owner failure cannot take that recovery path.
Requested by Peter Steinberger during release-regression verification.
Worked on by
Work sessions
Evidence
Limit: the original packaged Gateway quota E2E replay did not reach test execution because its private-QA build was blocked by a separately diagnosed declaration-root problem. The native transaction boundary is proven; this is not a claim that the complete Gateway fallback flow or full release validation passed.
View the OpenClaw team session