Skip to content

fix(update): fall back to a byte copy when the file-clone ioctl is denied - #165257

Merged
steipete merged 1 commit into
mainfrom
upd/upd-runtime-retention-ficlone-eperm
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-runtime-retention-ficlone-eperm

Conversation

@steipete

@steipete steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes openclaw update aborting at updater-runtime-retention in unprivileged containers whose seccomp policy denies the FICLONE ioctl.

Closes #164113. Thanks @MrJanvar and @rybing7 for the independent reports and syscall evidence.

User Impact

Updaters carrying this fix continue with a guarded byte copy and one warning per copy operation when cloning is unavailable. Native safeguards, file modes, source identity checks, snapshot verification, and SQLite byte-copy space admission remain active. Genuine EIO and unrelated EPERM failures still stop the copy.

The first hop from 2026.9.7 in an affected container still requires a manual npm install of a release containing this fix; later update hops use the repaired copier. Globally disabling native filesystem support is not the fix because Doctor migrations require those safeguards.

Why This Change Was Made

One copy adapter owns capability fallback for retained runtime files, candidate plugin snapshots, and SQLite copies. It retries through the same Root.copyIn owner with clone: "never", preserves the caller's guards, and refuses to retry after destination publication. Concurrent copies share one warning and stop requesting clones after the first refusal.

The package-swap copier already defaults to clone: "never"; its earlier EXDEV fix handles directory renames. The dependency's exclusive snapshot publisher already handles clone capability refusals and verifies copied bytes. No dependency bump, configuration option, or schema change is included.

Evidence

  • The pinned @openclaw/[email protected] boundary at node_modules/@openclaw/fs-safe/dist/copy-file-input.js:51 only falls back for ENOTSUP and lacks the FICLONE EPERM fallback. This adapter supplies it without a dependency bump, matching the direct native syscall cause while preserving EIO and cleanup failures.
  • The published 2026.9.7 driver retains its own code before candidate execution (c074824a27c96d3983043f9eeb33823cd1772d8c, src/cli/update-cli/update-command.ts:539 and its installed retention owner). A candidate cannot change that already-running driver. The FIRST hop from 9.7 inside such a container still needs the manual npm install; later hops work.
  • No seccomp host was available. EPERM was injected at the fs-safe boundary; the fallback exercised real guarded copying. The regression failed before the fix and verifies independent bytes/modes, one warning, refusal of EIO and unrelated EPERM, SQLite space admission, and no retry after publication.
  • The three touched suites passed three times: 48 tests per pass, with wall times 26.29 s, 23.03 s, and 25.77 s. Standalone pnpm test <file> --maxWorkers=1 measurements: retention tree 20 tests / 9.88 s; candidate plugin tree 21 tests / 11.18 s; SQLite file copy 7 tests / 11.42 s.
  • Importers discovered by the required basename search passed: 5 files / 66 tests in 477.86 s. The unchanged database-restore suite accounted for 269.16 s of test time across isolated backup/restore fixtures; shared worker compilation took 133.35 s. No individual test exceeded 30 s, and no timeouts or retries were changed.
  • Both closure guards passed: eager-import-closure.test.ts (package and PR inventory closures) and pr-wrapper-source-closure.test.ts (3 entrypoints), 5 selected checks in 17.67 s.
  • OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --staged --timed completed locally: all 35 checks passed, including production/test typechecks, lint, dead exports, and import cycles. git diff --check passed. No gate was skipped or substituted.
  • Lane-side P1 review was waived; the lead reviews the PR head. Hosted CI timing is not yet available. Auto-merge remains off.

…nied

Retry unavailable native file clones through guarded byte copying for
retained runtimes, plugin snapshots, and SQLite copies. Preserve source
identity, publication, space admission, and genuine I/O error checks.

The installed 2026.9.7 driver retains its own code before candidate
execution; affected first hops still need a manual npm install of a fixed
release. Later update hops use the repaired copier.

Refs #164113. Thanks @MrJanvar and @rybing7 for the independent reports.
@clawsweeper

clawsweeper Bot commented Oct 5, 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 size: M labels Oct 5, 2026
@steipete
steipete marked this pull request as ready for review October 5, 2026 01:48
@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 4, 2026, 9:54 PM ET / October 5, 2026, 01:54 UTC.

ClawSweeper review

What this changes

The PR adds a shared guarded byte-copy fallback for update runtime retention, candidate plugin snapshots, and SQLite file copies when native cloning is unavailable.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This fix remains necessary: current main still propagates the reported clone denial, and independent container reports support the failure. No introduced correctness defect was found.

Priority: P0
Reviewed head: 10c79ca4ead3c95c645dfd50af45f2faeedff890

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation and meaningful boundary regressions are solid; confidence remains limited by the missing repository-required update compatibility verification.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 10 items Pinned introduction and merge result: Reviewed the complete merge-base-to-head patch. The raw test-merge commit records the pinned base followed by the exact PR head; its resulting delta contains the same nine intended paths.
Fallback preserves the guarded owner: Only recognized clone-capability failures trigger a retry through the same Root.copyIn operation. Original options survive, destination publication prevents retry, and unrelated permission failures and EIO remain fatal.
SQLite admission and identity remain intact: The SQLite caller retains expected-source identity checks, create-only publication, restrictive mode, durability, and byte-copy space admission. This changes copying behavior, not a stored schema or serialized format.
Findings None None.
Security None None.

