Repository navigation
fix(update): stop schema admission when snapshot cleanup fails - #156265
Conversation
Preserve inspection and cancellation errors while collecting admission-close, native-close and owned snapshot cleanup failures. Await asynchronous cleanup and refuse further schema admission when retirement returns false. Extract the reviewed cleanup slice from the original update-capture work; do not carry its backup, restoration or publication changes. Source-Commit: 4146d06 Original-PR: #144005
|
🦞👀 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 23, 2026, 3:50 AM ET / 07:50 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR makes database schema checks reject failed snapshot cleanup while preserving earlier inspection or cancellation errors, with focused update-caller regression tests. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, focused fix absent from current main and the latest release. No actionable correctness defect was found. The previous migration-proof blocker does not apply because the patch changes no stored-data contract; the member author explicitly records acceptance of the stricter cleanup behavior. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw checks database compatibility before updates, Doctor operations, and startup proceed. These checks inspect private SQLite snapshots, then close readers and retire temporary files before returning their results. flowchart TD
A[Update or startup request] --> B[Database schema checks]
C[Existing SQLite database] --> D[Private inspection snapshot]
B --> D
D --> E[Close reader and await cleanup]
E --> F{Cleanup succeeded?}
F -->|Yes| G[Return schema results]
F -->|No| H[Stop and preserve errors]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +44, Tests +280. Total +324 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep cleanup settlement with the existing snapshot owner and preserve all failure causes before allowing schema checks to continue. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: cleanup can return false while current-main schema preflight continues, and cleanup exceptions can replace earlier errors. The submitted regressions target those paths; this review did not execute them. Is this the best way to solve the issue? Yes. The patch reuses the existing snapshot lifecycle and error aggregator, preserves successful behavior, and implements the explicitly accepted refusal contract without changing persistent data. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fdf8d86f8f56. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Refresh exact-head CI after main 813a10e fixed the route-loader TS2322 blocker. Preserve the reviewed schema-cleanup patch and original contributor ancestry; no UI changes.
|
Merged via squash auto-merge.
|
…law#156265) * fix(update): refuse schema admission when snapshot cleanup fails Preserve inspection and cancellation errors while collecting admission-close, native-close and owned snapshot cleanup failures. Await asynchronous cleanup and refuse further schema admission when retirement returns false. Extract the reviewed cleanup slice from the original update-capture work; do not carry its backup, restoration or publication changes. Source-Commit: 4146d06 Original-PR: openclaw#144005 * test(update): cover owned snapshot removal failure recovery * chore(update): requalify schema cleanup after upstream type repair Refresh exact-head CI after main 005cbdc fixed the route-loader TS2322 blocker. Preserve the reviewed schema-cleanup patch and original contributor ancestry; no UI changes.
Original atomic-update tracking
Tracked in the maintained split indexes on #144005 and #145169. This PR retains its own dedicated Atomic update workers session. Its component completion does not by itself close the originals or prove the complete no-loss recovery journey.
What Problem This Solves
Fixes updates proceeding after their schema-inspection snapshot could not be cleaned up, or reporting only a cleanup error while losing the original inspection or cancellation error.
User Impact
Updates stop before further schema admission when owned snapshot cleanup fails. Original failures remain available alongside cleanup failures. Successful cleanup and existing reader settlement behavior are unchanged; no database schema, backup-retention, or recovery-publication change.
Why This Change Was Made
Collect cleanup failures after closing the schema reader, await the snapshot owner's asynchronous cleanup, and require its success before proceeding.
This is the narrow schema-cleanup successor extracted from #144005, originally opened by @steipete, with the cleanup implementation from
4146d06f8a3208222189d14af897325d4daa4fb3by @fuller-stack-dev. It is a prerequisite for #155544, not a replacement for the remaining capture/recovery work. Related: #145169. Reuses the already-landed async cleanup and reader-settlement implementations.Evidence
Cleanup-failure contract and review follow-up
The requested boundary is strict: every false or rejected owned-snapshot cleanup blocks subsequent schema admission, including an ordinary removal failure after readers have retired. This consciously aligns the global-state path with the existing agent-snapshot cleanup check; it is not a change to the shared snapshot API or its other best-effort callers. The diagnostic keeps the owned path, and the source database is not mutated. A new focused filesystem-fault case injects EACCES only for the owned snapshot directory, verifies refusal and unchanged source bytes, then removes the fault and verifies successful retry and cleanup.
This is the disposition of ClawSweeper's compatibility question from run35826509816. The stricter refusal is intentional for this separately assigned cleanup prerequisite; warning-only continuation on
falsewould violate that contract. This leaf makes no schema migration, driver-marker, service activation, backup-retention, or recovery-publication change. Its authorized acceptance scope is isolated caller/snapshot behavior, not a full installed published-driver upgrade or native no-loss cell; those broader checks are not claimed here.Requalification after upstream repair
Head
81d1f342preserves the original contributor ancestry and the exact three-file source/test tree fromaa293cd3. Its metadata-only refresh requests fresh CI against main after813a10e7repaired the unrelated route-loader TS2322. No UI change is included.The patch was also applied unchanged to repaired main
4adc92df: both commits were patch-identical by range-diff, all ten focused tests passed (72.89s wrapper wall, including 57.28s worker compilation; individual cases 8–56ms), scoped lint reported zero warnings/errors, and 16 changed-file checks passed. The existing canonical-global-store compiler guard still prevents local type gates; current-head CI owns the remaining proof. The prior six-failure baseline and independent API review are reused for the unchanged patch, not presented as a completed current-head CI result.Stored-data review disposition: the earlier bot summary flagged
unknown-data-model-changesolely at the existing schema-preflight path, while its technical review explicitly found no schema, stored-data representation, dependency, or authorization-contract change. This patch changes only cleanup settlement and error aggregation around an existing read-only inspection. It adds no SQL/schema/version/migration changes, and focused success/failure/retry tests assert unchanged source-database bytes. Thus no data-model migration is introduced. The stricter cleanup-refusal behavior and its accepted isolated-component proof scope remain as stated above; no published-driver or complete no-loss upgrade proof is claimed.