Repository navigation
fix(sqlite): let nested page reclamation finish - #201557
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. What this changesThis PR lets background SQLite reclamation reuse its active foreground writer admission instead of waiting for that writer to drain. Example: Archive pruning holds the database writer and awaits reclaiming up to 7 free pages while another writer is queued.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a source-verifiable self-deadlock that remains on fetched main; no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe agent database admission owner orders foreground writes and background SQLite worker operations; reclamation enters through the session storage layer and returns checkpoint and vacuum results. flowchart TD
A[Session archive pruning] --> B[Foreground writer admission]
B --> C[Nested page reclamation]
C --> D[Background admission]
D --> E[Existing reentrant reservation]
E --> F[SQLite worker]
F --> G[Checkpoint and vacuum receipt]
Technical reviewBest possible solution: Keep the narrow exception in the existing admission owner so nested reclamation can finish without changing ordinary background precedence. Do we have a high-confidence way to reproduce the issue? The existing WAL fixture and current-main control flow establish the circular wait; no target code was executed during this read-only review, and the historical timeout log could not be inspected. Is this the best way to solve the issue? The defect is waiting for a drain that includes the awaiting caller. The invariant is that nested work may reuse its active foreground admission while unrelated background work yields. This patch is the smallest complete repair using the existing queue, context and reservation owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 053fb62c6141. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +8. Total +8 across 1 file. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 18, 2026, 8:57 PM ET / November 19, 2026, 01:57 UTC. |
|
Merged via squash auto-merge.
|
#201557) (cherry picked from commit 60ab512) Co-authored-by: RomneyDa <[email protected]>
openclaw#201557) (cherry picked from commit 60ab512) Release adaptation: Preserve source guard; add real nested queue regression with abort cleanup. Baseline hangs;26/26green. Co-authored-by: RomneyDa <[email protected]>
#201557) Baseline adaptation: Keep the production reservation change as upstream and add a baseline regression using the foreground writer owner and a bounded abort. (cherry picked from commit 60ab512) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Nested SQLite page reclamation can wait for the foreground writer that is awaiting that same reclamation, leaving the operation and cleanup stuck. The existing WAL regression timed out on main.
User Impact
Background reclamation requested by an active foreground writer can proceed through the existing reentrant admission path. Normal background work still waits for queued foreground work. No schema, retention, or authority policy changes.
Why This Change Was Made
Skip the preliminary background drain only when the current async context already owns the same physical database queue and its holder is a foreground writer. The existing reservation still checks reentrancy, identity, cancellation, and permitted keys; worker callbacks cannot borrow a worker holder.
Evidence
reclaims pages off-thread and applies current checkpoint receipts (reclaim), with a 120-second test timeout and 180-second cleanup timeout.c027899907abc325f11a7ce5b47e316a166b4899..4b4afe3c735befdac35efcdb185bf9a9c2c42dfdfound no correctness or security findings (confidence 0.90).Exact local proof commands
The tests retain their original assertions and deadlines. The existing failing regression was reused; no duplicate test or test-only production seam was added.