Repository navigation
fix: state migration leases target a retired database - #159757
vincentkoc wants to merge 1 commit into
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: blocked before merge. Reviewed September 27, 2026, 12:13 PM ET / 16:13 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch records each shared SQLite worker’s database admission, retires workers tied to an invalidated database, and prevents a lazy worker from opening a removed or replaced original file. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 6 items remain Keep open. Current main addresses stale-worker reuse, but this branch adds a useful lazy-open safeguard. Its retirement path needs correction before integration. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw routes plugin state, lease, and migration requests through a shared SQLite worker owner. Database admission selects the worker, which then reads or writes the state database. flowchart LR
A[Plugin and migration requests] --> B[Database admission]
B --> C[Shared worker owner]
C --> D{Original database current?}
D -->|Yes| E[SQLite worker]
D -->|No| F[Retire stale worker]
E --> G[State database result]
F --> B
Decision needed
Why: Current main deliberately specifies immediate refusal; changing that operator-visible waiting behavior requires the state owner’s intent even after the deadlock is fixed. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +49, Tests +220. Total +269 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one lifecycle owner for database-generation fencing, retain the lazy-open identity guard, and preserve callback-safe replacement behavior with a verified upgrade handoff. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s real-worker test defines a nested active-callback replacement, and the branch’s new wait plus broker settlement show that this scenario would self-deadlock; this read-only review did not execute it. Is this the best way to solve the issue? No, not as submitted. The database-generation and lazy-open guards fit the existing owners, but retirement must preserve a callback-safe path before the branch can integrate. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c4e67604df4d. 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 (1 earlier review cycle)
|
|
Closing as superseded by the merged replacements:
Rechecked original head Main retains independent database-generation admission, callback-safe actor retirement, lexical-scope reuse and unexpected-error propagation. Existing-only factories carry their admitted file identity to native opening, including device identity and the separate existing-schema lease writer. An independent complete test-coverage comparison found no unique useful regression left behind: retirement and callback admission, lazy removed/replaced paths and surviving hardlinks, and shared-actor ownership cases. Main's consistent same-inode relocation fixtures replace the original synthetic metadata disagreements while retaining the observable protections. This is a current-source supersession decision, not a new test execution or a claim that the original disk-full cleanup succeeded. Existing branches, checkouts and proof artifacts are retained. |
What Problem This Solves
Fixes: state migrations lose their lease when a retired database's filesystem identity is reused by another database while its lazy worker is still retained.
User Impact
Database operations stop reusing invalidated workers, and a lazy worker refuses a removed or replaced original database instead of recreating it. No schema, configuration, or public API changes are required.
Why This Change Was Made
The database lifecycle already invalidated the old admission, but shared-worker selection checked only the physical file key. Record that canonical lifecycle admission once at worker entry creation, then retire and join the exact stale actor before reuse. Keep it separate from the caller's short-lived schema admission so successive valid schema scopes can share the same worker.
The existing-only backend also checks its captured identity at the first native open. Aliases retain their existing sharing behavior; there is no automatic alias retargeting or fallback.
Known boundary: external same-path, same-inode replacement without canonical lifecycle invalidation remains a separate follow-up. Raw birth timestamps cannot safely establish a universal file generation.
Evidence
5f623a384410d1f8a00a28413b54ac8655df5354; treef94140e32e968917dc57a0fcb65b685ea6d0b984.a70be26b47560ede9b7646451e66e3f735195672: 127 passed and two pre-existing Node-only topology skips.58eb3fb2eddda3435942b05bd4d4fa716459fbd348d602ffa00f38db1ce2a8c3.The two Bun skips assume four shared carriers, which does not match Bun's existing dedicated-worker topology; no new skip was added. Dedicated-slot saturation coverage is a separate follow-up. The maintained Bun run's known directory-FD warning is repaired separately in openclaw/bun#16; it did not fail these tests.
Proof cost
One Testbox lease, observed queued at 15:01:43 UTC and stopped at 15:36:32 UTC on 2026-09-27. The passing native command took 28m2.580s; focused file wrappers totaled 5m54.345s and changed gates took 21m20.162s. An earlier pre-test observer assertion incorrectly compared the transport parent to the source branch parent; it failed before tests, was corrected to the receiver-installed transport base, and reused the same immutable source and lease.