Skip to content

feat(atomic): add retained-directory file staging - #151

Merged
steipete merged 5 commits into
mainfrom
steipete/retained-directory-staging
Aug 28, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/retained-directory-staging

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Consumers aborting a native write after the actual parent directory was moved could leave an unpublished temporary file in the moved original. Directory guards correctly rejected pathname drift, but cleanup still resolved the old pathname. A canonical pathname or an identity receipt alone cannot retain authority to that original directory.

Consumers performing application checks between preparation and publication also lacked an exported lifecycle that retained this cleanup authority.

Why This Change Was Made

Add stageFileInDirectory() to the existing @openclaw/fs-safe/advanced surface, with one owner for exclusive preparation, identity checks, publication, cleanup, and async disposal. Direct-child native creation hands off its descriptor before fallible post-open checks; exact descriptor/name checks and unlinkat keep cleanup attached to the original directory. POSIX native streaming writes reuse this owner instead of keeping a second pathname-only cleanup path.

Unpublished contents stay at 0600 until the published entry passes its identity fence. Publication is recorded before permission finalization and post-checks; errors retain that recorded outcome, including after closure. Known namespace failures are not mislabeled as uncertain I/O; genuinely indeterminate rename outcomes remain explicit.

Footprint cleanup

The follow-up cleanup reduces net production growth from +699 to +623 lines: 76 fewer lines (10.9%), discounting moves. Native writers now share root/parent admission, and staging and clone/copy share exact Unix child-removal mechanisms. The unnecessary promise queue, forwarding factory, exception-driven internal cleanup transport, duplicate open flags, and hand-written POSIX coordinator disposal plumbing are removed. Synchronous lifecycle methods remain await-free and preserve invocation order; one finalizer records cleanup and closes resources once.

POSIX coordinator double failures use standard SuppressedError, retaining both the operation error and disposal error with their receipts. Public staged preparation/cleanup mappings and cached errors are unchanged. Existing Windows leaf behavior and close policy remain distinct. Directory durability was deliberately not folded into staging: pathname-current durability checks and retained-original-directory cleanup are different contracts, with different identity/platform requirements. Combining them would need a larger policy abstraction or weaken a guarantee.

User Impact

The new API accepts buffered contents and an existing directory or directory receipt. Its staged object exposes assertCurrent(), explicit replace/no-replace publish(), cleanup(), and async disposal. It exposes no raw descriptors, writable-path callbacks, arbitrary child removal, or parent creation/permission changes. See the API and guarantee documentation.

The lifecycle is native-required on Linux/macOS and rejects before file creation when support is off, absent, or unavailable. Windows is explicitly unsupported for this new API. Existing Windows native writes, JavaScript fallbacks, and pinDirectory().assertCurrent()/.sync() retain their contracts. Published mode 000 is supported without reopening the staged inode.

Directory-relative cleanup is not expected-inode/CAS replacement or atomic conditional unlink. The recorded temporary name must remain owned and removal must remain permitted; arbitrary leaf-renaming recovery, permission-revocation recovery, and crash cleanup are not promised. Namespace success is not a crash-durability guarantee. Application authorization, checks, locks, fingerprints, and rollback remain caller-owned.

No dependency, version, or configuration changes; no package publication or OpenClaw dependency adoption.

Evidence

Regression and local proof

The original real-native stream-abort regression failed before the feature because an extra .native.tmp remained in the moved original. It passes with retained-directory ownership, while original destinations and replacement-parent sentinels preserve bytes, modes, and identities. Additional red-to-green cases protect private-until-publication permissions, ordinary publication errors, and closed-stage outcome receipts.

The cleanup's frozen source passed the full local gate: 1,243 tests passed, 112 skipped, across 108 passing and four skipped files. Focused native/adjacent proof passed 316 tests, five platform skips; additional lock/fsync siblings passed 27 tests, six platform skips. 25 Rust tests, strict Clippy, owned Rust formatting, documentation examples/site, export/package checks, and bundled package smoke passed. The cleanup's local source/build/test gates passed without timeouts, and no test deadline or assertion was weakened. Earlier feature-development full runs hit host-load timeouts; the successful serial gate and hosted runs are retained as historical evidence, not substituted for this cleanup's fresh run.

Fresh isolated Codex autoreview reported no actionable P0 findings at its default threshold. This is not an all-priority audit.

Local runtime: Node 24.20.0 on macOS arm64, pnpm 10.34.5, Rust 1.98.0. The unreleased host-native tarball has SHA-256 aa794e50a9cfa7e555cd00bfd09d65ca19eac9e38e01f250f54e1e96aa7caa46. Package smoke covers native loading, native-absent auto fallback, and required-mode rejection. No real service or production state was used.

Commands:

VITEST_MAX_WORKERS=1 pnpm check
pnpm build
pnpm native:build
VITEST_MAX_WORKERS=1 FS_SAFE_PAX_REQUIRE_NATIVE=1 pnpm test test/native-staging-regression.test.ts test/staged-file.test.ts test/staged-file-failures.test.ts test/native-integration.test.ts test/native-write-containment.test.ts test/native-archive-equivalence.test.ts test/native-publish-equivalence.test.ts test/private-directory.test.ts test/directory-durability.test.ts test/publish-file-failure.test.ts test/archive-pax.test.ts test/archive-pax-security.test.ts test/archive-pax-compressed.test.ts
VITEST_MAX_WORKERS=1 pnpm test test/sidecar-lock-acquire-failure.test.ts test/sidecar-lock-regression.test.ts test/sidecar-lock-windows-denial.test.ts test/pinned-write-fsync.test.ts
cargo test --workspace --locked
cargo clippy --workspace --locked -- -D warnings
rustfmt --edition 2024 --check --config skip_children=true native/src/staged_file.rs native/src/unix.rs
pnpm docs:check
pnpm docs:site
node scripts/check-pack.mjs
pnpm package:smoke
git diff --check

Full-workspace Rustfmt remains blocked by inherited formatting differences in unchanged main PAX files (native/src/tar_meter.rs, native/src/tar_meter_tests.rs, native/src/tar_pax.rs). The cleanup-owned Rust files pass the scoped check; unrelated files were not reformatted.

Consumer proof

The independently authored consumer harness was replayed against the smaller package, rather than rewriting assertions to fit the refactor. 63 unchanged cases passed, covering payloads, private/final modes, moved parents/ancestors, sentinel preservation, substitutions, real permission failures, concurrent ordering, closed outcomes, native-off/absent rejection, and existing fallback writes. Only candidate hash/source-identity metadata was refreshed.

The original 4 MiB preparation observer moved the directory after preparation had completed: cleanup succeeded, but that attempt correctly remained untriggered for the preparation-failure phase. A separate bounded 64 MiB payload, with the same observer and assertions and no timeout changes or implementation hooks, moved the parent immediately after creation. Preparation rejected with path-mismatch, removed its temporary entry from the moved original, and preserved the original destination plus both replacement sentinels. This completes the 64-case observable coverage. Both attempts remain recorded; no target defect was observed, no warnings were suppressed, fixtures were removed, and the candidate hash/primary native package remained unchanged. This is a replay of previously independent probes, not a newly authored source-blind review.

Four internal fault categories remain outside black-box coverage: preparation I/O/mode/sync/close faults independent of drift, post-commit faults, indeterminate rename results, and close failure/deterministic descriptor recycling. The implementation-aware fault suite exercises those through controlled injection around real native operations. Its added coordinator cases retain both errors and verify the surviving file's bytes/private mode; clone/copy cleanup also has sibling proof.

Fresh pre-land live proof

A new independent source-blind consumer passed 59/59 live cases against the freshly built native package on Node 24.20.0, macOS arm64. It verified original-directory cleanup and sentinel preservation, private/final modes including 000, substitutions, real permission errors, lifecycle ordering, stale receipts, native-off/absence rejection, and continued existing fallback writes. All three separate 64 MiB observers moved the parent immediately after creation; preparation rejected and removed the original temporary file. A diagnostic-only repeat with ordinary Node warnings enabled also passed 59/59, with no captured warnings and empty stderr. Original attempts were preserved; no target defect or assertion change was needed.

The live lane explicitly leaves nine internal fault categories partial/blocked rather than claiming full C6 coverage; the existing owner-aware native tests cover corresponding error handling. Final source clarification only changes the Windows-capability comment and produces a byte-identical entire tarball (all 450 files, including 135 runtime/binary files). All owned runtime fixtures and the secondary package were removed. Fresh full-branch and comment-only autoreviews reported no actionable P0 findings.

Final live evidence and disposition of the latest review checklist record the accepted advanced/non-CAS contract, exact current-base CI, and why a separately upgraded old native binary is not a supported package state. The latest review has cleared that earlier compatibility finding; no runtime fallback was added.

Windows coverage follow-through

The first cleanup head passed all 15 CI jobs, benchmarks, and CodeQL, but Windows coverage failed an existing synthetic secret-file identity mismatch test. Its guard and test were unchanged across the branch, main, and actual merge checkout. The failed run used Node 22.23.2, pnpm 11.24.0, and Vitest 4.1.11; its original identity values and spy consumption were not logged, so no particular collision or zero-ID incident is claimed.

The fixture assumed another file's default numeric stat necessarily differed. Distinct 64-bit IDs can round to the same JavaScript number. Both synthetic secret/secure-file mismatch fixtures now preserve real Stats shape/mode/type, inject an explicitly distinct nonzero inode using the existing archive-test idiom, and assert that the injection was consumed. Unnecessary second-file setup was removed; real rename/replacement regressions and all production policy remain untouched. Each focused native-required and native-off run passed 40 tests with one platform skip. Fresh review of this test-only correction also reported no actionable P0 findings. The tarball and production source are unchanged from the cleanup proof above.

Exact-head hosted proof

Final head 80340e2 is green:

  • CI: all 15 jobs passed—six Node 22/24 fallback combinations, Linux/macOS/Windows native checks, musl, three package-smoke platforms, workflow lint, and Cargo quality/audit.
  • Coverage: all three native-enabled Node 22 platform collections and merged thresholds passed, including the corrected Windows fixture.
  • Benchmarks: passed.
  • CodeQL: passed.

Final native CI's checkout log pins merge f015221b01ca55ca44ddf32b8d990808c198b53a, whose parents are current main 9603da1bbfce5dc6ae8239296f1111f2da34339b and final head 80340e2448488ede3b24d767b6e96e0c75821603.

LOC and scope

Category Before cleanup After cleanup Cleanup delta
Production, net +699 (+855/−156) +623 (+801/−178) −76
Tests, including Rust test blocks +807 +883 +76
API inventory +7 +7 0
Docs/changelog +216 +221 +5
CI/navigation tooling 0 0 0

Counts use the original PR base f88c3d1, split Rust test blocks out, and count moves as zero savings. No existing protected behavior/tests or public receipt fields were removed. The remaining positive production delta supplies the new retained-directory lifecycle, exact identity/native mechanisms, and explicit publication/cleanup outcomes; those are the capability, not compatibility scaffolding. No generated output is committed.

The separately reproduced existing Root.write mode-000 outer-verification failure remains outside this PR's scope. src/root-impl.ts and the existing runPinnedWriteHelper input/result contract are unchanged by this cleanup. A separate follow-up is also recorded to preserve exact 64-bit Windows identities across native/Node comparisons; the synthetic-fixture correction does not claim to repair that pre-existing runtime precision limitation.

  • Tests added or updated when behavior changed
  • Security and compatibility impact considered
  • CHANGELOG.md updated when release-relevant
  • No credentials, private paths, private hosts, or sensitive contents included

