Skip to content

refactor: reuse fs-safe for directory scans - #159603

Merged
steipete merged 2 commits into
mainfrom
codex/fs-safe-walk-consumer-prototypes-20260926
Sep 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fs-safe-walk-consumer-prototypes-20260926

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw maintains three recursive directory walkers that the released fs-safe package can now own.

User Impact

No intended user-visible change: directory fetch preflight keeps its ordering and limits, installed skills keep their existing fingerprints, and Claw removal preserves workspaces whose contents cannot be fully checked.

Why This Change Was Made

Use fs-safe 0.21.0's Root.walk with symlink inclusion for these complete directory scans, removing 20 production lines. Core and File Transfer already declare this released version. Callers import the dependency directly without widening the Plugin SDK facade.

Preflight sorting preserves whole subtrees even when two distinct names compare equally by locale. Skill metadata exclusions, hard-link rejection, and Claw's missing-root behavior remain unchanged.

Evidence

The second CI run hit an inherited worker-installation type error from main. This branch is now rebased, with an identical patch, onto its canonical fix 57f12db99ee3dd53f265170cb1ae7bbe089a8eed. The four failed type graphs, SDK declaration preparation, and 77 bundle/npm provider tests pass on that fix; fresh PR CI remains required.

  • 42 distinct focused tests across five files passed with one worker. Initial proof: 37 tests in 90.47 seconds. Takeover repair: 19 tests in 162.12 seconds, including 14 repeated ownership cases and 16.31 seconds of worker preparation. Coverage includes real tar creation, links, entry limits, skill fingerprint bytes, and Claw ownership races.
  • CI run 36314338729 found five takeover failures because the fixture still spied on the local Root facade after production moved to the dependency. Local reproduction failed the same five cases in 120.32 seconds. The fixture now intercepts the dependency through a transparent real-export factory; all 19 cases pass with every takeover, journal, and file assertion retained. This repair changes no production code.
  • Changed-file test bodies: directory fetch 648 ms; takeover 28.81 seconds; existing Claw ownership 40.12 seconds in its original run (56.17 seconds shard wall). These ownership cases exercise removal, drain, and persistent state through the real management flow; no scenarios were added.
  • Extended the existing preflight test with two distinct locale-equivalent directory names. It failed on the initial migration's interleaved subtrees and passed after preserving raw-name order before descending.
  • Real filesystem probes passed for dangling-symlink and hard-link rejection and a depth-66 tree with an independently calculated expected digest. Root.walk leaves omitted depth/entry budgets unlimited; directory fetch retains its explicit entry cap.
  • All selected check:changed stages passed. The initial invocation stopped on two missing comparator braces; corrected extension lint, the targeted preflight regression, and all remaining stages passed separately. Core/extension production and test types, unused-export scans, and repository guards are covered.
  • Independent Codex reviews of the adoption and fixture repair completed with no actionable findings through P2. The fixture's owning test typegraph and focused lint also pass. No full build or full test suite was run locally.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 27, 2026 11:00
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 8:15 AM ET / 12:15 UTC (Revision 3).

ClawSweeper review

What this changes

The branch replaces directory scans used by File Transfer preflight, installed-skill fingerprinting, and Claw workspace removal with fs-safe walking, and adjusts their tests.

Merge readiness

✅ Ready for maintainer review

The PR remains useful because current main still has the local directory walkers. The published fs-safe contract and affected call sites reveal no definite introduced defect.

Priority: P3
Reviewed head: 08ff4d3d659b5426b723dc2844468e00e0d7da5e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch has meaningful boundary and compatibility evidence, with no concrete finding from this review.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The recorded member-authored PR is exempt from the external-contributor proof gate. Its body reports real-filesystem probes and focused tests; the unchanged fixed digest assertions and inspected walker ordering support existing fingerprint compatibility.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The recorded member-authored PR is exempt from the external-contributor proof gate. Its body reports real-filesystem probes and focused tests; the unchanged fixed digest assertions and inspected walker ordering support existing fingerprint compatibility.
Evidence reviewed 9 items Current main: Current main retains the three local walkers; these paths have no changes between the PR merge base and fetched main.
Dependency signal: The introduced patch directly imports fs-safe's root API, and both core and File Transfer already declare version 0.21.0.
Published traversal contract: Version 0.21.0 includes symlinks without following them, defaults to sorted traversal and throwing on directory errors, and emits a truncated entry when the entry budget is exceeded.
Findings None None.
Security None None.

How this fits together

These scans read filesystem trees before OpenClaw packages a directory, checks an installed skill, or removes a Claw workspace. They produce a bounded listing, a fingerprint, or a decision to retain the workspace.

flowchart TD
  A[Filesystem trees] --> B[fs-safe tree walker]
  B --> C[File Transfer preflight]
  B --> D[Skill fingerprint]
  B --> E[Claw removal scan]
  C --> F[Bounded entry list]
  D --> G[Stored digest check]
  E --> H[Retain or remove workspace]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -20, Tests +15. Total -5 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 37 57 -20
Tests 3 20 5 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 57 62 -5

Review metrics

Metric Value Why it matters
Ownership test runtime 40.12 s test body; 56.17 s shard wall The PR body supplies measured cost for the existing Claw ownership suite touched by the fixture adjustment.

Technical review

Best possible solution:

Use fs-safe as the traversal owner while preserving preflight limits, existing skill fingerprints, and conservative workspace retention.

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

Not applicable: the PR is an internal refactor, not a report of failing behavior. Its affected paths have focused tests and source-checkable contracts.

Is this the best way to solve the issue?

Yes: the pinned dependency already owns bounded, sorted filesystem walking, and the branch leaves the Plugin SDK contract unchanged.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal directory-walker cleanup with no intended user-visible change or demonstrated urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The recorded member-authored PR is exempt from the external-contributor proof gate. Its body reports real-filesystem probes and focused tests; the unchanged fixed digest assertions and inspected walker ordering support existing fingerprint compatibility.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Kimi Yu: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • qingminlong: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-27T11:08:19.375Z sha e76b5bc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T11:41:17.372Z sha 3a53ec6 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/fs-safe-walk-consumer-prototypes-20260926 branch from 3a53ec6 to 08ff4d3 Compare September 27, 2026 12:07
@steipete
steipete merged commit d760c81 into main Sep 27, 2026
190 of 192 checks passed
@steipete
steipete deleted the codex/fs-safe-walk-consumer-prototypes-20260926 branch September 27, 2026 12:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
* refactor: reuse fs-safe for directory scans

* test(claws): align takeover fixture with fs-safe root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: file-transfer rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant