Skip to content

feat(advanced): retain symlink identity through no-replace publication - #682

Merged
fuller-stack-dev merged 3 commits into
mainfrom
openclaw/r32-staged-symlink
Sep 25, 2026
Merged

fuller-stack-dev merged 3 commits into
mainfrom
openclaw/r32-staged-symlink

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add retainSymlinkInDirectory() to the advanced POSIX surface, admitting an already-staged caller-owned symlink against exact captured identity, ownership, change time and target.
  • Keep the symlink inode and original parent alive through exact-slot native no-replace publication; record published/not-published/indeterminate outcomes before fallible postchecks.
  • Provide explicit identity-guarded recovery removal and deterministic disposal, preserving observed same-target foreign replacements and uncertain outcomes.

Closes #681.

Boundaries

This is a narrow retained-symlink lifetime, not a general rename session, a change to Root.move(), or a symlink-creation API. The caller coordinates creation/capture/admission and supplies a synchronous authority assertion. The native handle pins identity after admission. Identity prechecks plus rename/unlink are not CAS; the documented final syscall gap still requires cooperative writers. Native-off, unavailable/older bindings and Windows fail before namespace mutation. No package release or crash-recovery guarantee is included.

The retained installer is the consumer. This prerequisite deliberately adopts the documented cooperative-writer contract through the final check-to-syscall gap; it does not promise adversarial CAS. Downstream installer acceptance must establish that coordination. Package release and downstream full-state update/recovery acceptance remain separate gates.

Validation

  • macOS native binding build, 34 symlink lifecycle tests, 60 affected staging tests and 12 documentation-navigation tests passed. Latest rerun: all 46 touched-file tests passed, zero skipped.
  • Two native tests prove metadata-only handle flags, retained inode lifetime and FIFO refusal. The metadata-handle regression fails the old native implementation and passes the repair; public-receipt shadowing also has observed red-before/green-after behavioral coverage.
  • Whole new test-file type graph, additive installed-package public API checks and compiled advanced-export publication/recovery smoke passed. Native-required and native-off method benchmark smoke passed, accounting for all 324 callable exports/methods, including all new lifecycle operations.
  • Exact-source independent API-direct Astra/high review is scoped-clean through P2 on ab7f5f57d9c369d09ab226aa09a974873e3c0672. It statically reviewed source and entire touched tests; it did not independently rerun tests. An earlier macOS special-file admission finding was fixed with no-follow preflight, exact opened-identity verification and metadata-only/no-controlling-terminal flags.
  • Default-concurrency pnpm check was attempted: initial docs/toolchain failures were fixed; the later run encountered six unrelated 5-second test timeouts. The serialized full run completed 15,909 tests successfully with two 5-second timeouts in unchanged queue/lock suites. Both exact suites then passed all 125 tests in isolation with unchanged timeouts; the final installed-package/export/declaration/error-code check passed. All other local check constituents passed. No all-green local aggregate is claimed. All 24 required exact-head hosted checks passed, including the default-concurrency checks, native Linux/musl/macOS/Windows, package smoke on all six OS/Node combinations, CodeQL, and merged coverage. CI · Coverage · CodeQL.
  • Entire touched JavaScript and Rust test files, fixtures/setup/disposal, and benchmark modules audited. No existing distinct regression removed or weakened. The generated public API manifest was rechecked against all package subpaths; only additive exports changed.

The new real-filesystem cases are included in the existing native Linux/macOS and musl CI lanes. Draft #665 remains independently owned; this change adds only its own module registration in native/src/lib.rs and does not alter #665’s directory-observation declarations/functions.

@clawsweeper

clawsweeper Bot commented Sep 25, 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.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 25, 2026, 2:27 PM ET / 18:27 UTC (Revision 4).

ClawSweeper review

What this changes

The branch adds an advanced POSIX API that retains a caller-staged symlink through no-replace publication and explicit recovery, with native support, tests, documentation, benchmarks, and CI coverage.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep open. Current main and v0.19.0 lack the capability, and the linked issue remains open. The branch has useful, focused coverage, but a security contract decision from the previous review remains unresolved, and cleanup has an actionable absence-settlement defect.