Add stageFileInDirectory under advanced with one owner for exclusive
preparation, identity checks, publication, abort cleanup, and disposal.
Retain the original parent descriptor so moving its pathname cannot
strand an otherwise owned unpublished temporary file.

Share the lifecycle with POSIX native streaming writes. Keep unpublished
contents private until the published entry is identity-checked, preserve
native error provenance, and distinguish committed or uncertain outcomes
from failures that still permit abort cleanup.

The new API requires native support on Linux/macOS. Existing Windows and
JavaScript fallback contracts remain intact. Application authorization,
cooperative locking, rollback, expected-inode publication, and crash
recovery remain outside this lifecycle.

Add real-filesystem regressions, fault/lifecycle coverage, public API
documentation, and native CI coverage without changing dependencies or
publishing a package.
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 2:48 AM ET / 06:48 UTC.

ClawSweeper review

What this changes

The PR adds native Linux/macOS retained-directory file staging so aborted writes can remove an unpublished temporary file after its parent directory moves.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 5 items remain

Keep open for maintainer review: the exact-head implementation appears correct, has real native regression evidence, and adds a deliberate new public advanced API that needs acceptance rather than cleanup closure.

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

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: ClawSweeper live verification failed on the reviewed terminal surface. 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 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: ClawSweeper live verification failed on the reviewed terminal surface. 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 8 items Retained-descriptor implementation: The stage records the newly created descriptor before subsequent metadata, write, or sync work, and finalization removes only the matching direct child through the retained parent descriptor.
Native confinement mechanism: Native creation is exclusive and no-follow, while matching and removal use non-following metadata beneath the retained directory descriptor.
Shared writer preserves POSIX behavior: The existing native pinned-write path transfers its admitted POSIX parent to the stage owner, while Windows retains its separate writer implementation.
Findings None None.
Security None None.

Live Verification

Command: pnpm native:build && FS_SAFE_PAX_REQUIRE_NATIVE=1 pnpm test test/native-staging-regression.test.ts test/staged-file.test.ts test/staged-file-failures.test.ts

Result: FAIL (failed) — step 1 expect_output Test Files: terminal command failed with exit status 1: "pnpm native:build && FS_SAFE_PAX_REQUIRE_NATIVE=1 pnpm test test/native-staging-regression.test.ts test/staged-file.test.ts test/staged-file-failures.test.ts"

[failure]
terminal command failed with exit status 1: "pnpm native:build && FS_SAFE_PAX_REQUIRE_NATIVE=1 pnpm test test/native-staging-regression.test.ts test/staged-file.test.ts test/staged-file-failures.test.ts"

[command 1 combined output]
› @openclaw/[email protected] native:build /tmp/clawsweeper-live-proof-151-zNnYsG/target
› pnpm --filter @openclaw/fs-safe-native-build build


› @openclaw/[email protected] build /tmp/clawsweeper-live-proof-151-zNnYsG/target/native
› napi build --platform --release && node ../scripts/stage-host-native.mjs

Internal Error: cargo metadata exited with code 1 and error message:

error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.


error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

    at execCargoMetadata (file:///tmp/clawsweeper-live-proof-151-zNnYsG/target/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]
lpha.3_@[email protected]/node_modules/@napi-rs/cli/dist/cli.js:3038:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async buildProject (file:///tmp/clawsweeper-live-proof-151-zNnYsG/target/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]
alpha.3_@[email protected]/node_modules/@napi-rs/cli/dist/cli.js:6806:19)
    at async BuildCommand.execute (file:///tmp/clawsweeper-live-proof-151-zNnYsG/target/node_modules/.pnpm/@[email protected]_@[email protected]_@emnapi+runtim
[email protected]_@[email protected]/node_modules/@napi-rs/cli/dist/cli.js:12355:20)
    at async BuildCommand.validateAndExecute (file:///tmp/clawsweeper-live-proof-151-zNnYsG/target/node_modules/.pnpm/[email protected][email protected]/node_
modules/clipanion/lib/advanced/Command.mjs:49:26)
    at async Cli.run (file:///tmp/clawsweeper-live-proof-151-zNnYsG/target/node_modules/.pnpm/[email protected][email protected]/node_modules/clipanion/lib/ad
vanced/Cli.mjs:227:24)
    at async Cli.runExit (file:///tmp/clawsweeper-live-proof-151-zNnYsG/target/node_modules/.pnpm/[email protected][email protected]/node_modules/clipanion/li
b/advanced/Cli.mjs:236:28)
/tmp/clawsweeper-live-proof-151-zNnYsG/target/native:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @openclaw/[email protected] build: ˋnapi build --platform --release && node ../scripts/stage-host-native.mjsˋ
Exit status 1
 WARN   Local package.json exists, but node_modules missing, did you mean to install?
 ELIFECYCLE  Command failed with exit code 1.

Assertions:

  • FAIL expect_output: Test Files

How this fits together

The atomic-write subsystem prepares private files beneath guarded directories, then publishes or removes them. This change retains the original directory descriptor through that lifecycle so cleanup can still address it after pathname drift.

flowchart LR
A[Caller content and directory] --> B[Retained directory owner]
B --> C[Private staged file]
C --> D{Publish or abort}
D -->|Publish| E[Identity-checked final file]
D -->|Abort| F[Cleanup in original directory]
Loading

Decision needed

Question Recommendation
Should retained-directory cleanup be accepted as a permanent exported advanced API for callers that need abort cleanup after parent-directory moves? Accept the advanced lifecycle: Keep the exported API and land it after current-head native validation confirms the documented confinement and cleanup behavior.

Why: The implementation is narrowly scoped and documented, but exporting a new filesystem-security lifecycle creates a long-lived package contract that cannot be decided from correctness evidence alone.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: ClawSweeper live verification failed on the reviewed terminal surface. 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.
  • Resolve merge risk (P1) - This introduces a permanent advanced API at a filesystem-security boundary; its documented identity-check-then-unlink limitation still requires callers to retain their own authorization and coordination.
  • Resolve merge risk (P1) - The available local checkout could not materialize fetched main for an additional current-base comparison, so exact-head native checks should finish before merge.
  • Complete next step (P2) - A maintainer must decide whether to support this new exported filesystem lifecycle; no narrow automated repair is identified.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 29 files, +1929/-195 lines The PR changes a public API, native filesystem mechanisms, documentation, CI coverage, and regression tests.

Merge-risk options

Maintainer options:

  1. Refresh native proof on the current base (recommended)
    Before merging, complete exact-head native checks after current-base refresh to confirm the public lifecycle and existing pinned writes remain compatible.
  2. Accept the documented advanced contract
    Land the API with the explicit non-CAS cleanup limitation and caller-owned authorization and locking obligations.

Technical review

Best possible solution:

Adopt the lifecycle only as a clearly advanced API with its retained-directory, non-CAS, and caller-coordination limits preserved in documentation and native regression coverage.

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

Yes: the focused native regression moves a parent after stream staging and verifies original-directory cleanup plus replacement-directory preservation; it is source-reproducible from the exact head.

Is this the best way to solve the issue?

Unclear: retained directory descriptors are a narrow technical solution, but maintaining the new exported lifecycle is a product-contract decision for maintainers.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a substantial advanced atomic-write improvement without evidence of an active user outage.
  • add merge-risk: 🚨 security-boundary: The change controls descriptor-retained file publication and cleanup under attacker-controlled pathname conditions.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦞 diamond lobster.
  • remove P1: Current review triage priority is P2, so this older priority label is no longer current.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This is a substantial advanced atomic-write improvement without evidence of an active user outage.
  • merge-risk: 🚨 compatibility: Existing POSIX native pinned writes now share the new staging owner and public advanced exports are added.
  • merge-risk: 🚨 security-boundary: The change controls descriptor-retained file publication and cleanup under attacker-controlled pathname conditions.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: ClawSweeper live verification failed on the reviewed terminal surface. 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

What I checked:

  • Retained-descriptor implementation: The stage records the newly created descriptor before subsequent metadata, write, or sync work, and finalization removes only the matching direct child through the retained parent descriptor. (src/native-staged-file.ts:161, 80340e244848)
  • Native confinement mechanism: Native creation is exclusive and no-follow, while matching and removal use non-following metadata beneath the retained directory descriptor. (native/src/staged_file.rs:18, 80340e244848)
  • Shared writer preserves POSIX behavior: The existing native pinned-write path transfers its admitted POSIX parent to the stage owner, while Windows retains its separate writer implementation. (src/native-pinned-write.ts:74, 80340e244848)
  • Regression coverage: The native regression test moves the parent during a real stream write, verifies replacement-directory sentinels, and confirms the moved original contains no temporary file. (test/native-staging-regression.test.ts:130, 80340e244848)
  • Prior compatibility concern resolved by package boundary: The loader imports only the package’s bundled native binary; the optional staging methods describe the intentionally different Windows binary, not an independently upgraded POSIX ABI. (src/native.ts:169, 80340e244848)
  • Feature provenance: History shows the staging feature originated in commit 4896c4d and was followed by the ownership refactor and exact-head documentation clarification. (src/native-pinned-write.ts:12, 4896c4dbeb42)

Likely related people:

  • steipete: History attributes both the retained-directory staging feature and earlier merged native filesystem-safety work to this contributor. (role: feature and adjacent security-work author; confidence: high; commits: 4896c4dbeb42, bd3a95e91d3e, 2958fb56d3b3; files: src/native-pinned-write.ts, src/native-staged-file.ts, native/src/unix.rs)

Rank-up moves

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

  • Add after-fix proof from a real setup, such as a short recording, terminal output, linked artifact, or redacted logs.

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 (4 earlier review cycles)
  • reviewed 2026-08-28T04:07:45.794Z sha 0627253 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-28T04:28:05.128Z sha 0627253 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-28T05:54:53.144Z sha bd3a95e :: needs real behavior proof before merge. :: [P1] Preserve automatic fallback for incomplete native bindings
  • reviewed 2026-08-28T06:18:01.562Z sha 5da4701 :: needs real behavior proof before merge. :: [P1] Preserve automatic fallback for incomplete native bindings

@steipete
steipete marked this pull request as ready for review August 28, 2026 04:23
@steipete
steipete requested a review from a team as a code owner August 28, 2026 04:23
Share native writer admission and exact Unix child cleanup, remove the synchronous lifecycle queue and forwarding factory, and use standard POSIX coordinator disposal while preserving public receipts and Windows close semantics. Reduce net production growth by 76 lines without counting moves or removing protected behavior.
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 28, 2026
Use distinct nonzero numeric inode fixtures instead of assuming another file always has a different Number identity, and verify the injected stat is consumed. Preserve real replacement tests and production identity policy.
@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. and removed P2 Normal priority bug or improvement with limited blast radius. labels Aug 28, 2026
Optional staging methods describe the matching Windows binary, not a supported independently upgraded native ABI. JavaScript and native code ship as one package; runtime behavior and packed bytes are unchanged.
@clawsweeper clawsweeper Bot added 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof and review disposition

Final head: 80340e2448488ede3b24d767b6e96e0c75821603.

A fresh, independently authored source-blind consumer run passed 59/59 live cases on Node 24.20.0, macOS arm64. This used the packed native package and real filesystem operations, not repository mocks. Observed results included:

  • Parent replacement, rename-only, ancestor replacement, and caller-pinned variants: cleanup removed the owned temp from the moved original while original destinations and replacement temp/final sentinels retained their bytes, modes, and device/inode identities.
  • Three independent 64 MiB preparation observers moved the parent immediately after exclusive creation, each seeing size zero before preparation settled. All three preparations rejected path-mismatch, removed the original temporary entry, and preserved replacement sentinels.
  • Create-only and overwrite publication at mode 000 preserved exact bytes and inode through caller-owned read handles. Ordinary pathname reads returned EACCES; no chmod was used to manufacture the proof.
  • Native off and actual native absence rejected staging before creation, while existing Root.write/Root.create continued to work with the documented off/automatic fallback modes. Real permission failures, substitutions, repeated closure, and immediate method ordering also passed.

The artifact SHA-256 is aa794e50a9cfa7e555cd00bfd09d65ca19eac9e38e01f250f54e1e96aa7caa46. The final clarification changes a source comment only: rebuilding and packing produced an identical entire tarball, including all 450 files and 135 runtime/binary files. Primary package bytes and supplied inputs were preserved; all owned runtime fixtures and the secondary package copy were removed.

C6 is deliberately partial/blocked in this black-box lane for nine internal fault categories: independent preparation write/chmod/sync/close failures, post-commit validation/sync failures, indeterminate rename, retained-resource close failure, and deterministic recycling of hidden descriptors. Those are not inferred from successful calls. The separate real-native fault-injection suite covers the corresponding owner-boundary handling. No CAS, atomic conditional unlink, arbitrary-name recovery, crash cleanup, or macOS-to-Windows/Linux extrapolation is claimed.

Latest ClawSweeper checklist and maintainer decision

The latest review of this exact head, reviewed at 06:48 UTC, has cleared the earlier mixed-binary compatibility finding. Its four before-merge items and optional rank-up move are addressed as follows:

  • Real behavior / after-fix setup proof: supplied above. The diagnostic-only repeat also passed all 59 cases with ordinary Node warnings enabled, zero captured warnings, and empty parent/capability stderr. The first run and its listener-captured diagnostics remain preserved; the repeat removed only warning-suppression flags. The bot's own attempt stopped at an unconfigured Rust toolchain before reaching behavior tests; the successful local build selected Rust 1.98.0 explicitly, while normal package consumers need no Rust build.
  • Filesystem-security contract and maintainer support decision: the owner-directed landing accepts this explicitly advanced lifecycle with its documented retained-directory, non-CAS, non-atomic-conditional-unlink limits. Authorization, manager checks, snapshots, locking/coordination, and rollback remain caller-owned. The API does not silently acquire broader guarantees.
  • Current-base/exact-head proof: final native CI checked out f015221b01ca55ca44ddf32b8d990808c198b53a, whose parents are current main 9603da1bbfce5dc6ae8239296f1111f2da34339b and final head 80340e2448488ede3b24d767b6e96e0c75821603. All final checks completed successfully; this is actual checkout-log/commit-parent proof, not inference from stale PR base metadata.

For the resolved earlier finding: the loader is byte-identical to shipped v0.5.6 and loads only the package-local bundled binary. The shipped policy specifies one matching complete artifact, not independently upgraded native code. Optional staging methods describe the matching Windows binary; the comment now says so precisely. No mixed-artifact compatibility fallback was introduced. The actual supported native-absent/off fallback paths were live-tested.

Final validation

CI: all 15 jobs passed, including Linux/macOS/Windows native and package checks, musl, and the Node 22/24 fallback matrix. Coverage, including Windows and merged thresholds, benchmarks, and CodeQL passed. Fresh isolated Codex review of the full branch and the comment-only clarification reported no actionable P0 findings; this is not an all-priority audit.

Fresh local build/package commands:

pnpm build
pnpm native:build
pnpm package:smoke
git diff --check origin/main...HEAD

The PR body retains the full regression/local command ledger, earlier Windows fixture correction, and scoped Rustfmt limitation. Production growth remains +623 rather than +699. This landing does not publish a version, adopt the dependency in OpenClaw, or absorb the separate Root mode-000 repair.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(atomic): add retained-directory file staging This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit d733275 into main Aug 28, 2026
30 checks passed
@clawsweeper clawsweeper Bot mentioned this pull request Sep 9, 2026
3 tasks done
@vincentkoc
vincentkoc deleted the steipete/retained-directory-staging branch September 25, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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.

1 participant