Repository navigation
feat(update): offer to remove old recovery copies when an update is short on space - #196873
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 real behavior proof before merge. What this changesThis PR offers interactive removal of eligible recovery copies when an update lacks disk space, then checks capacity again. Example: An update needs more space and an older successful update has a superseded recovery copy.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: the guided cleanup is useful and maintainer-authored, but approval can delete recovery originals that the prompt never listed. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe CLI update preflight measures snapshot and activation capacity; this change connects a shortfall to the existing recovery inventory and routes deletion through the Gateway or exclusive offline state owner. flowchart TD
A[Update CLI] --> B[Capacity assessment]
B --> C[Recovery inventory]
C --> D[Interactive confirmation]
D --> E[State owner routing]
E --> F[Recovery retirement]
F --> B
Technical reviewBest possible solution: Keep the existing inventory and retirement owners, but bind both local and Gateway deletion to the exact verified selection the user approved. Do we have a high-confidence way to reproduce the issue? Source establishes the failure path: combine one listed candidate with a verification-required historical original whose import verifies successfully; approving the prompt reaches manual retirement that selects both. Is this the best way to solve the issue? Reusing cleanup eligibility and state ownership is appropriate, and the target-space extraction serves the existing line limit; the missing invariant is that final deletion must stay within the approved selection. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6f18dd48112d. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The new destructive confirmation does not preserve the user's approved artifact scope through the final cleanup owner. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +193, Tests +200, Docs +12, Other +2. Total +407 across 10 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 4:43 PM ET / 21:43 UTC. |
… short An update that would refuse for lack of space now lists the recovery copies that update cleanup already counts as retirable. In a terminal it asks before removing them and checks space again; --yes, --json and Gateway-driven updates never remove them and name their size in the refusal instead. The target phase's space check moves to a sibling module.
93d8d8c to
521a4a3
Compare
… short (openclaw#196873) An update that would refuse for lack of space now lists the recovery copies that update cleanup already counts as retirable. In a terminal it asks before removing them and checks space again; --yes, --json and Gateway-driven updates never remove them and name their size in the refusal instead. The target phase's space check moves to a sibling module.
What Problem This Solves
Fixes: an update refuses with
snapshot-capacity-insufficientwhen the disk is short, even when old recovery copies from earlier updates are using the space and could already be removed.User Impact
User impact: when space is short, an interactive
openclaw updatelists the recovery copies thatopenclaw update cleanupalready counts as retirable, with their sizes. It asks whether to remove them permanently, defaulting to no. On yes, it removes them and checks space again before changing anything.--yes,--json, updates without a terminal, and Control UI updates never delete anything. Their refusal names the reclaimable size and the next step.Why This Change Was Made
update.recovery.cleanuphandler, or local offline ownership when no Gateway runs.update-command-target-space.tsto keepupdate-command-target.tsunder its line cap.Evidence
src/cli/update-cli/update-command-package-space.test.tsdrivesupdateCommandwith a real shortfall and a superseded copy. The JSON refusal now names1 recovery copy from earlier updates … can be removed. This fails on main and passes here; nothing is removed and staging never starts.src/cli/update-cli/update-snapshot-space-cleanup.test.tsuses real recovery copies and the real cleanup owner. Only the person's answer and the space reading are stubbed.--yes,--json, no terminal, and the mid-update report-only check never prompt or delete, and they append the guidance.update-command-node-engine-preflight.test.ts(service 26.8.2 case), fails the same way on main1651ee19, so it is unrelated to this change.node scripts/check-changed.mjspasses, with the dead-export scan skipped because it already fails on main for untouched files. The test-lines ratchet passes with a 200-line allocation.