Priority: P2
Reviewed head: ab7f5f57d9c369d09ab226aa09a974873e3c0672
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused native coverage supports the proposal, while the final-effect boundary and an absence-settlement defect still limit merge confidence.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the PR reports real-filesystem tests and an installed-package smoke for allowed publication and substitutions before native dispatch or after publication. Available evidence does not show the intended caller excluding a forbidden replacement through final rename or unlink, nor rejection before that final effect; no stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the PR reports real-filesystem tests and an installed-package smoke for allowed publication and substitutions before native dispatch or after publication. Available evidence does not show the intended caller excluding a forbidden replacement through final rename or unlink, nor rejection before that final effect; no stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Current-main API boundary: The current advanced entrypoint exports regular-file staging but no retained-symlink lifecycle.
Release check: The v0.19.0 advanced entrypoint likewise exports regular-file staging but not this API; the branch's capability has not shipped in that release.
Existing move policy: Current Root.move source admission rejects symbolic links, so that supported path does not provide the requested retained-link publication.
Findings 1 actionable finding [P2] Handle absence after the authority callback in recovery
Security Needs attention Resolve the final identity-to-syscall gap: Native identity checks precede pathname rename and unlink. An uncooperative peer can replace a name in that gap, so the intended caller's coordination must be established before treating publication or recovery as ownership-safe.

How this fits together

The advanced package accepts a staged filesystem entry, caller-captured identity, and a synchronous authority check. Native operations use retained directory and symlink handles to publish or remove an entry, then return receipts describing the outcome.

flowchart LR
A[Caller-staged symlink] --> B[Captured identity and authority]
B --> C[Retained parent and link handles]
C --> D{Checks still pass?}
D -->|yes| E[No-replace publication or recovery]
D -->|no| F[Failure or preservation receipt]
E --> G[Publication or cleanup receipt]
Loading

Decision needed

Question Recommendation
May this public retained-symlink API rely on cooperative writers through the final native rename and unlink gap for the intended installer? Accept the bounded contract: Approve the documented non-CAS behavior after the intended caller demonstrates a lock spanning admission, publication, and recovery.

Why: The API cannot make its identity check and pathname syscall atomic, and the previous review requested an explicit decision on that security boundary.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the PR reports real-filesystem tests and an installed-package smoke for allowed publication and substitutions before native dispatch or after publication. Available evidence does not show the intended caller excluding a forbidden replacement through final rename or unlink, nor rejection before that final effect; no stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Handle absence after the authority callback in recovery (P2) - Late discovery on the unchanged reviewed head: if assertBeforeMutation removes the name after the first match, this second match throws ENOENT. removePublished() then caches a failure, and cleanup() reports failed, although the documented outcome is name-absent. Handle ENOENT at this recheck as well.
  • Resolve security concern: Resolve the final identity-to-syscall gap - Native identity checks precede pathname rename and unlink. An uncooperative peer can replace a name in that gap, so the intended caller's coordination must be established before treating publication or recovery as ownership-safe.
  • Resolve merge risk (P1) - A peer can replace the staged or published name between the native identity check and rename or unlink. The PR documents a cooperative-writer requirement, but maintainer acceptance and evidence that the intended caller holds coordination through final I/O remain outstanding.
  • Complete next step (P2) - Fix post-assertion ENOENT settlement, then obtain explicit acceptance and final-effect coordination evidence for the cooperative-writer contract.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Handle absence after the authority callback in recovery — src/native-staged-symlink.ts:162
  • [medium] Resolve the final identity-to-syscall gap — native/src/staged_symlink.rs:110
Agent review details

Security

Needs attention: The new filesystem authority path depends on a cooperative-writer boundary that still needs explicit acceptance and final-effect evidence.

Review metrics

Metric Value Why it matters
Core and test line delta production +469, tests +456 The substantial production addition has a stated purpose in the new native-backed lifecycle and is accompanied by focused tests.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #681
Summary: This PR is the candidate implementation for the linked retained-symlink request; the separately mentioned native directory-observation PR addresses a different concern.

Members:

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

Merge-risk options

Maintainer options:

  1. Approve coordinated writers (recommended)
    Accept the documented syscall gap only after evidence shows the intended caller excludes competing writers through final native I/O.
  2. Pause publication
    Defer this public API if the installer cannot provide that coordination or the required boundary includes uncooperative writers.

