Skip to content

fix: preserve exact filesystem identities through recovery - #169485

Merged
steipete merged 2 commits into
mainfrom
fix/fs-safe-0.26.2-long-paths
Oct 13, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/fs-safe-0.26.2-long-paths

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Prevents large file IDs from being rounded during guarded reads, recovery, and cleanup, and delegates private Windows long-path creation to fs-safe.

User Impact

Private directories and files retain their protected-ACL and exclusive-creation behavior while fs-safe owns Windows path handling. Exact receipts detect replacements whose file IDs collapse to the same JavaScript number. Existing numeric recovery receipts remain accepted, preserve permission bits, and upgrade after a verified exact observation on their next write.

Legacy numeric receipts retain their original precision limit: replacements with the same rounded identity cannot be distinguished until an exact receipt is recorded. This compatibility decision is deliberate; exact receipts continue to compare every bit.

Why This Change Was Made

The dependency pin, bundled plugin manifests, lockfile, expiring cooldown exemptions, and original exact-identity migration already landed in #169469. This PR preserves that work and completes the direct fs-safe consumers and compatibility readers. It removes OpenClaw's Windows namespacing adapter without changing creation-refusal tracking or native descriptor ownership.

The remaining changes carry fs-safe's exact receipts into workspace revisions, plugin artifacts, media staging, migration claims, service backups, memory-export markers, and agent deletion. There is no new CLI, configuration option, or fs-safe API.

Scope and related exclusions

The replacement branch excludes deployment controllers, PR tooling, UI components and end-to-end tests, upgrade-survivor scripts, CI inventories, and generic Node-only identity cleanup. Those changes have no dependency on the fs-safe 0.26.2 result shapes and are separate work.

The local-avatar production reader and its fixture are retained because the reader encodes openRootFileSync.exactIdentity; this is distinct from unrelated avatar rendering repairs. The systemd mutation owner must compare its staged identity against the service reader's exact decimal receipt, with its existing ownership and mode checks preserved.

The five-line audit worker registration is required by the new recovery regression: without it, the full typecheck reports TS2339 for storageProcessTestEntrypoints.auditRecovery. The existing worker-build owner consumes that registry, so no CI wrapper or inventory change is needed.

Evidence

Candidate: bec6a6517f2a836447b90f4b6dd9f109354fe10e. Rebase baseline: 36e78f215f1f058af15919da8a60c06797a759e8. The two commits apply without conflicts and retain identical patches; the diff is limited to 54 files.

  • Fresh independent scoped review of this exact head against its pinned merge base: clean, no actionable P0–P2 findings.
  • Focused Node proof: all 33 selected files passed on the patch-identical pre-rebase candidate, 622 tests total. The 24-file grouped command took 3,700.52 seconds; the remaining nine files were recorded separately.
  • Bun 1.4.3: all 29 previously unrun files passed on this head, 488 tests, zero failures, 922.37 seconds across nine shards. The earlier four-file run recorded 124 passes and 11 failures. All 33 selected files have now run; no candidate-caused failure was found.
  • The 11 Bun managed-media failures reproduce on this pinned main base: 35 passed / 11 failed, 237.15 seconds. Failed case names and primary errors match the earlier candidate: successful fs.promises.access() returns null, while the unchanged assertions expect undefined.
  • Full pnpm tsgo:all and pnpm build passed on the patch-identical pre-rebase stack; the build took 1,192.47 seconds wall time, including artifact-lock wait. Fresh rebased reruns were interrupted after the CI attribution stop: typecheck exit 143 at 3,877.89 seconds, build exit 143 at 2,953.86 seconds. Those interrupted runs are not passing evidence; the typecheck completed core/UI projects, then waited for the build artifact lock, and the build stopped during package declarations. Targeted lint/format and git diff --check passed.
  • Cold-process import of the existing @openclaw/fs-safe/advanced subpath on macOS ARM64: Node 26.11.1, 119.744 ms; Bun 1.4.3, 63.718 ms. Filesystem caches were uncontrolled. No new subpath or public API is added.
  • A simultaneous Windows x64 and ARM64 comparison used baseline 2276c935261aadb4d6ba7f027a50bec1dd1d2384 and candidate 0b5953e7f2a7f9a766bb5cd6d2c394907f31d0f8, with Node 24.21.0 and Bun 1.4.3 on each native architecture. Private directory/file creation, protected ACLs, long paths, and real Worker coverage passed in every cell. Full jobs remained red on both revisions with the same failing case names and primary errors; no candidate-only failures were found.
