Skip to content

test(fs): route Bun race spies through node fs - #151302

Merged
steipete merged 1 commit into
mainfrom
codex/bun-fs-race-hooks
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/bun-fs-race-hooks

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Problem

Direct Bun runs could not execute five filesystem race and path-probe regressions because @openclaw/fs-safe routes Bun realpath through its N-API compatibility path. The tests inject races and count probes through node:fs spies, so the intended injection never occurred under Bun even though the production adapter behaved normally.

Solution

Select fs-safe's documented portable node:fs path only while Bun-specific test spies are active, then restore the previously configured native mode in finally. The shared symlink-race helper now owns that adaptation for filesystem and archive safety tests, and the coordinator probe-count test uses the same bounded setup. Production runtime behavior is unchanged.

Validation

  • Signed custom Bun: 74/74 infra assertions and 52/52 apply-patch assertions passed.
  • Node: the same 126/126 assertions passed.
  • node scripts/check-changed.mjs
  • Fresh P0-P2 review: no findings.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete force-pushed the codex/bun-fs-race-hooks branch from d6bbca1 to 296fdf4 Compare September 18, 2026 01:43
@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 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 9:49 PM ET / September 18, 2026, 01:49 UTC.

ClawSweeper review

What this changes

The PR temporarily selects fs-safe’s portable filesystem path during Bun race and path-probe tests, then restores the previous native mode.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused test repair absent from the pinned main and latest release. No introduced correctness or security defect was found.

Priority: P3
Reviewed head: 296fdf4af297c985b3a9f93e89104301732142a0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A bounded test repair supported by the pinned dependency contract and reported cross-runtime validation, with no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer designation exempts this test-only PR from external-contributor runtime proof; its body reports the affected infra and apply-patch suites passing on Bun and Node.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer designation exempts this test-only PR from external-contributor runtime proof; its body reports the affected infra and apply-patch suites passing on Bun and Node.
Evidence reviewed 7 items Introduced change: The verified base-to-head diff changes only test setup and test support; existing assertions remain unchanged, and both additions restore the captured mode in finally.
Dependency contract applies: The patch directly imports @openclaw/fs-safe/config, and package.json pins fs-safe 0.13.1. Its configuration and realpath implementation therefore determine whether these spies observe the intended operations.
Pinned dependency behavior: Verified repository ownership through GitHub metadata and package.json. Tag v0.13.1 resolves to this commit; realpath.ts uses the native canonicalizer on Bun POSIX and otherwise calls node:fs. Separately inspected native.ts confirms mode off returns no native binding, and native-config.ts confirms configuration changes take effect dynamically.
Findings None None.
Security None None.

How this fits together

OpenClaw’s filesystem tests inject symlink changes and count path lookups to check containment and coordinator efficiency. Bun’s native compatibility path bypasses their Node filesystem spies, so the test setup must select an observable path.

flowchart TD
  A[Filesystem regression tests] --> B{Running under Bun?}
  B -->|Yes| C[Temporarily select portable filesystem]
  B -->|No| D[Keep existing filesystem mode]
  C --> E[Inject races and count path probes]
  D --> E
  E --> F[Check safety and efficiency assertions]
  F --> G[Restore spies and previous mode]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +20. Total +20 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 20 0 +20
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 20 0 +20

Review metrics

None.

Technical review

Best possible solution:

Keep the runtime workaround intact while adapting the existing test helpers to exercise their intended filesystem boundaries under Bun.

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

Yes, from source: Bun POSIX with fs-safe’s native addon bypasses the node:fs spies used by these regressions. The reviewer did not execute the tests.

Is this the best way to solve the issue?

Yes. The existing public mode switch restores spy observability within bounded test scopes without weakening assertions or changing production code.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This repairs internal test observability under Bun without changing production behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer designation exempts this test-only PR from external-contributor runtime proof; its body reports the affected infra and apply-patch suites passing on Bun and Node.

Label justifications:

  • P3: This repairs internal test observability under Bun without changing production behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 supplied maintainer designation exempts this test-only PR from external-contributor runtime proof; its body reports the affected infra and apply-patch suites passing on Bun and Node.

Evidence

What I checked:

  • Introduced change: The verified base-to-head diff changes only test setup and test support; existing assertions remain unchanged, and both additions restore the captured mode in finally. (src/test-utils/symlink-rebind-race.ts:29, 296fdf4af297)
  • Dependency contract applies: The patch directly imports @openclaw/fs-safe/config, and package.json pins fs-safe 0.13.1. Its configuration and realpath implementation therefore determine whether these spies observe the intended operations. (package.json:2196, 296fdf4af297)
  • Pinned dependency behavior: Verified repository ownership through GitHub metadata and package.json. Tag v0.13.1 resolves to this commit; realpath.ts uses the native canonicalizer on Bun POSIX and otherwise calls node:fs. Separately inspected native.ts confirms mode off returns no native binding, and native-config.ts confirms configuration changes take effect dynamically. (src/realpath.ts:11, 7022a0a10c53)
  • Existing regression coverage remains meaningful: Inspected helper callers in filesystem, archive, and apply-patch tests. They retain rejection and outside-file preservation assertions; the archive test additionally checks that the directory actually became a symlink. No affected caller uses concurrent tests. (src/infra/archive.test.ts:264, 296fdf4af297)
  • Still needed on main and release: Read the helper at pinned main and v2026.9.4: neither contains the Bun-specific mode selection. No verified replacement fixing PR was established. (src/test-utils/symlink-rebind-race.ts:26, 3a9d69db306c)
  • Area history: Current-main history includes the fs-safe adoption and spy adaptation in this commit, whose GitHub author is steipete. The coordinator history also shows recent work by the same contributor. A deeper local blame lookup failed on unavailable historical objects; GitHub commit patches supplied the relevant prior-change evidence. (src/test-utils/symlink-rebind-race.ts:56, 870195ad8f27)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

@steipete
steipete merged commit a886de6 into main Sep 18, 2026
100 checks passed
@steipete
steipete deleted the codex/bun-fs-race-hooks branch September 18, 2026 02:05
@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 18, 2026
steipete added a commit that referenced this pull request Sep 18, 2026
…151339)

Restore filesystem import-boundary, workflow-routing, and full-suite inventory guards after the changes in #151302, #151282, and #151001. Route native filesystem configuration through the existing facade, register the recovery and Codex attempt tests in their existing owners, and select those guards when their inventory inputs change. Includes the reviewed routing repair from #151340 with its original human authorship preserved.

Finalize the existing Gateway serial admission and two-worker ceiling before runtime placement reads recipient policy. This preserves compact worker limits when inventory changes without changing timing measurements, original compaction assertions, configuration, dependencies, or user-facing runtime behavior.

Validation: exact-head CI run 35306657804 completed green; the native watcher exited 0 with no pending checks. Retained focused proof passed 1,591 tests across six files, with both new placement regressions failing before the repair and all four placement cases passing after it. Committed-branch review found no actionable defects. The pre-existing diagnostics test-support lint issue from #151161 remains an explicitly nonblocking follow-up.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…penclaw#151339)

Restore filesystem import-boundary, workflow-routing, and full-suite inventory guards after the changes in openclaw#151302, openclaw#151282, and openclaw#151001. Route native filesystem configuration through the existing facade, register the recovery and Codex attempt tests in their existing owners, and select those guards when their inventory inputs change. Includes the reviewed routing repair from openclaw#151340 with its original human authorship preserved.

Finalize the existing Gateway serial admission and two-worker ceiling before runtime placement reads recipient policy. This preserves compact worker limits when inventory changes without changing timing measurements, original compaction assertions, configuration, dependencies, or user-facing runtime behavior.

Validation: exact-head CI run 35306657804 completed green; the native watcher exited 0 with no pending checks. Retained focused proof passed 1,591 tests across six files, with both new placement regressions failing before the repair and all four placement cases passing after it. Committed-branch review found no actionable defects. The pre-existing diagnostics test-support lint issue from openclaw#151161 remains an explicitly nonblocking follow-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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