Skip to content

fix(watch): do not block macOS entry watch on a FIFO - #830

Merged
steipete merged 3 commits into
openclaw:mainfrom
SebTardif:fix/watch-fifo-nonblock
Oct 5, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
SebTardif:fix/watch-fifo-nonblock

Conversation

@SebTardif

@SebTardif SebTardif commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

A FIFO at an admitted macOS entry name could block openat on the shared watch hub and freeze every watcher. Entry targets now use O_NONBLOCK for ordinary entries and symlinks: O_SYMLINK can also open a FIFO that replaces an admitted symlink, so its identity check must remain reachable. Directory opens retain O_DIRECTORY.

The regression runs in a bounded child process, verifies direct FIFO registration, and verifies that a symlink replaced by a FIFO returns ESTALE. On timeout the parent kills and reaps the child. Adjacent watch and scan paths use directory-only opens or metadata calls; no additional unguarded leaf open was found. The watch documentation and Unreleased changelog describe the fix.

Validation: cargo test --workspace --locked passed (145 native tests plus archive tests); cargo clippy --workspace --locked -- -D warnings passed; Codex autoreview is clean at P0–P2. Full pnpm check passed lint, build, allocator-build, and documentation checks locally, but the full test phase was stopped after widespread timing failures on a busy host; exact-head hosted CI is the cross-platform gate.

Thanks @SebTardif for the fix and regression.

Exact-head CI passed on 74d8b5de89e37cadb5973eea53cf411523f9ce0b: all OS lanes, coverage, benchmarks, watch ancestor proofs, and CodeQL. CI run.

@SebTardif
SebTardif requested a review from a team as a code owner October 3, 2026 13:07
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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 Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 10:43 PM ET / October 5, 2026, 02:43 UTC (Revision 4).

ClawSweeper review

What this changes

The PR makes macOS filesystem entry-watch registration nonblocking for FIFOs, adds a bounded regression covering FIFO registration and symlink replacement, and updates watch documentation and the changelog.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main and v0.23.0 still contain the blocking entry-open path. No introduced correctness or security defect was found.

Priority: P2
Reviewed head: 74d8b5de89e37cadb5973eea53cf411523f9ce0b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with real macOS filesystem coverage and no supported blocking findings.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The production kqueue registration owner is exercised with real FIFOs and a symlink-to-FIFO replacement in a bounded macOS child process; exact-head native test steps passed on arm64 and Intel. This demonstrates registration returning and stale identity rejection through actual OS calls. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The production kqueue registration owner is exercised with real FIFOs and a symlink-to-FIFO replacement in a bounded macOS child process; exact-head native test steps passed on arm64 and Intel. This demonstrates registration returning and stale identity rejection through actual OS calls. No stored-data contract changes.
Evidence reviewed 8 items Applicable repository policy: Read the full root AGENTS.md and CONTRIBUTING.md. Applied the requirements to preserve confinement and identity checks, add focused swap-race coverage, and document user-visible fixes under Unreleased. No nested AGENTS.md or maintainer-notes directory was found.
Verified introduced change: The pinned main-to-head delta changes only CHANGELOG.md, docs/watch.md, and native/src/watch_kqueue.rs. Both ordinary and symlink entry opens gain O_NONBLOCK; directory-only opens and post-open identity checks remain intact. The verified test-merge comparison has the same three-file scope.
Current main still needs the fix: Current main opens ordinary entries with O_NOFOLLOW and symlink entries with O_SYMLINK, without O_NONBLOCK. The shared hub synchronously processes entry registration through the macOS backend, so a blocked leaf open prevents other commands from progressing.
Findings None None.
Security None None.

How this fits together

fs-safe watches admitted paths beneath a trusted filesystem root. Its shared macOS watch hub opens identity-checked descriptors and converts kernel events into hints for guarded metadata scans.

flowchart TD
  A[Admitted root and entry] --> B[Shared macOS watch hub]
  B --> C[Open entry without blocking]
  C --> D{Identity still matches?}
  D -->|No| E[Reject stale registration]
  D -->|Yes| F[Register kernel watch]
  F --> G[Hints for guarded scans]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and regression scope production +4/-2 lines; tests +46/-0 lines The small flag correction has focused coverage for both direct FIFO registration and stale symlink replacement.