Native architecture / runtime Private creation, including Worker Snapshot long paths Service backup baseline → candidate Agent mutation baseline → candidate New audit recovery
Windows x64 / Node 15 pass, 4 skip 2 pass 35 pass / 14 fail → 37 pass / 14 fail 42 pass / 24 fail → 52 pass / 24 fail 4 pass
Windows ARM64 / Node 15 pass, 4 skip 2 pass 35 pass / 14 fail → 37 pass / 14 fail 42 pass / 24 fail → 52 pass / 24 fail 4 pass
Windows x64 / Bun 15 pass, 4 skip 2 fail on both 35 pass / 14 fail → 37 pass / 14 fail 42 pass / 24 fail → 52 pass / 24 fail 4 pass
Windows ARM64 / Bun 15 pass, 4 skip 2 fail on both 35 pass / 14 fail → 37 pass / 14 fail 42 pass / 24 fail → 52 pass / 24 fail 4 pass

Service suites additionally skip three platform-specific cases; agent suites skip one. The baseline has no new audit-recovery file. Existing cross-platform service/agent fixture failures are unchanged; Bun snapshot cleanup reports retained SQLite handles (EBUSY) on both heads. These are recorded failures, not a green full-suite claim. Unrelated Windows fixture and runtime repairs remain outside this PR. Exact-head PR CI run 38313787621 completed with failure: 70 successful jobs, 22 skipped jobs, and two failed jobs. checks-node-changed-extensions-bundle-1-1 failed 27 cases across the four files below; openclaw/ci-gate failed as its aggregate. Security, lint, typecheck, docs, and all nine UI E2E jobs passed. The build-artifacts job was not selected.

Inherited Bun managed-media failures
  • retains an aged transient record while its session still has an active run
  • retries a durably claimed file deletion after a filesystem failure
  • does not reap old unindexed files while legacy metadata still exists
  • does not let a valid fallback mask an unreadable exact row
  • retains history when a healthy configured store masks an unreadable candidate
  • reads each session transcript once while evaluating committed records
  • does not delete files still referenced by other sessions during session-scoped cleanup
  • retains other selected-agent global records during scoped cleanup
  • uses the recorded owner for unscoped session keys
  • treats legacy unscoped global records as the configured default agent
  • retains ownerless global records when no compatibility owner exists

Each fails with expected null to be undefined on the pinned main base as well as the earlier candidate. These assertions were not weakened or skipped.

Landing Stopped: CI Attribution Incomplete

Failed test owner Failed cases Observed failure
extensions/codex/src/app-server/run-attempt.context-engine.test.ts 15 Context-engine lifecycle timeouts and missing prepared runtime configuration
extensions/memory-core/src/chunking-upgrade-real-transport.test.ts 5 Runtime config is not prepared
extensions/codex/src/app-server/dynamic-tool-build.sandbox.test.ts 6 Runtime config is not prepared
extensions/mxc/test/plugin.test.ts 1 Backend registration remains after registry retirement

The CI failure reporter classifies the extension job as unknown, with “No matching job on main.” Scheduled main run 38311154418 contains the same missing-runtime-config guard failure in core suites, but runs none of these extension test cases. That is not sufficient matching baseline evidence for all 27 cases, especially the separate MXC assertion. None of these failures is being relabeled as inherited or green.

Additional local extension baseline probes were interrupted without a completed result after the attribution gate stopped landing. The PR remains open at the reviewed head; no admin exception or merge was submitted. The old head remains preserved on backup/fs-safe-0.26.2-o17. No unrelated fixture, timeout, CI inventory, or workflow changes were added to this replacement.

@clawsweeper

clawsweeper Bot commented Oct 12, 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 P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR carries exact filesystem identities through reads, caches, recovery receipts, and cleanup while retaining released numeric receipt readers.

Example: Delete agent victim on NTFS with a cleanup-path inode of 9007199254740993.

  • Before: Cleanup rejects the inode because it exceeds JavaScript's safe integer range.
  • After: Cleanup retains the exact decimal identity and proceeds when ownership and replacement checks pass.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, coherent source changes with meaningful boundary regressions; the required stored-data qualification remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor media gate; production-owner harnesses and reported Windows runs support the change, but no completed latest-stable upgrade qualifies its changed persisted formats.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Ordinary NTFS file IDs can prevent agent deletion, while rounded identities can miss replacements during cache and recovery checks.
Reason: The repair addresses a documented release failure and follows maintainer-approved exact-identity integration with an explicitly accepted legacy compatibility limit.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open: it addresses a confirmed Windows cleanup failure and preserves exact identities across recovery paths; no concrete introduced defect was found.

Priority: P2
Reviewed head: bec6a6517f2a836447b90f4b6dd9f109354fe10e

