Repository navigation
fix(update): complete the package swap across devices instead of rolling back on EXDEV - #164769
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 4, 2026, 3:20 AM ET / 07:20 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR adds verified copy-based package backup and journaled recovery when an npm update cannot rename the installed package, and documents older updater limitations. Merge readiness⛔ Blocked before merge - 4 items remain This remains useful, distinct work: current main and v2026.9.8 still lack the EXDEV publication fallback. No definite introduced correctness defect was found. Priority: P1 Review scores
Verification
How this fits togetherThe package updater replaces an installed OpenClaw package after candidate validation and Gateway shutdown. Its publication journal records package and launcher custody so interrupted activation can recover or roll back. flowchart TD
A[Validated candidate] --> B[Package publication owner]
C[Installed package] --> B
B --> D{Backup rename succeeds?}
D -->|Yes| E[Retained previous package]
D -->|EXDEV| F[Copy and verify backup]
F --> G[Journal copied custody]
G --> E
E --> H[Publish candidate or restore backup]
Decision needed
Why: The author expressly retained the STOP, and neither the passing replay nor ready-for-review transition explains the failure or records acceptance of the remaining coverage limits. Before merge
Agent review detailsSecurityNone. PR surfaceSource +336, Tests +148, Docs +18, Other +22. Total +524 across 14 files. View PR surface stats
Review metrics
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: Keep one journal-backed publication owner with strict rollback custody and clear image-rebuild or manual-first-hop recovery guidance. Do we have a high-confidence way to reproduce the issue? Yes: the reporter's image-baked Docker installation and volume-backed control match the unconditional rename in current main and v2026.9.8. This review verified the source mechanism without executing an update. Is this the best way to solve the issue? Yes, the existing publication owner is the appropriate repair boundary, and the patch records the copy's distinct identity instead of weakening verification. Its platform coverage and explicitly retained recovery STOP still need disposition. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8ffe149abb33. 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 (1 earlier review cycle)
|
Verify and persist an independent previous-generation copy before removing an image-layer package that cannot be renamed. Record the copied fingerprint for interruption recovery and rollback without retrying EXDEV. Refs #164699. The first hop from published 2026.9.7/9.8 still requires manual installation or an image rebuild because those drivers own the swap.
37f1cbb to
97e9154
Compare
…ing back on EXDEV (openclaw#164769) On Docker overlay2 with openclaw installed in a read-only image layer, openclaw update admitted, validated and stopped the Gateway, then package-swap failed with EXDEV renaming the live package directory into the activation anchor (overlayfs refuses moving an image-layer directory even on the same mount); the updater rolled back after ~5 minutes of downtime and every retry repeated. The publication owner now handles EXDEV immediately: copy the live tree to an anchor sibling on the writable layer, verify it against the content inventory before activation, record the copy's fingerprint as the new custody fact, rename within the device, retire the source, and keep rollback restorable. The published 2026.9.7/9.8 drivers run their own publication code, so their first hop still needs an image rebuild or a manual npm install; every hop from the release carrying this change works in place. Refs openclaw#164699.
…only drift (#169027) Backport of 3e83272 (#169027) adapted for 2026.10.3. 10.3 predates the package-update-publication-tree module (#164769), so the legacy identity/version fallback lives in the owner's inline matcher and warnings log via the update/package-integrity subsystem. Matcher unit tests were rewritten against the integrity reader plus an owner-level version-refusal case. Prerequisite #168958 is a perf-only change against that missing module and was not ported. (cherry picked from commit 3e83272)
Refs #164699
What Problem This Solves
Future npm-global update drivers can complete the package swap when Docker OverlayFS refuses to rename an installation inherited from an image layer with
EXDEV.Why This Change Was Made
The activation anchor already shares the installation's parent; moving it cannot fix OverlayFS lower-layer directory renames. On the first
EXDEV, the publication owner copies into an operation-specific sibling, persists it, and verifies its contents, inventory, links, permissions, and ownership. It records the copy's own fingerprint before retiring the original, then publishes the candidate through the existing rename and launcher path. Both publication and rollback consume that recorded copy fingerprint.The existing journal's JSON intents carry copy custody. SQL tables, columns, and version are unchanged; there are no new configuration options, CLI flags, or dependencies. Thanks @potterdigital for the image-layer reproduction and volume-backed control.
User Impact
Drivers containing this fix can update image-layer npm installations in place and retain a verified rollback copy. Successful fallback produces a warning and does not retry the impossible rename. Copy-inventory mismatches leave the original package intact.
The first hop from 2026.9.7 or 2026.9.8 still needs the manual path. Those installed drivers execute their own publication owner before the candidate can take over. Rebuild the Docker image with a release containing this fix, or follow the documented backup/service-stop precautions and run
npm install -g openclaw@<version>inside the container.Evidence
The original injected-EXDEV regression failed through
swapStagedPackageInstallwithexpected committed, received failed. The repaired boundary covers commit, rollback, corrupt-copy refusal, lost directory-creation and rename acknowledgments, partial source removal, and recovery from a reopened journal. Copy staging remains outside the anchor so an unacknowledged creation cannot obstruct recovery.Rebase and integration
Final head:
97e9154de2231133c084a1a2afed063378505646. Rebased onto6a3f4a2bd2612a216cbdd26cc222adab17b32c65.The integration preserves #164438/#164636 launcher behavior, #164677 private Node PATH handling, #164748 hard-link moves, and #164504 candidate-only degraded verification. Rollback-copy verification remains strict. Main's template-worker implementation replaces the overlapping tooling commit. The new publication-tree module and its transitive imports are listed in the wrapper inventory.
A line-cap failure was fixed by keeping warning forwarding in the existing result reporter; its callback is an arrow function. An inherited MCP cursor-test type error was resolved by incorporating main's existing fix. No suppression or baseline edit was added by this PR.
Validation
OPENCLAW_E2E_SKIP_BUILD=1route. The default runner had prepared artifacts without selecting these two E2E files; they were run explicitly to close that coverage gap.node scripts/check-changed.mjs: passed, 624.41 s. Export-name collisions passed, 26.26 s; restart-swap fixture loading passed, 0.11 s; Madge passed with zero cycles, 23.46 s. Runtime import-cycle guard also reported zero cycles.git diff --checkpassed.scoped-clean, no accepted/actionable P0/P1 findings.Unresolved intermittent recovery failure — draft STOP
src/infra/package-update-activation-immutable.test.ts— recovers committed activation control only after explicit native rollback admission — repeatedly rejectedSQLite recovery database or journal changedat the secondrecovery.admit()in ordinary candidate runs. The rebased candidate270101b9153a4a0e7a25f308aae0c52e8f4c9be9failed this case in 5.135 s (19.67 s suite wall time). Earlier tracing found a ctime-only change; inode, mode, size, mtime, and contents were unchanged.The same command on detached main
6a3f4a2bd2612a216cbdd26cc222adab17b32c65passed cold and warm runs (35.44 / 21.10 s wall time). A candidate run with a read-only native-constructor observer also passed (32.31 s); it observed no metadata change to an existing control database during construction. The final commit's ordinary run passed all 19 tests in 20.74 s, with the named case taking 5.137 s.Passing replays are not a fix. Classification remains unresolved; this is not established as an inherited main failure or as copy-induced control identity drift. The failing path is immutable SQLite recovery, and its control database is outside the package tree. The copier/publication owner is absent from that test's runtime import closure; the only changed reachable source adds unused journal-intent variants. The copy's fingerprint is already journaled and consumed by both swap readers. No safe additional identity update was established. The production identity check and existing failing test remain unchanged; no timeout, retry, weaker assertion, or skip was introduced to hide the failure.
This PR remains draft with auto-merge off pending an attributable repair or maintainer disposition of the intermittent failure.
Slow pre-existing suites (waived)
The maintainer waiver applies to these unchanged suites:
test/scripts/pr-worktree-provision.test.tssrc/cli/update-cli/update-command-database-rollback.test.tssrc/cli/update-cli/update-command-original-service.test.tssrc/cli/update-cli.package-lifecycle.test.tsChange size
Production: +514/−178 lines. Tests: +148/−0. Documentation: +18/−0. Wrapper inventory: +22/−0. Total: +702/−178 across 14 files.
Environment limits
EXDEV is injected at the real filesystem rename boundary on macOS. The Linux Docker overlay2 image-layer npm-global update with a systemd user service, including live activation/rollback and Gateway availability, remains unproven because the required remote infrastructure is unavailable. No remote lease was retried. This does not claim a successful published-9.7/9.8 first hop.