Skip to content

fix(update): complete the package swap across devices instead of rolling back on EXDEV - #164769

Merged
steipete merged 3 commits into
mainfrom
upd/upd-package-swap-exdev-overlayfs
Oct 4, 2026
Merged

steipete merged 3 commits into
mainfrom
upd/upd-package-swap-exdev-overlayfs

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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 swapStagedPackageInstall with expected 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 onto 6a3f4a2bd2612a216cbdd26cc222adab17b32c65.

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

  • Publication-boundary suite: 19 tests passed three times on the final source tree, with 36.99 / 35.39 / 20.72 s wall times.
  • Candidate resource-limit/warning callers: 40 tests passed, 15.70 s.
  • Explicit E2E config: both package-overrides and installed-updater self-replay files passed, 11 tests, 32.41 s. These fixtures build their own packages/runtime from source and use the supported OPENCLAW_E2E_SKIP_BUILD=1 route. The default runner had prepared artifacts without selecting these two E2E files; they were run explicitly to close that coverage gap.
  • Eager-import, wrapper-source, native-provisioning, and four test-plan guards: seven files passed, 161 tests passed and one existing platform skip, 458.99 s.
  • 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 --check passed.
  • Fresh direct-route Codex P1 review of the final source tree: scoped-clean, no accepted/actionable P0/P1 findings.
  • Importer coverage: 53 ordinary importer/sibling files were selected in batches of at most 15 after initial integration. Batch 1 failed only the immutable recovery case below; batches 2–4 passed (105.96 / 265.82 / 1218.48 s). The two E2E importers were subsequently run explicitly. Focused publication, warning, recovery, E2E, and wrapper checks were rerun after the final rebase; other unchanged-contract importer evidence was retained.
  • Shared E2E build preparation passed; its compilation took 15m 35s and dominated the first importer batch's 1161.21 s wall time. This is preparation time, not test time. Hosted CI seconds are not claimed.

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 rejected SQLite recovery database or journal changed at the second recovery.admit() in ordinary candidate runs. The rebased candidate 270101b9153a4a0e7a25f308aae0c52e8f4c9be9 failed 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 6a3f4a2bd2612a216cbdd26cc222adab17b32c65 passed 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:

Existing suite Measured test cost
test/scripts/pr-worktree-provision.test.ts 348.253 s summed case time; cold/warm/sparse case 110.611 s
src/cli/update-cli/update-command-database-rollback.test.ts 213.103 s summed case time; longest case 39.717 s
src/cli/update-cli/update-command-original-service.test.ts 300.383 s summed case time
src/cli/update-cli.package-lifecycle.test.ts 541.494 s summed case time; Doctor-timeout case 68.065 s

Change 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.

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts agents Agent runtime and tooling size: L labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 3:20 AM ET / 07:20 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: 97e9154de2231133c084a1a2afed063378505646
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent updater repair with substantial boundary validation and no definite introduced bug; the explicit STOP remains a separate landing decision.
Proof confidence 🌊 off-meta tidepool Not applicable: The host identifies a MEMBER author, so the external contributor proof gate does not apply. Supplied macOS fault injection exercises the production swap with real filesystem/SQLite state and observed commit, rollback, refusal, and reopened recovery; Linux overlay2 service behavior remains unproven. Existing serialized journal shapes remain accepted, and the new copy states are exercised after reopening without a SQL migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The host identifies a MEMBER author, so the external contributor proof gate does not apply. Supplied macOS fault injection exercises the production swap with real filesystem/SQLite state and observed commit, rollback, refusal, and reopened recovery; Linux overlay2 service behavior remains unproven. Existing serialized journal shapes remain accepted, and the new copy states are exercised after reopening without a SQL migration.
Evidence reviewed 10 items Pinned introduced change: Reviewed the merge-base-to-head hunks at the supplied identities, rather than attributing base-branch drift to this PR. The checkout remained clean.
Still necessary on current main: Fetched main still calls the live-to-previous rename without an EXDEV copy fallback. Nearby merged updater fixes address launcher identity, ownership, runtime selection, and integrity limits rather than this failure.
Latest release retains the failure: The supplied v2026.9.8 release commit contains the same unconditional displacement rename at line 337.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should the recorded recovery STOP remain blocking until classified, or can an explicit disposition accept the bounded local evidence and unproven Linux deployment path? Resolve the STOP before landing: Keep the pause until attributable evidence repairs or independently dispositions the recovery failure and settles the Linux validation requirement.

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

  • Resolve merge risk (P1) - The recorded immutable SQLite recovery STOP still needs attributable resolution or explicit maintainer disposition; passing replays do not establish its cause.
  • Resolve merge risk (P1) - The new copy-and-remove path runs after Gateway shutdown, but Linux overlay2 image-layer activation, rollback, and service availability remain unverified by the supplied macOS fault-injection evidence.
  • Complete next step (P2) - Resolve or explicitly disposition the recorded immutable recovery STOP and the Linux deployment coverage limit before merge, keeping identity guards intact.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +336, Tests +148, Docs +18, Other +22. Total +524 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 11 514 178 +336