How this fits together

The updater copies installed runtime files, plugin trees, and database snapshots before replacing packages. Guarded filesystem copying preserves source identity and controls destination publication so validation and recovery can use those copies safely.

flowchart TD
  A[Installed runtime and plugin files] --> C[Guarded file copy]
  B[SQLite snapshot files] --> C
  C --> D{Clone available?}
  D -->|Yes| F[Verified destination]
  D -->|Capability refused| E[Admit guarded byte copy]
  E --> F
  F --> G[Update validation and recovery]
Loading

Before merge

  • Complete next step (P2) - Provide the repository-required published-driver × candidate update/recovery verification, including the documented first-hop limitation and a later update using the repaired copier.
Agent review details

Security

None.

PR surface

Source +54, Tests +141, Docs +12, Other +1. Total +208 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 108 54 +54
Tests 3 146 5 +141
Docs 1 12 0 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 9 267 59 +208

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +54 lines; tests net +141 lines Production growth has a stated purpose: one fallback adapter consolidates SQLite retry logic and serves all three affected copy paths.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164113
Summary: This PR is the explicit candidate fix for the independently reproduced container clone-denial issue; the issue should remain open until resolution is merged.

Members:

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

Technical review

Best possible solution:

Keep clone recovery inside the existing guarded copy owner and provide visible guided recovery for installations whose older updater cannot use the fix.

Do we have a high-confidence way to reproduce the issue?

Yes, from source and independent container reports: retention requests clone:auto and pinned fs-safe propagates FICLONE EPERM. No current-main runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes. Retrying through Root.copyIn preserves the existing safeguards and is narrower than disabling native filesystem support or changing container security policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 12785be2ff02.

Labels

Label changes:

  • add P0: The reported normal update path is blocked in affected containers and recovery requires manual package installation, meeting the update UX blocker rubric.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P0: The reported normal update path is blocked in affected containers and recovery requires manual package installation, meeting the update UX blocker rubric.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Pinned introduction and merge result: Reviewed the complete merge-base-to-head patch. The raw test-merge commit records the pinned base followed by the exact PR head; its resulting delta contains the same nine intended paths. (10c79ca4ead3)
  • Fallback preserves the guarded owner: Only recognized clone-capability failures trigger a retry through the same Root.copyIn operation. Original options survive, destination publication prevents retry, and unrelated permission failures and EIO remain fatal. (src/infra/fs-safe-file-copy.ts:45, 10c79ca4ead3)
  • SQLite admission and identity remain intact: The SQLite caller retains expected-source identity checks, create-only publication, restrictive mode, durability, and byte-copy space admission. This changes copying behavior, not a stored schema or serialized format. (src/infra/sqlite-file-copy.ts:25, 10c79ca4ead3)
  • Affirmative dependency contract: The new adapter directly imports fs-safe errors and Root copy types, and the package manifest pins @openclaw/fs-safe 0.23.0. Its native error and cleanup contracts therefore determine whether this retry is safe. (src/infra/fs-safe-file-copy.ts:1, 10c79ca4ead3)
  • Verified dependency error boundary: GitHub verifies openclaw/fs-safe ownership and resolves v0.23.0 to this commit. createNativeCopyFile wraps EPERM as helper-failed with the direct native cause; Linux labels the syscall FICLONE and converts cleanup failures to EIO. Those contracts match the adapter's narrow classifier. (src/copy-file-input.ts:84, 223a30531ea8)
  • Failed clone cleanup: The Linux clone primitive removes only its identity-matching created target before returning a clone failure. Failed cleanup is reported as EIO, preventing the new fallback from concealing an unsettled or substituted target. (native/src/unix.rs:882, 223a30531ea8)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: 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.

  • Record published-driver × candidate verification covering the documented first-hop recovery and a subsequent update through the repaired copier.

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.

@steipete
steipete merged commit d33802d into main Oct 5, 2026
212 of 214 checks passed
@steipete
steipete deleted the upd/upd-runtime-retention-ficlone-eperm branch October 5, 2026 02:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
steipete added a commit to openclaw/fs-safe that referenced this pull request Oct 5, 2026
Close the remaining XFS/ZFS copyTree capability gap after #829 by sharing the exclusive-target FICLONE errno classifier. Keep native cloning strict and preserve raw operational errors; TypeScript selects byte copying only after native workers settle and partial output is removed.

Add isolated seccomp regressions for the file job and worker pool, plus auto/always partial-progress and residue-rejection coverage. Update copying docs and the Unreleased changelog.

Validated with Rust workspace tests and Clippy on Linux/macOS, builds, focused tests, pnpm check (17,170 passing tests), all OS CI lanes, CodeQL, and clean P0-P2 Codex review.

Refs: openclaw/openclaw#165257
RomneyDa pushed a commit that referenced this pull request Oct 11, 2026
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 scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: update fails at updater-runtime-retention with FICLONE EPERM inside an unprivileged LXC container (seccomp blocks ioctl)

1 participant