Repository navigation
feat(watch): add guarded advisory filesystem observation - #666
roboclaw-bot wants to merge 11 commits into
Conversation
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
OpenClaw-Publication: 892a37e5-8597-4b13-a12e-acf75bb69f6f Co-authored-by: vincentkoc <[email protected]>
8722dbd to
3503230
Compare
|
Codex review: blocked before merge. Reviewed September 25, 2026, 6:17 PM ET / 22:17 UTC (Revision 9). ClawSweeper reviewWhat this changesThe branch adds a Root-bound filesystem watch API with guarded advisory hints, Linux Node.js native observation, explicit portable polling, reconciliation, joined shutdown, documentation, tests, and package checks. Merge readiness⛔ Blocked before merge - 6 items remain Current main and v0.19.0 lack this watch API, so the PR remains useful. The earlier native-registration finding is addressed in the current source and focused tests. Publishing the limited platform, resource, and advisory-authority contract still needs package-owner approval, and GitHub currently reports merge conflicts. Priority: P2 Review scores
Verification
How this fits togetherThe watch subsystem receives an admitted filesystem Root and caller-selected paths. It uses guarded scans and either native observation or explicit polling to send advisory invalidations that callers can follow with guarded reads. flowchart LR
A[Admitted Root and scopes] --> B{Observation mode}
B -->|Linux Node| C[Retained directory watches]
B -->|Explicit poll| D[Timed scan]
C --> E[Guarded reconciliation]
D --> E
E --> F[Advisory invalidations]
F --> G[Caller guarded reads]
Decision needed
Why: The implementation supports a coherent limited contract, but defining a new security-sensitive public package policy requires package-owner intent. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Publish the watch API after its package owner approves the documented platform, resource, and advisory-authority contract and the branch merges cleanly with current main. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this PR introduces an API. Source, focused tests, and earlier installed-package receipts establish the intended central behavior, with the latest scope additions covered by source and tests. Is this the best way to solve the issue? Yes for the stated limited contract: guarded reconciliation and retained descriptor registration form a coherent observation boundary. Whether to publish that contract is a package-owner choice. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bd376aee38e3. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Fail closed on native runtimes that reopen pathnames; retain explicitly selected portable polling and preserve observation versus retirement outcomes. Co-authored-by: vincentkoc <[email protected]>
Keep guarded Root scans authoritative, multiplex Linux advisory hints in one joined native hub, and select portable polling on unqualified platforms. Supersedes the design in #666 without changing its branch. Co-authored-by: Vincent Koc <[email protected]>
Keep guarded Root scans authoritative, multiplex Linux advisory hints in one joined native hub, and select portable polling on unqualified platforms. Supersedes the design in #666 without changing its branch. Co-authored-by: Vincent Koc <[email protected]>
Add @openclaw/fs-safe/watch with bounded advisory invalidations, literal scopes, guarded reconciliation, generation fencing, scope replacement, and joined close. Events remain hints; the admitted Root and guarded scans retain filesystem authority. Replace the per-subscription Node Worker transport from #666 with a shared Rust hub using inotify on Linux, FSEvents on macOS, and overlapped ReadDirectoryChangesW with IOCP on Windows. The hub blocks until events or commands arrive and joins native work at retirement; portable polling remains available. Native CI verifies real event delivery, idle cost, and bounded joined shutdown across Linux, macOS, and Windows. Linux idle proof reduced voluntary hub context switches from 994 to 0 over ten seconds; measured edit latency was about 26–28 ms. Hosted macOS and Windows event and lifecycle proofs passed without relaxing timing thresholds. Co-authored-by: Vincent Koc <[email protected]>
|
Superseded by #690, now merged. It keeps this PR's guarded advisory model—scopes, guarded reconciliation, generation fencing, and joined close—and replaces the Node Worker transport with a shared Rust hub on inotify, FSEvents, and ReadDirectoryChangesW. Thank you @vincentkoc for the design and contribution. Vincent Koc is credited as co-author in the squash commit. This PR's branch is retained. |
What Problem This Solves
Filesystem consumers need one Root-bound owner for observation, guarded reconciliation, recovery and joined shutdown instead of maintaining separate watcher engines.
User Impact
Adds the unreleased
@openclaw/fs-safe/watchAPI for literal entry/tree scopes, bounded advisory dirty hints, health, updates, reconciliation and terminal awaited close. Native observation is supported only on Linux Node.js with verified procfs. macOS, Windows, Bun and other unproven native routes fail readiness withhelper-unavailable/watch provenance and no worker; callers must explicitly select portablemode: "poll". There is no silent fallback.Observation failures remain in readiness/reconciliation/health, but successful joined retirement resolves close. Actual worker or directory-pin cleanup failures remain rejected, retain prior context and prevent rearm.
Hosted qualification is complete for this limited contract; the PR remains draft. Current-head review reports no actionable code/security findings and says the earlier registration issue is addressed. Its verdict remains needs-human/blocked for package-owner acceptance of the platform/resource policy—not merge approval. Readiness/hints are not complete-event, permanent-path-membership, atomic-snapshot, completed-write or content-freshness receipts. One worker per native subscription plus retained directory descriptors has material cost; there is no aggregate pool/cap or performance-win claim. Maintainer acceptance of this limited support/resource contract remains a landing decision. No release or completed OpenClaw migration is claimed.
Why This Change Was Made
/proc/self/fd/N. Pins remain owned through native detach and worker join.See
docs/watch.mdfor the full contract. Application settling, retries, content-freshness policy and indexing remain with consumers.Evidence
Qualified candidate head:
39c949e88e4de3381db008e8ab18e27faf0bce8d; tree:bea39cf60db109e87446964f0e6d8a18c90a3e5e.f394a0dc04995f4511a135146b4f4f66afddef85, tree5a6e484d91dc616c1bce6271a5a98fbb45f90034, not the candidate tree. Four baseline-file differences were recorded (native/src/clone_windows.rs,native/src/windows.rs,src/errors.ts, and the Windows readonly fallback fixture); no watch/pin delta. Installed-package jobs explicitly checked out the exact candidate head.dirty:false. Full 275-file executable inventories × 16 installed receipts = 4,400 hash comparisons, including all seven watch modules and the three authority helpers, matched the actual tarballs.watchModesand recovery receipts. Linux proves labeled real-OSENOENT→ successful close → new native subscription → later native edit, with zero workers after close; the 30-second reconciliation interval exceeds the 5-second proof deadline. macOS separately proves actual Root loss → successful close → new explicitly selected polling subscription. No refusal or polling result is presented as native success.The artifacts contain metadata version
0.19.0as an unreleased test candidate, not an npm release or production dependency pin. Use their manifests/integrities for isolated consumer tests; do not commit local tarball paths or invent a released version. Earlier artifacts do not contain this complete repair. Platform/resource acceptance, package release and dependent OpenClaw landing remain separate.CHANGELOG.mdupdated when release-relevantContributor: @vincentkoc.
Work sessions
View the OpenClaw team session