Tests 1 148 0 +148
Docs 1 18 0 +18
Config 0 0 0 0
Generated 0 0 0 0
Other 1 22 0 +22
Total 14 702 178 +524

Review metrics

Metric Value Why it matters
Recovery implementation growth production net +336 lines; tests +148 lines The stated growth implements verified copying, durable custody transitions, and interruption recovery rather than a bare rename retry.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164699
Summary: This PR is the candidate repair for the image-layer displacement failure; older installed drivers retain their documented first-hop limitation.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Establish Linux activation recovery (recommended)
    Verify the new updater's image-layer copy, interrupted removal, rollback, and Gateway restoration on overlay2 before accepting the platform claim.
  2. Accept the bounded platform evidence
    Record explicit acceptance of macOS filesystem-boundary proof and the remaining Linux service-availability uncertainty.

Technical review

Best 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.

Labels

Label changes:

  • add merge-risk: 🚨 availability: The introduced copy-and-remove fallback executes during service interruption, and its Linux overlay2 activation and recovery behavior remains unproven.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: The referenced real-user update flow repeatedly fails after Gateway shutdown on image-layer npm installations.
  • merge-risk: 🚨 availability: The introduced copy-and-remove fallback executes during service interruption, and its Linux overlay2 activation and recovery behavior remains unproven.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The host identifies a MEMBER author, so the external contributor proof gate does not apply. Supplied macOS fault injection exercises the production swap with real filesystem/SQLite state and observed commit, rollback, refusal, and reopened recovery; Linux overlay2 service behavior remains unproven. Existing serialized journal shapes remain accepted, and the new copy states are exercised after reopening without a SQL migration.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head hunks at the supplied identities, rather than attributing base-branch drift to this PR. The checkout remained clean. (97e9154de223)
  • Still necessary on current main: Fetched main still calls the live-to-previous rename without an EXDEV copy fallback. Nearby merged updater fixes address launcher identity, ownership, runtime selection, and integrity limits rather than this failure. (src/infra/package-update-publication-owner.ts, 8ffe149abb33)
  • Latest release retains the failure: The supplied v2026.9.8 release commit contains the same unconditional displacement rename at line 337. (src/infra/package-update-publication-owner.ts:337, fc23bc864e45)
  • Durable copied custody: The journal atomically records the verified copy as the previous generation while retaining the source fingerprint and removal intent. Publication and rollback consume the updated fingerprint. Existing descriptor shapes, intent variants, SQL columns, and version remain supported; the added boundary cases reopen the journal for recovery. (src/infra/package-update-activation-journal.ts:268, 97e9154de223)
  • Meaningful publication boundary coverage: Seven added scenarios exercise the production swap with real isolated filesystem and SQLite state: commit, rollback, corrupt-copy refusal, lost creation acknowledgment, lost copy-publication acknowledgment, partial source removal, and reopened-journal recovery. The captured body reports repeated successful final-source runs; this review executed no tests. (src/infra/package-update-publication-boundary.test.ts:437, 97e9154de223)
  • Recovery STOP remains undispositioned: The captured body explicitly retains the intermittent SQLite recovery failure despite a passing final replay. The named immutable recovery test and production module have no introduced changes. Available evidence does not establish that the copier caused the failure or that it is inherited. GitHub now marks the PR ready for review, but no subsequent human review or comment resolves the recorded STOP. (src/infra/package-update-activation-immutable.test.ts:545, 97e9154de223)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Classify or explicitly disposition the intermittent immutable recovery failure without weakening identity checks.
  • Supply Linux image-layer activation/rollback evidence or record explicit acceptance of the bounded platform coverage.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-04T05:01:54.744Z sha 37f1cbb32fad07f42e87605c4a0e99cc8ac835ff :: blocked before merge. :: none

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.
@steipete
steipete force-pushed the upd/upd-package-swap-exdev-overlayfs branch from 37f1cbb to 97e9154 Compare October 4, 2026 07:11
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Oct 4, 2026
@steipete
steipete marked this pull request as ready for review October 4, 2026 07:14
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 4, 2026
@steipete
steipete merged commit d06201d into main Oct 4, 2026
228 checks passed
@steipete
steipete deleted the upd/upd-package-swap-exdev-overlayfs branch October 4, 2026 07:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…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.
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant