Repository navigation
fix(backup): refuse restores that exceed target capacity - #164492
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 October 3, 2026, 3:47 PM ET / 19:47 UTC. ClawSweeper reviewWhat this changesThe PR measures regular-file archive bytes and refuses full restores before target creation when available space cannot cover the payload plus a 256 MiB reserve. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: the restore safeguard is absent from current main and the latest release, and no introduced correctness defect was found. The MEMBER-authored PR also requires explicit maintainer handling. Priority: P2 Review scores
Verification
How this fits togetherFull backup restore verifies a local or downloaded archive, then extracts it into a fresh staging directory. The new capacity check controls admission to extraction without activating or rewriting live state. flowchart TD
A[Local or downloaded backup] --> B[Archive verification]
B --> C[Regular file byte total]
D[Target volume free space] --> E[Payload plus reserve fits]
C --> E
E -->|Yes or measurement unavailable| F[Fresh staging extraction]
E -->|No| G[Actionable capacity error]
Decision needed
Why: This intentionally changes an existing recovery path; source correctness cannot determine whether preserving host headroom outweighs allowing that restore. Before merge
Agent review detailsSecurityNone. PR surfaceSource +47, Tests +76. Total +123 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep capacity admission in the restore owner, with an explicitly accepted reserve policy and best-effort behavior when measurement is unavailable. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main starts full extraction without checking whether the archive fits its target volume. No runtime reproduction was executed in this read-only review. Is this the best way to solve the issue? Yes for the implementation boundary: reuse the existing filesystem probe and carry archive inventory into restore admission. The unconditional reserve remains an explicit recovery-policy choice. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fe6414a23399. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Related: #125416
What Problem This Solves
Fixes: a full backup restore can fill the target filesystem before failing when the uncompressed archive does not fit.
User Impact
User impact: operators get an actionable capacity error before OpenClaw creates or extracts into the restore target.
Why This Change Was Made
The verified archive inventory now carries its regular-file extraction size into restore admission. Restore requires that size plus a 256 MiB safety reserve on the target volume; hardlinks do not count their referenced data twice. If filesystem capacity cannot be determined, restore keeps the existing best-effort behavior.
Evidence
pnpm test src/commands/backup-restore.test.ts --maxWorkers=1: 21/21 passed; Vitest duration 19.82s, wall time 25.02s.git diff --checkpasses.