Repository navigation
fix(update): check snapshot capacity before staging - #147908
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. Reviewed September 14, 2026, 7:26 AM ET / 11:26 UTC (Revision 5). ClawSweeper reviewWhat this changesThe updater checks known state-snapshot space before staging package or Git replacements, reports capacity diagnostics, and preserves already-current updates. Merge readiness✅ Ready for maintainer review This remains useful work beyond current main. The earlier findings are resolved, the qualification evidence remains applicable to the unchanged source tree, and no actionable patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw validates updates against a private copy of operator state before replacing the running installation. This change checks the snapshot owner's existing space requirement earlier, using local database sizes and destination free space. flowchart TD
A[Requested update] --> B{Already current?}
B -->|Yes| C[Skip replacement]
B -->|No| D[Measure known database families]
D --> E{All destinations have known shortfall?}
E -->|Yes| F[Report refusal before staging]
E -->|No| G[Stage replacement]
G --> H[Complete snapshot and candidate validation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +190, Tests +216, Docs +6. Total +412 across 11 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the early assessment within the existing snapshot owner, preserving best-effort warnings, no-op updates, and complete post-staging validation. Do we have a high-confidence way to reproduce the issue? Yes, from source: a non-current update with insufficient space at every snapshot destination reaches the existing check only after staging. The supplied regression results establish that ordering failure; no runtime reproduction was executed in this review. Is this the best way to solve the issue? Yes. Reusing the existing snapshot budget and allocator destinations avoids competing estimates, while the narrowed refusal preserves advisory behavior and already-current updates. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f4ffd8c21fcd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Estimate installation, config-copy, and initial canary snapshot costs on their actual filesystems before staging. Preserve the full post-staging inventory and warn when capacity estimates are incomplete.
Build on the target-resolution warning checkpoint from #147883. Reuse the snapshot owner’s known SQLite-family budget and placement policy; refuse only a known shortfall at every eligible destination and record warnings otherwise. Preserve no-op updates and the complete post-staging check.
c236978 to
d2ce6ba
Compare
|
@clawsweeper re-review The branch received one empty CI refresh commit after the main gate repairs landed. The reviewed source tree is unchanged. The PR Evidence section now contains the completed published-updater round trip and constrained-filesystem qualification requested by the last review. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
Updates can stage a replacement before discovering that no eligible filesystem can hold the required private state snapshot. Requested by Vyctor (@vyctorbrzezowski) in Discord #maintainers.
Builds on / complements #147883, merged as e7f19d4. This branch is rebased onto main containing that change. Refs #117415 and #118886.
User Impact
Before staging, the updater reports exact bytes for each known SQLite family and the snapshot requirement versus free bytes at each eligible destination. It refuses only when every destination has a known shortfall under the snapshot owner's existing capacity requirement: the private state copy cannot be taken safely. Unknown capacity, incomplete measurements, or a usable alternative remain warnings and proceed to the existing complete check after staging.
Package-space warnings remain advisory under #147883. Already-current package and Git targets keep their no-op behavior. An already-installed 2026.9.3 updater can still fail late on its own first hop because this check runs in the installed driver.
Why This Change Was Made
Reuse the snapshot owner's initial inventory, sizing, and placement policy: twice the known SQLite-family bytes, three times the largest family, and the existing 64 MiB metadata allowance. Families include database, WAL, SHM, and journal files. The destinations remain TMPDIR, the capture directory beside state, and the system temporary directory; a state-directory mount does not imply its sibling is on the same filesystem.
Package replacements consume this assessment in target resolution after no-op detection. Git consumes the same assessment after its resolved no-op check and before worktree allocation; package-to-Git conversion checks before cloning. Diagnostics use the existing run ledger and warning projection. The full candidate inventory and post-staging check are unchanged.
Plugin copies and registered external databases remain explicitly unknown at this early point. The updater preserves a config copy, not a full-state backup. This diff adds no package/source-size estimator, configuration option, database schema, protocol, retention policy, or UI changes.
Evidence
pnpm check:changedpassed in full on the final committed diff (production/test types, changed-file lint, formatting, dead exports, and all selected guards). An earlier whole-core lint run also found an unrelated existing max-lines failure atui/src/test-helpers/app-sidebar-cases/session-ownership.ts:765; that file is byte-identical to the rebase base.57a02a0faf69bcd495fd5274839a5a40f2cf2dc5: run 34836629616, attempt 2. The first attempt hit a Gatewayconfig.patchrequest timeout and anENOTEMPTYmemory-watcher cleanup failure in owners byte-identical to the tested main parent; both passed one failed-job rerun with unchanged source and test settings. The earlier lint, startup-budget, and ClawHub fixture gates also passed. Both empty CI refresh commits preserve the source tree used by the regression and live qualification below.2026.9.3 → candidate → futurepassed through the canonicalpnpm test:docker:update-first-hop-compatlane on Blacksmith Testboxtbx_01m2fask4dd7ycv7hr5hpcyqq8(run). Both hops exited 0, preserved active service intent, and left zero residue; the future updater ran without legacy compatibility chunks. The wrapper verified sourced2ce6bafe4c6706d0a400f21e48ef5d8e46288f8and its exact tree before building the frozen package.tbx_01m2fbg961smc6d50fmw6qjwcf(run), using this exact source tree. All three snapshot destinations were bounded 64 MiB tmpfs mounts: the updater reported 74,993,664 bytes needed versus 66,990,080 / 67,108,864 / 67,092,480 bytes free, named both SQLite families, refused before staging, persistedsnapshot-capacity-insufficient, and preserved config/runtime hashes. The final harness also verified the ledger's normal path redaction.L326_RESULT=passed; wrapper exit 0; lease stopped. An earlier harness run stopped on the unredacted-path expectation, which was corrected without product changes. Testbox backing Actions runs can show cancellation after successful delegated cleanup.Release-note context: updates report state-snapshot capacity before staging and refuse only a known all-destination snapshot shortfall, preserving best-effort warnings otherwise.
Regression commands and trimmed results
With the rebased-main target owner temporarily restored:
node scripts/run-vitest.mjs src/cli/update-cli.test.ts -t 'checks initial snapshot capacity before staging'With the fix, plus the advisory-package and no-op controls:
node scripts/run-vitest.mjs src/cli/update-cli.test.ts -t 'checks initial snapshot capacity before staging|records low disk space before target lookup|keeps an explicit same-version channel no-op'ClawSweeper review
The completed 11:26 UTC review covers this exact head, accepts the retained published-updater and constrained-filesystem qualification, and finds no actionable defect. Earlier installation-size and Git no-op findings were already resolved in the reviewed source. No additional code fixups or skipped findings were needed. One re-review request was posted after the first tree-identical CI refresh.