Before merge

  • Complete next step - Compare the 27 failed extension cases with the pinned baseline in matching conditions, and repair only failures demonstrated to be caused by this PR.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a completed v2026.10.2-to-candidate upgrade exercising retained service receipts, interrupted audit recovery, memory markers, and pending deletion state with settings and surviving data intact.
Agent review details

How this fits together

OpenClaw consumes fs-safe filesystem observations, retains identity receipts in application recovery state, and checks those receipts before reading, restoring, publishing, or removing files.

flowchart TD
  A[Filesystem observations] --> B[fs-safe exact identities]
  B --> C[Reads and cache revisions]
  B --> D[Recovery receipt writers]
  E[Released numeric receipts] --> F[Compatibility readers]
  D --> F
  F --> G[Owner and replacement checks]
  G --> H[Restore publish or cleanup]
Loading

Technical review

Best possible solution:

Retain exact observations and the documented legacy readers, then qualify release-upgrade compatibility and the outstanding CI failures before landing.

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

Current main deterministically rejects cleanup identities outside the safe integer range, matching independently reported Windows release failures; this review ran no target code.

Is this the best way to solve the issue?

Using fs-safe's exact receipts at existing owners fixes the precision loss without adding a weaker path-based fallback or competing filesystem implementation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • fs-safe identity consumers keeps the original intent (0cea8cd: The merged dependency update introduced exact receipts while retaining numeric metadata.)
  • Service publication and recovery comparisons keeps the original intent (feat(update): retain compatible package rollback and safe recovery admission #140339: Recovery retains verified package and service facts without treating serialized identities as live mutation authority.)
  • Audit restore journals keeps the original intent (9d97e10: Explicit Doctor migration preserves recovery bytes and verifies sources before retirement.)
  • Legacy memory marker ownership changes intended behavior with a stated reason (0cea8cd: The preceding adaptation preserved rounded legacy markers as foreign; this PR deliberately accepts their original numeric comparison domain and upgrades verified observations.)
  • Windows namespacing adapter keeps the original intent (47c7064: The adapter worked around fs-safe 0.26.0 staging-path handling and carried an explicit removal condition once the dependency supplied the fix.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +192, Tests +816, Docs +3. Total +1011 across 54 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 32 368 176 +192
Tests 21 1003 187 +816
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 54 1374 363 +1011

Review metrics

Metric Value Why it matters
Persisted receipt versions Audit restore journals 6 → 7; memory export markers 3 → 4 Both writers change persisted formats while retaining released readers, making upgrade compatibility a required gate.

Labels

Label changes:

  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Confirmed NTFS identities block agent maintenance, with additional correctness improvements in recovery and cache paths.
  • merge-risk: 🚨 compatibility: The patch changes persisted identity representations across service, audit, memory, and deletion receipts; the accepted legacy precision tradeoff does not waive upgrade validation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-12T13:21:31.241Z sha 60c40a6 :: blocked before merge. :: [P1] Preserve unsigned legacy stat values when comparing exact identities
  • reviewed 2026-10-12T13:45:59.792Z sha 2dabd43 :: blocked before merge. :: [P1] Preserve unsigned legacy stat values when comparing exact identities
  • reviewed 2026-10-12T14:25:49.496Z sha 6f43680 :: blocked before merge. :: [P1] Preserve unsigned legacy stat values when comparing exact identities
  • reviewed 2026-10-12T15:27:20.629Z sha 07562bd :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T15:57:46.591Z sha ffa9f91 :: needs changes before merge. :: none
  • reviewed 2026-10-12T16:41:55.130Z sha 8431b62 :: needs changes before merge. :: none
  • reviewed 2026-10-12T17:21:14.723Z sha 8431b62 :: needs changes before merge. :: none
  • reviewed 2026-10-12T22:06:43.279Z sha bec6a65 :: blocked before merge. :: none

Reviewed October 12, 2026, 6:55 PM ET / 22:55 UTC (Revision 23).

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 12, 2026
@steipete
steipete marked this pull request as ready for review October 12, 2026 01:36
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has dependency changes awaiting review. A future dependency graph change from an external contributor requires a maintainer's /allow-dependencies-change comment after the guard notice identifies that revision.

  • Current SHA: bec6a6517f2a836447b90f4b6dd9f109354fe10e

@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 Oct 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram gateway Gateway runtime agents Agent runtime and tooling and removed size: S labels Oct 12, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 12, 2026
@github-actions github-actions Bot removed the dependencies-changed PR changes dependency-related files label Oct 12, 2026
@steipete steipete closed this Oct 12, 2026
@steipete steipete reopened this Oct 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
Use fs-safe 0.26.2 path normalization while preserving private creation, pre-mutation refusal tracking, and native descriptor ownership.
Carry fs-safe exact identities through reads, cache revisions, migration claims, media staging, service backups, and deletion journals. Accept released rounded receipts in their original numeric domain, retain their legacy provenance, and upgrade verified observations on the next write while preserving permission and replacement checks.

The fs-safe 0.26.2 dependency pin and original migration already landed in #169469. Keep generic Node-only identity cleanup, UI changes, deployment controllers, PR tooling, and CI inventories outside this change.
@steipete

Copy link
Copy Markdown
Contributor Author

The old drifted stack has been replaced at bec6a6517f2a836447b90f4b6dd9f109354fe10e by two clean commits rebased without conflicts onto 36e78f215f1f058af15919da8a60c06797a759e8. The replacement changes 54 files and drops the unrelated instruction, PR-tooling, UI, E2E-script, and CI-inventory changes. The previous head 8431b628bfeb1e4fa54dac121599b85ace6004d2 is preserved on backup/fs-safe-0.26.2-o17 until a verified clean merge.

The config.patch investigation and broader proof reported for the old stack do not qualify this replacement. The PR body now identifies the clean candidate and its own evidence. All 29 previously unrun Bun files pass (488 tests); the earlier 11 managed-media assertion failures reproduce with the same names and errors on the pinned main base. The Windows x64/ARM64 comparison is summarized with its inherited failures explicitly retained.

Released rounded numeric receipts remain accepted as legacy and upgrade to exact encoding on their next verified write. A fresh independent review and exact-head CI are required before landing; neither is represented as complete yet.

@steipete

Copy link
Copy Markdown
Contributor Author

Landing is stopped at the exact-head CI attribution gate. Run 38313787621 completed with 70 successful jobs, 22 skips, and two failures: the changed-extension bundle and its aggregate CI gate. The bundle failed 27 cases in the Codex context-engine, Codex sandbox tools, memory transport, and MXC plugin suites. The CI reporter classifies it as unknown because scheduled main run 38311154418 has no matching extension job.

Main exhibits the same missing-runtime-config guard failure in core tests, but that does not prove the extension failures are inherited, particularly the distinct MXC backend-retirement assertion. No inherited-failure exception or merge was submitted. Additional local probes and fresh build/typecheck reruns were stopped without claiming success. The completed 29-file Bun proof remains 488 passing tests, and the independent P0–P2 review remains clean.

The clean 54-file head remains bec6a6517f2a836447b90f4b6dd9f109354fe10e; the old head stays on backup/fs-safe-0.26.2-o17. The PR body now records the exact failure owners, baseline limitation, completed evidence, and interrupted checks. No fixture, deadline, platform, or CI gate was weakened.

@steipete

Copy link
Copy Markdown
Contributor Author

The remaining CI failures on bec6a6517f2a836447b90f4b6dd9f109354fe10e are inherited from the base. Run 38313787621 fails only checks-node-changed-extensions-bundle-1-1 (job 115025933277) and its downstream openclaw/ci-gate (job 115037279582).

A/B reproduction used macOS ARM64, Node 26.11.1, the same worktree and test entrypoint, with the PR's 54 changed files restored to the merge base for the baseline run.

File Base result Candidate result Cause
extensions/mxc/test/plugin.test.ts 1 failed, 7 passed 1 failed, 7 passed Runtime config was not prepared before synchronous access.
extensions/codex/src/app-server/dynamic-tool-build.sandbox.test.ts 6 failed 6 failed Same runtime-config precondition.
extensions/memory-core/src/chunking-upgrade-real-transport.test.ts 5 failed 5 failed Same runtime-config precondition.
extensions/codex/src/app-server/run-attempt.context-engine.test.ts Fails with the same precondition Fails with the same precondition Runtime config was not prepared before synchronous access.

The common error is Runtime config is not prepared. Await captureRuntimeConfigAsyncReader()() first. Main is migrating these fixtures in 08b63f4, #170315 (5a1efaf), and d8253ad. This PR changes none of the codex, memory-core, or mxc sources. The failures surface here because the changed-extensions shard is selected.

The reviewed scope is two commits and 54 files. Independent P0–P2 review is clean; focused Node proof has 622 passes across 33 files, and the Bun failures are independently attributed to the existing fs.promises.access() null/undefined mismatch. Typecheck and build passed on the patch-identical pre-rebase candidate; exact-head CI types, lint, security, docs, and UI E2E passed. Landing is authorized through the native inherited-failure admin exception for the two named failed jobs; their CI result remains failed.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant