Repository navigation
fix(update): retire migration backups after supervisor acceptance - #197705
Conversation
Invoke the existing owner-routed recovery cleanup after native update finish records acceptance. Preserve the current migration originals until a later accepted update, and surface cleanup diagnostics and warnings. Cover the real migrate/finish flow and provide a production-scale synthetic measurement.
|
🦞👀 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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR invokes existing recovery cleanup after a supervisor accepts a native update and returns cleanup diagnostics. Example: A supervisor accepts a later native update after Doctor created two verified migration originals.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR completes automatic recovery cleanup for supervisor-managed updates. The earlier container-upgrade finding is resolved, and no new blocking defect was found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe native update CLI records supervisor acceptance, then routes cleanup through the serving Gateway or exclusive offline owner; the existing manifest and update-history classifiers select recovery artifacts for retirement. flowchart TD
A[Supervisor accepts candidate] --> B[Native update finish]
B --> C[Record successful update]
C --> D[Existing state owner router]
D --> E[Gateway or offline custody]
E --> F[Manifest and history eligibility]
F --> G[Retire eligible recovery artifacts]
G --> H[Diagnostics and advisory warnings]
Technical reviewBest possible solution: Use the existing owner-routed cleanup after durable native acceptance, preserving its current-generation protections and advisory failure handling. Do we have a high-confidence way to reproduce the issue? Current-main source shows that native finish records success without invoking cleanup; the PR reports its new migrate/finish regression failing on the pinned base and passing with the change. Is this the best way to solve the issue? This is the smallest complete production fix: connect the omitted entry point to the existing retirement owner rather than introduce another policy or artifact scanner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b48d16bf6e98. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +8, Tests +51, Docs +9, Other +208. Total +276 across 5 files. Added test files: 0. 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. Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed November 12, 2026, 7:21 AM ET / 12:21 UTC (Revision 2). |
|
Addressed both items on
The PR body also contains completed 35 GiB A/A reclamation and CPU results; additional paired/allocation samples are still running. Fresh Codex autoreview is clean. Final-head CI is attached and running. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…enclaw#197705) * fix(update): retire migration backups after supervisor acceptance Invoke the existing owner-routed recovery cleanup after native update finish records acceptance. Preserve the current migration originals until a later accepted update, and surface cleanup diagnostics and warnings. Cover the real migrate/finish flow and provide a production-scale synthetic measurement. * test(update): assert automatic retirement after container upgrade
What Problem This Solves
Fixes migration originals accumulating after externally supervised updates:
update finishrecorded successful acceptance but never invoked the existing recovery-retirement owner.User Impact
After a later native update is accepted, verified migration originals from Doctor and startup migrations become eligible for automatic cleanup. The current update's originals remain protected through the supervisor's rollback window. Unknown, incomplete, replaced, or unverified artifacts remain protected. No configuration or schema changes are required.
Why This Change Was Made
Call the existing owner-routed cleanup after recording acceptance and return its diagnostics and recoverable warnings. This uses the same manifest, successful-update history, identity checks, and Gateway/offline ownership as ordinary updates; it adds no age-only deletion policy. Native receipts without a start time cannot prove succession and do not trigger cleanup.
The production change is eight added lines. The existing owner already implements retirement, so removing or duplicating it would expand the fix. The added regression exercises real migrate/finish entry points and verifies protection before acceptance, deletion after a successor, recorded diagnostics, and retry history.
Evidence
The original native migrate/finish regression fails on parent
83e3641e092125c009d3421e60560fda8af75c86and passes with the fix. All 65 focused migration/cleanup tests pass. First-head CI correctly caught the existing container-upgrade test's obsolete manual-cleanup expectation; that failure reproduced locally and the updated consumer passes, asserting all three physical paths disappear only after acceptance while live data and the unmanifested original remain. Fresh Codex autoreview is scoped-clean; targeted lint and format pass.Published
2026.11.3→ candidate1d28c64ceb419082033aeaa21a7c1fcf3504a9cfpassed using an isolated synthetic installation and the real CLI: stable Doctor produced two recovery originals; candidate native migration advanced agent schema 27 → 41; an isolated Gateway reached readiness; native finish removed the eligible originals after acceptance. Both originals and the native rollback capture existed before acceptance. The candidate CLI read back the session andgateway.mode=local; workspace contents and the unmanifested original survived. No operator data was used. The first candidate attempt retained recovery state after an unsafe fixture TMPDIR refusal; the supported new-prefix retry with the host's secure TMPDIR completed. Optional plugins were disabled and no inference account was configured, so this proves stored-data and lifecycle compatibility, not model inference.Production-shaped synthetic measurement: 35.09 GiB live agent DB, 3,000 sessions, 62,000 workspace files / 1.181 GB. Backup creation is outside the measured native-finish interval. A/A controls on the same shared macOS/APFS host:
The added work is verified reclamation, not a speedup. Every candidate run checks source identity/size/mtime and all 3,000 sessions. Five interleaved A/B timing pairs and two separate allocation pairs are complete (18 runs including A/A controls). Every reclamation and source-preservation assertion passed. Final paired results:
Allocation samples include collected objects and cover the caller isolate, not all worker/native allocations. CPU excludes child processes. This shared-host APFS measurement does not qualify btrfs or predict physical free-space recovery. Reproduce with
scripts/perf/migration-backup-retention-measure.tsagainst the pinned parent and candidate.pnpm check:changedcompleted: all gates passed except seven inherited unused exports and an own shadowed name that was fixed with a passing targeted lint rerun. The exact parent reproduced all seven exports; #197615 removed their last consumers and #197679 already repaired that main regression. No unrelated repair is included. Final-head CI is green with no failed jobs: https://github.com/openclaw/openclaw/actions/runs/43214791876. ClawSweeper re-reviewed this head with zero open items and zero findings.