Repository navigation
fix(watch): ignore Linux watch-retirement echoes instead of invalidating every subscription - #782
Conversation
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 9:20 PM ET / October 1, 2026, 01:20 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch teaches the shared Linux watch hub to discard events from retired inotify watches, and adds regression tests, watch documentation, and a changelog entry. Merge readiness✅ Ready for maintainer review Current main and v0.21.3 still have the reported cross-subscription overflow path. This focused PR has credible Linux before-and-after evidence and no identified blocking defect. Priority: P2 Review scores
Verification
How this fits togetherLinux filesystem events enter one inotify hub shared by multiple watch subscriptions. The hub sends advisory hints or overflow signals to subscriptions, whose guarded scans determine reportable changes. flowchart LR
A[Filesystem activity] --> B[Linux inotify queue]
B --> C[Shared watch hub]
C --> D{Descriptor state}
D -->|Active| E[Subscription hints]
D -->|Retired| F[Discard old events]
D -->|Unknown or overflow| G[Global invalidation]
E --> H[Guarded scan]
G --> H
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep peer subscriptions independent during watch retirement while preserving guarded reconciliation for genuine event loss and ambiguous filesystem state. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source exposes the retired-descriptor route to global overflow, and the PR reports a baseline Linux run showing the failure; this review did not execute it. Is this the best way to solve the issue? Yes. The shared Linux hub owns descriptor lifetimes, so handling retirement there addresses the cause while leaving guarded scans and genuine overflow handling intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ecec23e10f15. 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
History |
d4d2361 to
0e320cf
Compare
Closing a Linux TREE subscription used to overflow every subscription sharing the process-wide inotify hub, including an ENTRY on a different Root.
inotify_rm_watchqueuesIN_IGNORED, but fs-safe removed the descriptor's ownership immediately and interpreted that echo as a genuinely unknown descriptor.Keep retiring descriptors known until their echo arrives, discard earlier queued events for those descriptors, and clear leftover retirement records after the queue drains. This includes
EINVALafter kernel auto-removal and watch replacement. Descriptor reuse conservatively invalidates its new owner; genuinely unknown descriptors and kernel queue overflow retain global invalidation.Regression coverage includes Rust hub tests and real Linux events-mode subscriptions, with explicit close and invalid-path scan-failure retirement. The unrelated ENTRY must remain ready with zero overflow and continue observing edits. The new tests fail on the main baseline.
Linux AWS proof installs a packed candidate and runs the supplied standalone reproduction, with only its version assertion/report adapted for the candidate version. Baseline main: missing-descendant TREE 4 overflows, unrelated ENTRY 2, valid-name controls 0. Selected invalid names fail closed with
invalid-path. Candidate: missing TREE 2 (only undecodable sibling create/remove), unrelated ENTRY 0, valid-name controls 0; both selected TREEs still failinvalid-path. Nameless chmod, rename and delete each still produce one overflow and belong to the separate classification fix.Validation:
cargo test --workspace --locked;cargo clippy --workspace --locked -- -D warnings;pnpm build && pnpm native:build; all focused watch tests (255 passed on Linux);pnpm check(16,838 passed on Linux); independent Codex autoreview clean at P0–P2. An additional local macOS full check had eight event-delivery/timing failures; its Rust tests and Clippy passed. Exact-head native macOS ARM and Intel CI lanes both passed. No release, tag or publication is included.