Repository navigation
fix(update): release the retained runtime on every exit path and keep checkout manifests loadable - #157752
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. |
b75f890 to
735d9c3
Compare
|
Codex review: blocked before merge. Reviewed September 25, 2026, 7:18 AM ET / 11:18 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch changes updater runtime retention, exit cleanup, Doctor recovery, and plugin file copying so interrupted updates can release their temporary code and checkout plugins remain loadable. Merge readiness⛔ Blocked before merge - 5 items remain This PR addresses a failure that still exists on current main, but two previously raised recovery defects remain in the pinned head. Published v2026.9.6 updater compatibility with the final candidate is also unverified. Priority: P1 Review scores
Verification
How this fits togetherThe installed updater retains worker code while replacing an OpenClaw installation, then releases that code on exit. Doctor can recover abandoned copies, while plugin loading checks whether checkout files are safe to use. flowchart LR
A[Installed updater] --> B[Retain worker code]
B --> C[Replace installation]
C --> D[Exit finalizer]
D --> E[Remove runtime copy]
E --> F[Plugin safety check]
B --> G[Doctor recovery]
G --> E
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +398, Tests +558, Docs +23. Total +979 across 21 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: Use one bounded placement and discovery contract for every retained runtime, and preserve a terminal update outcome while stalled cleanup leaves its path and reason available for later Doctor recovery. Do we have a high-confidence way to reproduce the issue? Yes, source provides a deterministic path: a containing mutation root moves retention above the package parent, outside Doctor's scan. The stalled-cleanup watchdog path is also traceable from source; this read-only review did not execute either path. Is this the best way to solve the issue? No. The repair uses the existing retention, Doctor, and plugin-safety owners, but discovery must cover every placement and cleanup must not defeat the terminal watchdog. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 329722c506b2. LabelsLabel changes: No label 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 (4 earlier review cycles)
|
Restore validation, consent, and migration-plan exit callbacks before runtime retention. Keep retained cleanup in the existing terminal unwind and exercise that terminal exit in the process regression.
Cover native and OverlayFS materialization and preserve real metrics through cleanup. Retire snapshot-owner test singletons after successful drainage so Windows path mocks cannot leak into later files.
83f78d3 to
5318f18
Compare
Backport #157329: c926e83 Backport #157752: 5f8e15a Backport #157386: 74b9103 Take only the required OverlayFS materialization subset of #157770: 963089a Preserve the frozen lifecycle and ownership contracts. Keep the recorded watchdog outcome without deleting unjoined runtimes, recognize legacy pnpm projections through a bounded store scan, and inspect service scratch roots. Retain the original proofs plus targeted review regressions. Native platform and installed-upgrade qualification remain separate required release proof. Upstream Windows and filesystem evidence credits WG-Mojo and DonnieFi. Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
… checkout manifests loadable (openclaw#157752) * fix(update): release retained runtimes and preserve plugin safety Finalize retained worker generations on normal and signal exits, copy only boundary-checked plugin files, and reclaim stale projections through the existing temp-artifact cleanup owner. Closes openclaw#157485 Refs openclaw#157463 openclaw#157227 * fix(update): preserve preflight exit contracts Restore validation, consent, and migration-plan exit callbacks before runtime retention. Keep retained cleanup in the existing terminal unwind and exercise that terminal exit in the process regression. * test(update): verify retained-runtime integration Cover native and OverlayFS materialization and preserve real metrics through cleanup. Retire snapshot-owner test singletons after successful drainage so Windows path mocks cannot leak into later files.
Closes #157485
Refs #157463 #157227
What Problem This Solves
Failed or interrupted updates can leave a retained updater runtime behind and make checkout plugins, including Discord, fail hardlink safety checks.
User Impact
The creating worker-generation scope settles retained workers and removes their projection on controlled exits, including signals and failure reporting. If workers cannot settle or removal fails, the updater records
Runtime retained at <path>: <reason>. Doctor and later updates reclaim recognized abandoned projections from the package parent's directory and known temporary directories, preserving live or unrecognized paths with a warning.Retention copies the files inspected by plugin safety checks; other files follow the existing filesystem policy. Foreign hardlinks remain rejected. The installed updater runs first, so installing a candidate cannot retrofit the 9.6 driver's exit handling; the lifecycle fix applies when the installed updater supports it.
Why This Change Was Made
One idempotent finalizer at the creating worker-generation scope owns settlement and release, including interrupted projection work. Existing terminal unwinding and preflight exit callbacks retain their contracts. Stale cleanup stays in
infra:temp-artifacts, with no source-content re-inventory, new store, schema, dependency, or configuration option.Integration with the landed adjacent changes preserves their owners:
ReturnType<RetainUpdateRuntime>and forwards real inventory/materialization metrics. Skipped retention returnsundefined; failed retention produces no fabricated metrics. The existing diagnostics receipt remains unchanged.The importer proof also exposed a shared-test-worker leak already present on main: the Windows path mock remained captured in
openclaw.stateSnapshotOwnersafter its source generation ended. Four lines add that singleton to the existing test retirement map, after successful database drainage; retained native custody remains protected. No product behavior changes in that repair.Thanks @DonnieFi for the precise filesystem and failure-path report.
Evidence
Rebased linearly onto
cbcd4df569ebe7533fae3b5622d049542b445986. Final head:5318f188c52d11c4053ce950e810e0d7297ced4a; tested tree:108c001f0d1c2b6b1b4fc171e1091f458c98eded.tbx_01m3c0e0ng8p63vp8svwaxqvdf.tbx_01m3c1jk73mtmde5btnd7wewvb.OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 node scripts/check-changed.mjs --base origin/main: passed, exit 0. Core, all 25 test-type graphs, root test-support types, and every selected guard passed; core, script, and test-support lint each reported 0 warnings / 0 errors. The combined three-round test/check command took 43m03s.tbx_01m3c14jfkrjty1w837y2fd1n0.Standalone changed-test costs, measured with
/usr/bin/time -p pnpm test <file> --maxWorkers=1on the final candidate:src/infra/update-retained-runtime-tree.test.tssrc/infra/update-retained-runtime.test.tsThe runtime suite includes 16.957 s of shared worker preparation. Lease:
tbx_01m3c2fs3k118fve8qew198bec. The importer run's help-exit file took 99.85 s; its concurrent case durations must not be summed as elapsed file time. New-head CI timings are not yet available.Earlier isolated live proof, before bounded-copy compression and this rebase, used a task-owned state directory, registry, and free port:
Current
git diff --numstatsplit against the new base:The test total includes the four-line shared-worker retirement repair. Remaining production growth:
Known gaps / follow-ups
src/cli/update-cli/update-command-original-service.test.ts: 132.7 s test time, longest case 6.9 s; cause = repeated real SQLite create/seed/close/reopen; a warm shared fixture is a separate lane. The unchanged file measured 148.35 s in the latest importer run and remains covered by the explicit cost waiver.Auto-merge is off. The lead owns r2 review and landing.