Technical review

Best possible solution:

Ship the narrow API with an approved cooperative-writer contract and demonstrated caller coordination through native I/O; make recovery report an absent name accurately.

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

Yes for the review finding, from source: have the synchronous authority callback remove the name after recovery's first match; the second match throws ENOENT instead of returning name-absent. This read-only review did not execute the scenario.

Is this the best way to solve the issue?

Unclear: retained handles and native no-replace publication are a focused implementation, but the public cooperative-writer boundary needs approval and recovery needs the absence fix.

Full review comments:

  • [P2] Handle absence after the authority callback in recovery — src/native-staged-symlink.ts:162
    Late discovery on the unchanged reviewed head: if assertBeforeMutation removes the name after the first match, this second match throws ENOENT. removePublished() then caches a failure, and cleanup() reports failed, although the documented outcome is name-absent. Handle ENOENT at this recheck as well.
    Confidence: 0.91
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e4178ee5393a.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the PR reports real-filesystem tests and an installed-package smoke for allowed publication and substitutions before native dispatch or after publication. Available evidence does not show the intended caller excluding a forbidden replacement through final rename or unlink, nor rejection before that final effect; no stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded new package capability with a concrete installer use case and no established current-runtime emergency.
  • merge-risk: 🚨 security-boundary: A final check-to-syscall gap makes the new ownership and recovery guarantee depend on caller coordination that has not yet been accepted.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the PR reports real-filesystem tests and an installed-package smoke for allowed publication and substitutions before native dispatch or after publication. Available evidence does not show the intended caller excluding a forbidden replacement through final rename or unlink, nor rejection before that final effect; no stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Resolve the final identity-to-syscall gap — native/src/staged_symlink.rs:110
    Native identity checks precede pathname rename and unlink. An uncooperative peer can replace a name in that gap, so the intended caller's coordination must be established before treating publication or recovery as ownership-safe.
    Confidence: 0.9

What I checked:

  • Current-main API boundary: The current advanced entrypoint exports regular-file staging but no retained-symlink lifecycle. (src/advanced.ts:20, e4178ee5393a)
  • Release check: The v0.19.0 advanced entrypoint likewise exports regular-file staging but not this API; the branch's capability has not shipped in that release. (src/advanced.ts:21, b7beb3e42997)
  • Existing move policy: Current Root.move source admission rejects symbolic links, so that supported path does not provide the requested retained-link publication. (src/root-move-noreplace.ts:79, e4178ee5393a)
  • Introduced authority path: Publication checks the retained entry and synchronous caller authority before dispatching native no-replace rename; recovery repeats checks before native removal. (src/native-staged-symlink.ts:113, ab7f5f57d9c3)
  • Final syscall gap: Native publication checks the named inode before rename, and native removal checks it before unlink. Neither final operation is an atomic identity-conditional mutation. (native/src/staged_symlink.rs:104, ab7f5f57d9c3)
  • Existing coordination contract: Regular-file staging already documents the check-to-unlink gap and requires application authorization and cooperative locking; extending that contract to this new public symlink API remains a maintainer choice. (docs/staged-file.md:171, e4178ee5393a)

Likely related people:

  • steipete: 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.

  • Handle ENOENT at the recovery recheck and cover a callback that removes the name.
  • Add final-effect proof for the nearest unauthorized replacement and show that caller coordination excludes it before I/O; obtain explicit acceptance of the resulting contract.

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 (3 earlier review cycles)
  • reviewed 2026-09-25T17:56:52.103Z sha c199e76 :: blocked before merge. :: none
  • reviewed 2026-09-25T18:07:49.871Z sha bc02ee5 :: blocked before merge. :: none
  • reviewed 2026-09-25T18:21:33.013Z sha ab7f5f5 :: blocked before merge. :: none

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 25, 2026 18:03
@fuller-stack-dev
fuller-stack-dev requested a review from a team as a code owner September 25, 2026 18:03
@fuller-stack-dev
fuller-stack-dev merged commit 579891d into main Sep 25, 2026
38 checks passed
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 25, 2026
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/r32-staged-symlink branch September 25, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(advanced): retain staged symlink identity through no-replace publication

1 participant