Repository navigation
fix(publish): fall back for rename-noreplace publication when RENAME_NOREPLACE is unsupported - #843
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 6, 2026, 9:11 PM ET / October 7, 2026, 01:11 UTC (Revision 2). ClawSweeper reviewWhat this changesAdds an identity-checked Linux link/unlink fallback for exclusive file publication, with a fallback marker, partial-failure receipts, documentation, and regression coverage. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main and v0.24.1 still refuse unsupported no-replace publication. No actionable introduced defect remains; the latest commit preserves the existing atomic collision contract. Priority: P2 Review scores
Verification
How this fits togetherExclusive file publication moves a completed staged file to a destination without overwriting an existing entry. Native filesystem checks and parent-directory synchronization determine whether publication succeeds or returns recovery evidence. flowchart TD
A[Completed staged file] --> B[Pin file and parents]
B --> C[Attempt exclusive rename]
C --> D[Unsupported in Linux auto mode]
D --> E[Link and verify inode pair]
E --> F[Remove source and verify target]
C --> G[Synchronize parents and return receipt]
F --> G
D --> H[Strict mode refuses]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Reuse the retained-parent fallback with explicit mechanism and recovery receipts, preserve strict atomic-only behavior, and keep interrupted-pair recovery in consuming applications. Do we have a high-confidence way to reproduce the issue? Yes, source establishes main's unsupported-capability refusal, and the selective seccomp fixture supplies a focused reproduction path. This read-only review did not execute it. Is this the best way to solve the issue? Yes, the selected compatibility extension reuses the guarded native implementation and preserves strict mode, existing atomic collision errors, and explicit partial-state reporting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b749881fd7a6. 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
HistoryReview history (1 earlier review cycle)
|
What This Solves
Linux filesystems that reject
renameat2(RENAME_NOREPLACE)can now complete regular-filepublishFileExclusive({ strategy: "rename-noreplace" })in nativeautomode. This covers both the database snapshot publication and manifest seal reported in openclaw/openclaw#166246. Thanks @MertBasar0 for the detailed report and selective seccomp reproduction.User Impact
Publication reuses #838's retained-parent native file move: exclusive
linkatwithout following symlinks, exact staged-inode/two-link verification, then sourceunlinkatand final verification. Success consumes the source and preserves the existingmethodunion; the additivefallback: "link-unlink"field identifies the weaker mechanism. Nativerequirestays fail-closed withdetails.capability === "rename-noreplace". Unsupported or denied links fail closed naming both capabilities. The link-required and link-or-copy strategies remain unchanged.Link/unlink is not crash-atomic: interruption between the syscalls can leave both names on the same complete inode. Post-link failures preserve the target and report publication/source-removal state, including verified
still-linkedafter failed unlink. Existing target/source parent synchronization and parent-receipt fencing remain in place. Identity checks and syscalls are separate; this is not source-name compare-and-swap.OpenClaw Recovery Follow-up
Source inspection at
7880834c19616b5efb871e1755cd4b30cf2f2481confirms snapshot publication and manifest sealing. No OpenClaw code is changed here.readUpdateRecoveryBackups()lists the directory as incomplete when no manifest exists. Strict payload readers reject remaining hard links.manifest.json.partialandmanifest.jsonat nlink=2. The strict manifest reader rejects this, so capture discovery can fail rather than classify that entry as incomplete. There is no automatic pair recovery.retireExpiredStandaloneDoctorCaptures()reads the final manifest with plainreadFile; a parseable two-link manifest meeting the existing age/run criteria can be retired after 30 days. OpenClaw should recognize and retain interrupted seals before treating them as sealed, and either keep these pairs as incomplete evidence or perform identity/ownership-checked source removal and directory sync before admitting recovery. Merely accepting arbitrary hard links would weaken its current reader boundary.The consumer needs the next fs-safe release and an OpenClaw dependency bump. This PR does not release a package or close the OpenClaw issue.
Evidence
The new public Linux seccomp suite was run against fresh main before the fix: five cases failed at the old unsupported-publication refusal and the strict-mode control passed. The suite covers cross-parent payload publication, sibling manifest sealing, collisions, staged-source substitution, link denial, failed unlink, and native require. Rust tests extend the existing seccomp helper with substitutions immediately before link and the ENOSYS link case; existing cases cover the remaining unsupported-link errnos and partial states.
Validation passed:
cargo test --workspace --locked(190 tests),cargo clippy --workspace --all-targets --locked, native/package builds, focused Linux tests, fullpnpm check(17,285 passing tests plus installed-package validation), and independent Codex P0–P2 review. The full suite caught an existing atomic-rename collision contract; normalization was narrowed to fallback errors, preserving rawEEXISTon the atomic path, then focused tests and the full check passed. Final headd41e0d2546d22a28079569e0426a88bbdc9cd469has 38 successful checks and five intentional manual-only skips: multi-OS CI, CodeQL, coverage, and benchmarks. No CI retry, CodeQL rerun, or admin bypass was needed. The seccomp proof ran on AWS/Linux; no QNAP hardware run is claimed. The validation lease has been released.