Repository navigation
fix: preserve snapshot cleanup after parent token contention - #161372
Conversation
A failed parent read-token admission happens before any child directory is created. Record that definite allocation refusal with the existing owner marker while preserving the original error and SQLite contention prefix. Keep unknown allocation custody for lost replies and post-creation failures. The real parent-lock control failed on the original cleanup result; the candidate passed 72 Node cases and four Bun cases. Registered-worker controls preserve the released two-field failure shape and old contention decoder. Full selected checks and fresh independent review passed. Node/Bun proof is on macOS; unchanged Windows creation mechanics are not requalified here. Related: #144592
|
🦞👀 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 29, 2026, 6:33 PM ET / 22:33 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch lets SQLite snapshot cleanup recognize parent-token contention before directory creation, preserves the retry signal, adds custody tests, and adds first-signin timeout diagnostics. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: current main still has the reported cleanup gap, and the focused repair has convincing production-boundary proof. No code defect was found in this review. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw creates private SQLite snapshots in a child process for read-only storage work. A native resource owner tracks allocated directories and settles their cleanup after the child closes. flowchart LR
A[Snapshot request] --> B[Parent token admission]
B --> C[Child directory creation]
B --> D[Worker failure reply]
C --> E[Native custody owner]
D --> E
E --> F[Child close]
F --> G[Cleanup outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +333. Total +341 across 8 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep native staging custody with its existing owner: recognize only proven pre-creation refusals as empty allocations, preserve contention retries, and retain conservative cleanup for lost replies and post-creation failures. Do we have a high-confidence way to reproduce the issue? Yes, from source and the submitted real-child test: hold the parent token database under an exclusive lock, request a nested snapshot, then close its native owner. The reviewer did not execute the test. Is this the best way to solve the issue? Yes. The patch extends the existing refusal marker and custody owner while preserving the contention error and unresolved handling for failures after creation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dc50ffd8a4a5. LabelsLabel changes: No label 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
History |
Record fixed request and progress categories with elapsed times in the existing abort report. Check browser/testing suffixes before the retained device-code presentation, and count the independent catalog refresh. Keep setup order, responses, assertions, and the 90-second deadline intact. The Linux timeout remains under investigation; this adds failure evidence without logging URLs, messages, device codes, payloads, or context objects. Validated the focused flow, gateway-root types, scoped lint/format, and independent review. The local passes do not clear the original Linux failure.
|
Merged via squash.
|
…w#161372) * fix: preserve snapshot cleanup after parent token contention A failed parent read-token admission happens before any child directory is created. Record that definite allocation refusal with the existing owner marker while preserving the original error and SQLite contention prefix. Keep unknown allocation custody for lost replies and post-creation failures. The real parent-lock control failed on the original cleanup result; the candidate passed 72 Node cases and four Bun cases. Registered-worker controls preserve the released two-field failure shape and old contention decoder. Full selected checks and fresh independent review passed. Node/Bun proof is on macOS; unchanged Windows creation mechanics are not requalified here. Related: openclaw#144592 * test(gateway): clarify first-signin timeout phases Record fixed request and progress categories with elapsed times in the existing abort report. Check browser/testing suffixes before the retained device-code presentation, and count the independent catalog refresh. Keep setup order, responses, assertions, and the 90-second deadline intact. The Linux timeout remains under investigation; this adds failure evidence without logging URLs, messages, device codes, payloads, or context objects. Validated the focused flow, gateway-root types, scoped lint/format, and independent review. The local passes do not clear the original Linux failure. Co-authored-by: Peter Steinberger <[email protected]>
Related: #144592
What Problem This Solves
A parent snapshot token can reject a new allocation before any child directory is created, yet later cleanup reports an unresolved allocation and prevents existing snapshots from retiring normally.
User Impact
A temporary parent-token lock retains its original SQLite contention error and existing retry behavior. Cleanup can finish after the actual child exits when the owner knows that no directory was allocated.
Why This Change Was Made
Extend the existing definite-refusal marker to parent-token admission, preserving the original error object and codes. Carry contention and allocation refusal together through the existing two-field reply, with the old contention prefix first. Reuse the existing native custody owner; lost replies and failures after creation still retain unresolved cleanup custody. The independent Windows directory-creation mechanism, storage schema, retention policy, and protocol version are unchanged.
Evidence
A real parent database held under an exclusive lock reproduced the original cleanup rejection after native child exit. The repaired candidate passed all 72 Node cases across the three owning files and four Bun cases, including real child close, concurrent/nested snapshot lifetimes, the missing-parent refusal, and a failure injected only after actual directory creation. The post-creation failure remains unresolved as required. Registered-worker controls preserve the exact
{ok, message}result and the existing parent contention decoder; the original four combined-fact creation rows fail before the repair while ordinary sync/async contention controls pass.The Node selection used
node scripts/run-vitest.mjs --config test/vitest/vitest.infra.config.ts --reporter=verbose src/infra/sqlite-readonly-location.worker.test.ts src/infra/sqlite-readonly-native-resource.test.ts src/infra/sqlite-snapshot-staging.ownership.test.ts, with two workers, and took 41.55 seconds of wrapper wall time. The focused four-case Bun selection took 17.13 seconds. These are group timings, not standalone file or CI timings. Proof used macOS arm64, Node 24.21.0 and Bun 1.4.2; no fresh Windows or full published-updater executable replay is claimed.The complete selected check passed: core and all 27 test type graphs, three unused-export scans, scoped lint, runtime import-cycle checks, and source guards. Fresh independent review of the complete seven-file change and its owners found no actionable issue. Hosted CI remains separate from these local results.
The first hosted run failed in two separate test roots. The task-replacement pair was independently reproduced on the unchanged baseline and repaired by canonical commit
4cd32ee5657b. The first-signin 90-second timeout did not reproduce in the unchanged single test or original nine-file cohort locally; its cause remains unclassified. This head carries canonical failure-only diagnostics fromc4461b537ce3to distinguish sign-in progress and request phases. Responses, setup order, assertions, and the deadline remain unchanged. Final hosted CI36636502407 passed at0be5e7eb95d9; the diagnostic change is not claimed as a timeout fix.