Repository navigation
feat(update): clean up retained migration recovery files - #133864
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 10:32 AM ET / 14:32 UTC. ClawSweeper reviewWhat this changesThe branch adds Warning SQLite table change This PR modifies persisted SQLite tables in Merge readinessKeep open for maintainer review. The branch is not superseded by current main and implements a coherent, guarded public cleanup capability, but its irreversible upgrade and recovery-data lifecycle needs explicit acceptance before merge. Priority: P2 Review scores
Verification
How this fits togetherSession migrations import legacy transcript and index artifacts into agent SQLite databases while retaining originals for rollback. The new update subcommand inspects those recovery records, protects incomplete or dependent data, and removes only verified originals after offline ownership checks. flowchart LR
A[Legacy session artifacts] --> B[SQLite migration]
B --> C[Recovery manifest]
C --> D[Cleanup preview]
D --> E{Confirmed and verified?}
E -->|Yes| F[Retire recovery originals]
E -->|No| G[Retain recovery data]
F --> H[SQLite session history remains]
Decision needed
Why: The implementation is guarded, but deciding to expose irreversible recovery retirement defines the supported operator rollback and retention experience. Before merge
Agent review detailsSecurityNone. PR surfaceSource +2277, Tests +2519, Docs +153, Other +1107. Total +6056 across 69 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept one manifest-backed, confirmation-gated cleanup flow as the supported retirement path, with its documented rollback loss and recovery safeguards treated as the upgrade contract. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect report: this PR adds a capability, and the supplied installed-package after-fix scenarios exercise its intended behavior. Is this the best way to solve the issue? Yes, subject to maintainer acceptance of the product contract: keeping deletion authority in the manifest and migration owner is safer than suffix-, age-, or directory-based cleanup because unknown and dependent artifacts remain protected. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9323eae1deab. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
Merged as 78d2d914db75. Native reconciliation confirmed the landed tree against exact prepared/tested head Exact-head installed proof passed actual npm Blacksmith Testbox The passive-startup and foreign-root recovery findings have failing-before/passing-after proof. Raw startup now performs zero config/proxy/PATH/dispatcher setup before rejecting unsupported parent options. Interrupted relocated-state import records local dependencies and restores both exact originals with a readable manifest. Local runs passed 190 owner cases, 361 CLI boundary cases, 411 planner/routing cases and eight built-CLI state cases; counts overlap. The following final post-rebase commands passed: node scripts/run-vitest.mjs src/commands/doctor-session-sqlite.test.ts src/cli/run-main.profile-env.test.ts src/cli/update-cli.option-collisions.test.ts src/agents/embedded-agent-runner/run/attempt-system-prompt.test.ts src/agents/embedded-agent-runner/run/attempt-setup.test.ts test/scripts/ci-node-test-plan.test.ts370 tests across six files/four configurations passed. node scripts/check-changed.mjspnpm buildChanged checks and the full build passed, with zero ineffective-dynamic-import diagnostics. Fresh incremental Codex review is scoped-clean at P0; earlier feature/CI/roster reviews were scoped-clean at P0/P1. All six commits rebased patch-identically. No actionable code findings remain in the latest ClawSweeper review, and its exact-head installed-proof and required-CI Rank-up moves are both satisfied. Prior CI failures and repairs remain documented in the PR body. The original Anthropic Windows case passed on this head in 87.090 seconds, along with all four source/compiled scoped/prepared flows. The separate canonical packaged-provider repair is already on main; no discarded provider patch or ordinary restore change was copied here. The operator explicitly approved irreversible retirement and temporary import-spool metadata. No new configuration setting or persistent SQLite schema/version was added; the flagged DDL is disposable staging only. Docs cover commands, consent, rollback loss, protected data, offline ownership, relocated-state recovery, large-log costs, and absence of automatic full-state backups. Native Windows installed-package/native-scale proof, authenticated inference and peak-disk measurements remain unclaimed. The exclusive ordinary restore-publication follow-up stays separate. |
bd6aeb3 to
fbe4960
Compare
fbe4960 to
7f33259
Compare
7f33259 to
82ab32b
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Add explicit, profile-aware recovery cleanup with read-only preview, offline consent, durable disposal receipts, and conservative protection of unique history. Preserve one untouched legacy transcript through bounded import repair and retain recovery mappings until their payloads are retired. Document rollback loss, portable-backup exclusions, and migration resource requirements. Refs #133805
Prepare built CLI artifacts before test workers, register the exact inert survivor catalog, and give extracted update fixtures their complete scenario context. Preserve strict directory synchronization through its canonical owner. Verify both retained-in-place and archived unindexed history without weakening original identity or history checks.
82ab32b to
2bac192
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…3864) * feat(update): clean up retained migration recovery files Add explicit, profile-aware recovery cleanup with read-only preview, offline consent, durable disposal receipts, and conservative protection of unique history. Preserve one untouched legacy transcript through bounded import repair and retain recovery mappings until their payloads are retired. Document rollback loss, portable-backup exclusions, and migration resource requirements. Refs openclaw#133805 * test(update): complete recovery cleanup validation contracts Prepare built CLI artifacts before test workers, register the exact inert survivor catalog, and give extracted update fixtures their complete scenario context. Preserve strict directory synchronization through its canonical owner. Verify both retained-in-place and archived unindexed history without weakening original identity or history checks. * test(update): adapt recovery roster through baseline recipe * fix(doctor): keep recovery dependencies in the local session boundary * fix(cli): preserve passive cleanup startup through parent options * test(update): reflect CLI runtime preparation in the CI plan
Closes #133805 — explicit retirement of update recovery originals after a verified upgrade.
What Problem This Solves
Operators upgrading legacy session stores to SQLite retain potentially large JSONL/index originals, but had no supported way to retire safe rollback data without guessing which files still contain unique history. Repeated migrations could also prune successful recovery manifests while leaving their payloads behind, losing restore mappings without freeing meaningful space. Public Doctor repair made an extra full raw transcript copy and rewritten intermediate before the streaming importer.
Why This Change Was Made
Add
openclaw update cleanupas a thin CLI frontend to the migration owner's recovery lifecycle, not ordinary session retention or a filename-based recursive delete. The owner records preservation evidence, keeps required mappings, verifies destinations/originals under exclusive offline ownership, claims the complete selected set before deletion, and persists resumable disposal receipts. All known importing owners contribute before archival; incomplete/unselected groups stay recoverable, and historical evidence is adopted conservatively.Move migration-time branch/provider repair into the existing disposable SQLite import spool, retaining one untouched original instead of an extra full raw copy/rewrite. Preserve current main's lazy updater loading and final result reporting. No new dependency, configuration setting, automatic expiration, persistent SQLite schema/version, or full-state snapshot framework is introduced. The operator explicitly approved the irreversible-retirement contract and temporary spool metadata design for this task; the spool DDL is not a change to a persistent user database.
User Impact
Preview with
openclaw update cleanup --dry-run, then stop the selected Gateway and explicitly retire eligible originals. Interactive confirmation defaults to No; unattended deletion requires--yes, including JSON mode. Cleanup never stops/restarts a service or silently redirects to another profile. Current history, operator backups, malformed/unique unimported data, unsupported ownership, and unmanifested files remain protected. Failed/interrupted disposal has explicit outcomes and can be retried without deleting recreated files.Update cleanup documentation and the updating guide explain profile/state selection, permanent rollback loss, protected files, retry/restore behavior, portable-backup exclusions, and disk/RAM costs. Originals, temporary SQLite staging, and destination/WAL can coexist; SQLite can be larger than JSONL. Neither update nor cleanup creates an automatic full pre-upgrade backup.
Release-note context: add explicit update recovery cleanup, preserve migration mappings until originals are retired, and avoid the additional full-file Doctor repair copy for large histories.
Evidence
Published head:
2bac192281227838d90d243b16ee6c582852af66, based ona226416b01a2960478176952d7a953bac9083555. The passive-startup and foreign-root recovery findings are repaired and independently verified. All six commits rebased patch-identically. Post-rebase proof passed 370 tests across six files/four configurations, complete changed checks, and the full local build with no ineffective-dynamic-import diagnostics. The incremental repairs have a fresh scoped-clean P0 review. The refreshed installed-package proof below also passed on this exact head. Exact-head CI completed successfully. Merged as 78d2d914db75; native reconciliation verified the landed tree against this prepared head.Regression and local proof
Failing-before/passing-after cases cover retained payloads losing manifests after more than 50 runs; public Doctor's extra raw copy/rewrite; confirmation/publication races; shared failed/unselected owners; duplicate-owner restore; admitted inputs disappearing; cross-run and historical dependency selection; recreated files; database/WAL changes; symlinks/hardlinks; consumed generations; malformed data; offline ownership; and failed-delete accounting.
After the shared-owner/dependency repairs, the integrated selection run passed 341 tests across nine files/four configurations, followed by eight CLI process cases and complete changed checks. CI-wiring follow-through passed 50 focused contract cases and eight managed-build-prerequisite process cases; the latest canonical-roster integration passed 57 neighboring cases. These runs overlap and are not a full-suite count. The feature, CI repair, and roster integration each have scoped-clean P0/P1 reviews; newly accepted findings will receive their own validation before landing.
Native dist-backed CLI preflights also passed all three shared-owner scenarios and custom-store import → exact original restore → reimport → cleanup → intentional-disposal reporting. Earlier native installed-updater and nine-clause source-blind proof, plus four real chmod publication faults under normal/canonical macOS root aliases, remain supplemental evidence rather than proof of every later change.
Actual old-npm updater and Gateway proof
On exact published head
2bac192281227838d90d243b16ee6c582852af66, installed actual npm[email protected]in isolated synthetic environments and invoked that old installed updater against the packed candidate. Both small and 150,000-record scenarios asserted migration/original preservation before standalone Doctor, then exercised public Gateway history, appends/new sessions without inference, online preview/refused apply, custom restore/reimport, offline cleanup, retry, recreated paths, intentional-disposal reporting, restart, and exact old/new history checks. Both passed. A separate fresh npm installation of the same candidate passed 37 public CLI commands across complete shared ownership, an unselected known owner, and incomplete index coverage.Blacksmith Testbox
tbx_01m1c0qk6nkwv8vvhekvz2wze8; all 69 changed files hash-verified against exact head. Backing environment run. The 16m34s command returned exit 0 with both scenario pass markers and complete structured evidence; the lease was then stopped. The backing workflow is environment provenance, not the test verdict: lease cleanup may cancel it.Candidate package SHA-256:
1461e375411c2a5b46a9b7ffc08d014371948a8a6d8c650e41e70ccd23d283b7. Package version is the local development candidate, not a release/publication claim.Remaining gates and limits
Current production delta: +3,593/-1,385 (net +2,208); tests/support +3,903/-221 (net +3,682); docs +164/-11; tooling/config +18/-5, across 69 files. Production growth implements the explicit verification/retirement/recovery lifecycle, bounded staging, and one shared startup option contract; moved code cancels in the net. No ratchet was widened.