Repository navigation
fix(copy): fall back from tree cloning when FICLONE is denied - #835
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: needs maintainer review before merge. Reviewed October 5, 2026, 12:37 AM ET / 04:37 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR makes Linux directory copying recognize unavailable file reflinks, allowing automatic byte-copy fallback after cleanup while preserving strict cloning failures. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v0.23.0 still reject denied tree reflinks. The prior merge-conflict blocker is resolved, and no actionable correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherfs-safe copies immutable, caller-owned directory trees into absent destinations. Native Linux workers attempt file reflinks; the TypeScript copy policy decides whether an unavailable clone should fall back to ordinary copying. flowchart TD
A[Source tree and copy policy] --> B[Filesystem capability probe]
B --> C[Native reflink workers]
C --> D{Clone available}
D -->|Yes| E[Independent cloned tree]
D -->|No| F[Settle workers and clean output]
F --> G{Automatic copying}
G -->|Yes| H[Exclusive byte copy]
G -->|No| I[Unsupported operation error]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep clone availability classification shared while retaining policy-controlled fallback, settled cleanup, exclusive destination creation, and terminal access or identity failures. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: an XFS/ZFS probe selects tree cloning, FICLONE returns EPERM, and main propagates it instead of selecting automatic fallback. No reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes, sharing the existing single-file classifier is a narrow repair that preserves the established TypeScript policy and cleanup boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 27ba8e4e4955. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Prepare `@openclaw/fs-safe` 0.23.1 from main, using the same 13-file scope as #826: root, native workspace, seven platform package versions, exact optional-dependency pins, and regenerated Cargo/pnpm lock entries. No implementation or dependency changes are included. Finalize the 2026-10-04 changelog with an empty Unreleased section above it. Highlights cover no-replace publication on gVisor/9p and other unsupported filesystems (#834, fixes #828), container-denied FICLONE fallback for single-file and tree copies (#829, #835), and nonblocking macOS FIFO watching (#830). The six fixes include PR links and contributor credit, including @Mohl and co-author @foxsky, @vishnukool, and @SebTardif. Validation: `pnpm build`, `pnpm check` (662 test files and 13,431 tests passed; 65 files and 4,108 tests skipped), `pnpm pack:check`, `node scripts/release-notes.mjs 0.23.1`, and `git diff --check` passed. The local build selected the installed rustup compiler explicitly because the default Homebrew Rust compiler could not see the WASM target. Codex autoreview is scoped-clean at P0–P2. Both generated lockfile diffs are limited to the intended version changes. Release publication remains exclusively through the signed v0.23.1 tag and release.yml trusted publishing. Exact-head CI passed on `26e42f21a6b568d3f6a37408dea6f3b89ccf10b3`: [CI](https://github.com/openclaw/fs-safe/actions/runs/37265555433), [coverage](https://github.com/openclaw/fs-safe/actions/runs/37265555421), [mutation proofs](https://github.com/openclaw/fs-safe/actions/runs/37265555402), [benchmarks](https://github.com/openclaw/fs-safe/actions/runs/37265555459), and [CodeQL](https://github.com/openclaw/fs-safe/actions/runs/37265555471). No runner reruns or failure exceptions were needed. Main remained at `04e370a3e39eb6e98e6cb54877a5941b6d688cde` before merge.
On XFS/ZFS inside a container that denies
ioctl(FICLONE)withEPERM, the filesystem probe selects native tree cloning butcopyTree({ clone: "auto" })currently rejects instead of copying bytes. PR #829 fixed the separate single-file path; this closes the remaining tree-copy gap needed by openclaw/openclaw#165257.Share the single-file capability classifier with the strict tree file job:
EPERM,ENOTTY,EINVAL,EXDEV,ENOSYS, andENOTSUP/EOPNOTSUPPbecomeCLONE_UNAVAILABLE. Other errors remain raw. The target has just been created exclusively, so the kernel's immutable/append-only destinationEPERMcase cannot apply. Rust still does no byte-copy fallback; TypeScript owns the policy choice.The existing native worker owner already settles admitted jobs and removes partial output. TypeScript then creates an exclusive fresh destination for byte copying. Regression tests verify this handoff,
alwaysreportingunsupported-platform, and refusal to merge into residue after unsuccessful cleanup. Btrfs uses its separate subvolume-snapshot path and is unchanged.Validation:
0712807with rawEPERM, then passed with the fix. Reuses fix(atomic): fall back when Linux FICLONE is denied with EPERM #829's filter and isolation helper.cargo test --workspace --locked: 188 tests passed; worker cleanup covered concurrency 1, 4, and 32. Linux Clippy passed with warnings denied.cargo test --workspace --locked, Clippy,pnpm build && pnpm native:build, and focused copy/clone tests passed.pnpm check: 17,170 tests passed (692 test files); package, docs, WASM allocator, and boundary checks passed.7a37d00d8d6fd0077666d5f7f0353e98083270f6: all 28 active CI jobs passed, including every OS lane; CodeQL passed, with no retries. Coverage, benchmarks, and all three public mutation-proof lanes also passed.Linux validation ran in a local Rust 1.98.1 container. Its overlay directory-link-count behavior fails an unrelated metadata-observation test; running fixtures on tmpfs passes the complete suite. The optional AWS XFS loop-mount proof could not acquire a lease: the broker rejected admission at the shared active-lease limit. No AWS lease was acquired or left running.
No release is included.