Technical review

Best possible solution:

Keep entry registration nonblocking while retaining descriptor confinement, identity rejection, and bounded real-filesystem regression coverage.

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

Yes, source establishes the path: registering an admitted FIFO reaches a potentially blocking openat on the shared macOS hub. This review did not execute a failing current-main reproduction.

Is this the best way to solve the issue?

Yes, adding O_NONBLOCK to both non-directory branches is a narrow repair that keeps the existing confinement and identity contract intact.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This fixes a concrete macOS watch-hub stall triggered by FIFO entries without evidence of an urgent widespread 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. Sufficient (linked_artifact): The production kqueue registration owner is exercised with real FIFOs and a symlink-to-FIFO replacement in a bounded macOS child process; exact-head native test steps passed on arm64 and Intel. This demonstrates registration returning and stale identity rejection through actual OS calls. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The production kqueue registration owner is exercised with real FIFOs and a symlink-to-FIFO replacement in a bounded macOS child process; exact-head native test steps passed on arm64 and Intel. This demonstrates registration returning and stale identity rejection through actual OS calls. No stored-data contract changes.

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)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-03T13:11:00.817Z sha 336b407 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T13:29:44.216Z sha 15c392d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T00:45:40.888Z sha 15c392d :: needs maintainer review before merge. :: none

SebTardif and others added 3 commits October 4, 2026 19:30
Entry scopes opened the admitted name with O_EVTONLY and no
O_NONBLOCK. A FIFO at that name blocked the hub thread in openat
and froze every watcher. Non-directory entries now include
O_NONBLOCK.

Signed-off-by: Sebastien Tardif <[email protected]>
Native check on macos-15-intel failed in sidecar-contention root-async
with not-found during acquire. The same job passed on macos-15.
The FIFO registration passed on the intel runner. A fork cannot
rerun that one job.

Signed-off-by: Sebastien Tardif <[email protected]>
@steipete
steipete force-pushed the fix/watch-fifo-nonblock branch from 15c392d to 74d8b5d Compare October 5, 2026 02:36
@steipete
steipete merged commit 68416a3 into openclaw:main Oct 5, 2026
48 checks passed
steipete added a commit that referenced this pull request Oct 5, 2026
Prepare `@openclaw/fs-safe` 0.23.1 from main, using the same 13-file scope as #826: root, native workspace, seven platform package versions, exact optional-dependency pins, and regenerated Cargo/pnpm lock entries. No implementation or dependency changes are included.

Finalize the 2026-10-04 changelog with an empty Unreleased section above it. Highlights cover no-replace publication on gVisor/9p and other unsupported filesystems (#834, fixes #828), container-denied FICLONE fallback for single-file and tree copies (#829, #835), and nonblocking macOS FIFO watching (#830). The six fixes include PR links and contributor credit, including @Mohl and co-author @foxsky, @vishnukool, and @SebTardif.

Validation: `pnpm build`, `pnpm check` (662 test files and 13,431 tests passed; 65 files and 4,108 tests skipped), `pnpm pack:check`, `node scripts/release-notes.mjs 0.23.1`, and `git diff --check` passed. The local build selected the installed rustup compiler explicitly because the default Homebrew Rust compiler could not see the WASM target. Codex autoreview is scoped-clean at P0–P2. Both generated lockfile diffs are limited to the intended version changes.

Release publication remains exclusively through the signed v0.23.1 tag and release.yml trusted publishing. Exact-head CI passed on `26e42f21a6b568d3f6a37408dea6f3b89ccf10b3`: [CI](https://github.com/openclaw/fs-safe/actions/runs/37265555433), [coverage](https://github.com/openclaw/fs-safe/actions/runs/37265555421), [mutation proofs](https://github.com/openclaw/fs-safe/actions/runs/37265555402), [benchmarks](https://github.com/openclaw/fs-safe/actions/runs/37265555459), and [CodeQL](https://github.com/openclaw/fs-safe/actions/runs/37265555471). No runner reruns or failure exceptions were needed. Main remained at `04e370a3e39eb6e98e6cb54877a5941b6d688cde` before merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants