Repository navigation
fix(realtime): index Windows in-place writes reported as attrib; reads raise no event - #505
Conversation
On Linux, watchdog's inotify emitter was scheduled with no event_filter, so it watched IN_OPEN / IN_CLOSE_NOWRITE / IN_CLOSE_WRITE and every plain read of an indexable file produced `opened` + `closed_no_write`. The handler admitted any event type on an indexable path, so each read took one of the 1,000 event-queue slots before the consumer, which acts only on created / modified / deleted / dir_*, dropped it. ChunkHound's own start-up scan reads every file, so it could overflow the queue and request an event_queue_overflow resync; a type-check or test run over the tree does the same. Fix, at the source: - events.py: CONTENT_EVENT_TYPES is the single list of event types that can mean a content change; on_any_event drops every other type first, with no callback. watchdog_event_filter() derives the watchdog classes from it. - startup.py (_bootstrap_fs_monitor) and pipeline.py (_add_directory_watch) pass that filter to observer.schedule. On inotify it narrows the kernel watch mask, so reads are never reported at all. Both call sites use the same filter because watchdog 7 shares one inotify fd per observer and each inotify_add_watch replaces the inode's mask. `attrib` is kept. On Windows, watchdog 7.1 reports an in-place append as `attrib` when the change time is ahead of the write time (3 of 3 appends in a probe), so for some writes it is the only event. The consumer does not act on `attrib` today; that, and Windows last-access updates arriving as `attrib`, are left for a separate change. Windows behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s raise no event On Windows, watchdog 7 classifies a FILE_ACTION_MODIFIED as `attrib` whenever the record's LastChangeTime is ahead of its LastModificationTime. An in-place append usually is: measured on NTFS, 26 of 30 appends arrived as `attrib` only and 4 as `modified` only. The consumer acts on created/modified/deleted, so most in-place writes were never indexed by the watcher. watchdog also subscribes to FILE_NOTIFY_CHANGE_LAST_ACCESS, so with last-access updates on, every read of a file not read for an hour raises an event (7: `attrib`, 6: `modified`) that takes an event-queue slot; ChunkHound's own start-up scan reads every file. - events.py: WATCHDOG_TO_CONSUMER_EVENT replaces CONTENT_EVENT_TYPES as the one place a watchdog type is admitted, mapping attrib to modified. On Linux, watchdog 6 already reports IN_ATTRIB as modified, so this is that behaviour on watchdog 7 too. - events.py: ignore_windows_last_access() clears the last-access bit from watchdog's module-global notify flags, which both 6.0 and 7.1 read on every ReadDirectoryChangesW call; called where the observer is created. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@HananKavitzAmat could you review this one, and #504 under it, when you have a moment? They affect users today, though CI can't show it:
Order: #504 first. This PR is #504's commit plus one; it replaces the event-type list #504 introduces, so it can't land before it. Once #504 is merged I'll bring this branch up to date with main. Then the last commit is the whole remaining diff. 🤖 Generated with Claude Code |
VakninAriel
left a comment
There was a problem hiding this comment.
Code Review — PR #505
Verdict: 🚫 Request Changes
Summary
Watchdog 7 can report ordinary Windows in-place writes as attrib events, which the existing consumer ignores, while last-access notifications also consume queue capacity for reads. Stacked on #504, this PR maps attrib to modified and disables Windows last-access notifications before observer creation.
What's good
- Attribute normalization happens before admission, bookkeeping and queueing, so the Windows write signal consistently reaches those stages as the consumer-supported modified type.
- The Windows observer test first proves the watch is armed with a sentinel write, checks a read separately from an append, and restores the process-wide watchdog flag after the test.
Freshness warning: Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.
| Severity | Count |
|---|---|
| 🔴 Critical | 0 |
| 🟠 High | 0 |
| 🟡 Medium | 1 |
| 🟢 Minor | 0 |
Findings
🟡 [Preserve follow-up indexing when filtering consecutive write events] (#1 · Medium)
Location: chunkhound/services/realtime/events.py — lines 238–240
The complete main-based diff inherits #504's read-only filtering. On Linux, write a file, let indexing read that version, then write it again during the active pass and within the two-second dedup window. Removing intervening open/close events leaves modified followed by modified; _consume_events drops the second event before add_file can reserve an active-work follow-up. The accepted-event callback only refreshes pending work. Indexed content can therefore remain stale. Attribute normalization in the final #505 commit does not repair this inherited interaction.
Suggested fix:
Keep read-only events out of the queue, but allow repeated content changes to reach debounce/coalescing and active follow-up scheduling. Carry the #504 correction into this stack and test a second write after the first indexing read but before its completion.
Review metadata and audit
Draft review for human approval. Nothing has been posted to GitHub.
Pinned head SHA: 352bed9b1dd6d539e67bd89f2bdc2ca12aab9c7d
Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.
PR: #505
Title: fix(realtime): index Windows in-place writes reported as attrib; reads raise no event
Author: fstrasz · Branches: fix/windows-attrib-upstream → main
Diff merge base: 98be86f
Review scope: Entire pinned PR diff against main merge base 98be86f through 352bed9; relevant callers, lifecycle and tests inspected. Consolidation of independent Sonnet and Astra reviews, not an additional independent model review.
Eligibility: Bug fix addressing existing behavior; no new feature.
Overall assessment (audit only)
The Windows-specific changes introduce no separately substantiated defect, but the full main-based diff retains #504's Medium dropped-follow-up-write regression. The pinned #505 handler/consumer reproduced it on Linux; request changes for the inherited filtering interaction, not for attribute normalization.
Strength evidence
- {"strength_index": 0, "path": "chunkhound/services/realtime/events.py", "source": "pr-505.pinned.diff", "detail": "WATCHDOG_TO_CONSUMER_EVENT maps attrib to modified; on_any_event uses the mapped local event_type for source/filtered callbacks, admission and _queue_event. This does not establish follow-up scheduling correctness."}
- {"strength_index": 1, "path": "tests/realtime/test_realtime_windows_attrib.py", "source": "pr-505.pinned.diff", "detail": "test_windows_read_raises_no_event_and_write_is_a_change awaits a sentinel, skips when atime does not change, checks read/write queues and uses monkeypatch to restore WATCHDOG_FILE_NOTIFY_FLAGS; no local Windows pass is asserted."}
Finding #1 evidence
- Final cross-PR audit executed the actual pinned #505 handler and consumer with Linux watchdog 6.0.0: merge-base handler delivered value = 2; head delivered only value = 1 and suppressed three modified events. Exit 0. Probe: /tmp/chunkhound-final-audit-qfk_juar/probe-505.py.
- pipeline.py is byte-identical between #504 and #505. Its same-type dedup at 1061-1081 precedes add_file's active-follow-up reservation at 957-964. This is inherited in the full merge-base diff, not newly introduced by the Windows-only final commit.
Reviewer keys: astra
Verification
- Final audit: pinned #505 Linux handler/consumer probe exited 0 and reproduced dropped second-write admission; simplified in-flight sink, not native end-to-end indexing. See final-audit.json for commands and output.
- Reconciler verified both completed statuses, provenance validity, exact pinned metadata/worktree HEAD, full-index diff bytes, report SHA-256 hashes and distinct actual assistant-message provider/model/responseModel identities.
- Both reviewers ran uv run --no-sync mypy chunkhound: 993 errors in 89 files. Astra shadowed all three changed production files with merge-base versions and obtained the same normalized diagnostics.
- Sonnet targeted pytest: two collection errors, zero tests run. Astra targeted pytest including watchdog import isolation: three collection errors, zero tests collected successfully.
- Astra supplementary AST-extracted production-logic checks passed for attribute normalization, read rejection, Windows mask guards/idempotence (fake external Windows module), and a real Linux watchdog 6 observer read/append check.
- Reconciler traced events.py normalization into pipeline.py:1092-1095 add_file processing and confirmed both startup and dynamic directory scheduling use the same event filter.
Limitations
- The native extension is missing from the shared environment, preventing application-test collection; no environment repair was attempted.
- Linux and watchdog 6.0.0 only: actual Windows notifications and watchdog 7 behavior were not executed locally. Isolated checks do not replace application or Windows tests.
- CI was green at the pinned inventory snapshot; no fresh remote CI run was performed by the reconciler.
- CI is a captured snapshot, not a fresh run or a guarantee of current branch status.
- Model identities are verified declarations supplied by the reconciler; the renderer does not inspect raw reports or provenance events.
Disposition of discarded / merged findings
- Final audit supersedes the previous no-bug conclusion for the full diff: the pinned #505 runtime probe reproduces #504's filtering/dedup interaction. The incremental Windows change remains without a separate finding. Attribute this shared issue to #504 and avoid posting duplicate comments when reviewing the stack jointly.
- Sonnet process-wide watchdog flag observation is documented behavior; no second in-process watchdog consumer or concrete regression was demonstrated. Not promoted to a finding.
- Sonnet timing/flakiness concern is not backed by a failing run; retained only as Windows verification risk, not a defect.
- Sonnet startup observer protocol concern is preexisting: Astra baseline comparison found identical normalized diagnostics. No runtime bug established.
Independent reviewer provenance
- sonnet — provider: amat-tfy; requested model: standard-chat-dev/claude-sonnet-5.5; verified response model: aws-aidev-models/us.anthropic.claude-sonnet-5-5. Identity evidence · Raw report
- astra — provider: amat-tfy; requested model: frontier-chat-dev/gpt-6-astra; verified response model: gpt-6-astra. Identity evidence · Raw report
CI snapshot
Captured: 2026-11-11T14:18:23.581921+00:00. Eligibility green: True. Counts: {"SKIPPED": 2, "SUCCESS": 23}
- site-build: SUCCESS (COMPLETED)
- site-build-validation (ubuntu-latest): SUCCESS (COMPLETED)
- site-build-validation (macos-latest): SUCCESS (COMPLETED)
- site-build-validation (windows-latest): SUCCESS (COMPLETED)
- rust-checks (ubuntu-latest): SUCCESS (COMPLETED)
- rust-checks (macos-latest): SUCCESS (COMPLETED)
- rust-checks (windows-latest): SUCCESS (COMPLETED)
- native-wheel-smoke-arm64: SUCCESS (COMPLETED)
- native-dev-macos: SUCCESS (COMPLETED)
- watchman-runtime-validation (ubuntu-latest, 3.14): SUCCESS (COMPLETED)
- watchman-runtime-validation (windows-latest, 3.14): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 3): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 3): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 3): SUCCESS (COMPLETED)
- old-linux-wheel-smoke (Ubuntu 20.04 (glibc 2.31), UBUNTU_20_04_IMAGE, ca-certificates curl, 3.12): SUCCESS (COMPLETED)
- old-linux-wheel-smoke (Ubuntu 22.04 + Python 3.10, UBUNTU_22_04_IMAGE, ca-certificates curl pytho...: SUCCESS (COMPLETED)
- watchman-rollout-gate: SUCCESS (COMPLETED)
- pages-artifact: SKIPPED (COMPLETED)
- deploy: SKIPPED (COMPLETED)
Reviewed by Ariel Vaknin via pi.dev
VakninAriel
left a comment
There was a problem hiding this comment.
Code Review — PR #505
Verdict: 🚫 Request Changes
Summary
Watchdog 7 can report ordinary Windows in-place writes as attrib events, which the existing consumer ignores, while last-access notifications also consume queue capacity for reads. Stacked on #504, this PR maps attrib to modified and disables Windows last-access notifications before observer creation.
What's good
- Attribute normalization happens before admission, bookkeeping and queueing, so the Windows write signal consistently reaches those stages as the consumer-supported modified type.
- The Windows observer test first proves the watch is armed with a sentinel write, checks a read separately from an append, and restores the process-wide watchdog flag after the test.
Freshness warning: Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.
| Severity | Count |
|---|---|
| 🔴 Critical | 0 |
| 🟠 High | 0 |
| 🟡 Medium | 1 |
| 🟢 Minor | 0 |
Findings
🟡 [Preserve follow-up indexing when filtering consecutive write events] (#1 · Medium)
Location: chunkhound/services/realtime/events.py — lines 238–240
The complete main-based diff inherits #504's read-only filtering. On Linux, write a file, let indexing read that version, then write it again during the active pass and within the two-second dedup window. Removing intervening open/close events leaves modified followed by modified; _consume_events drops the second event before add_file can reserve an active-work follow-up. The accepted-event callback only refreshes pending work. Indexed content can therefore remain stale. Attribute normalization in the final #505 commit does not repair this inherited interaction.
Suggested fix:
Keep read-only events out of the queue, but allow repeated content changes to reach debounce/coalescing and active follow-up scheduling. Carry the #504 correction into this stack and test a second write after the first indexing read but before its completion.
Review metadata and audit
Draft review for human approval. Nothing has been posted to GitHub.
Pinned head SHA: 352bed9b1dd6d539e67bd89f2bdc2ca12aab9c7d
Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.
PR: #505
Title: fix(realtime): index Windows in-place writes reported as attrib; reads raise no event
Author: fstrasz · Branches: fix/windows-attrib-upstream → main
Diff merge base: 98be86f
Review scope: Entire pinned PR diff against main merge base 98be86f through 352bed9; relevant callers, lifecycle and tests inspected. Consolidation of independent Sonnet and Astra reviews, not an additional independent model review.
Eligibility: Bug fix addressing existing behavior; no new feature.
Overall assessment (audit only)
The Windows-specific changes introduce no separately substantiated defect, but the full main-based diff retains #504's Medium dropped-follow-up-write regression. The pinned #505 handler/consumer reproduced it on Linux; request changes for the inherited filtering interaction, not for attribute normalization.
Strength evidence
- {"strength_index": 0, "path": "chunkhound/services/realtime/events.py", "source": "pr-505.pinned.diff", "detail": "WATCHDOG_TO_CONSUMER_EVENT maps attrib to modified; on_any_event uses the mapped local event_type for source/filtered callbacks, admission and _queue_event. This does not establish follow-up scheduling correctness."}
- {"strength_index": 1, "path": "tests/realtime/test_realtime_windows_attrib.py", "source": "pr-505.pinned.diff", "detail": "test_windows_read_raises_no_event_and_write_is_a_change awaits a sentinel, skips when atime does not change, checks read/write queues and uses monkeypatch to restore WATCHDOG_FILE_NOTIFY_FLAGS; no local Windows pass is asserted."}
Finding #1 evidence
- Final cross-PR audit executed the actual pinned #505 handler and consumer with Linux watchdog 6.0.0: merge-base handler delivered value = 2; head delivered only value = 1 and suppressed three modified events. Exit 0. Probe: /tmp/chunkhound-final-audit-qfk_juar/probe-505.py.
- pipeline.py is byte-identical between #504 and #505. Its same-type dedup at 1061-1081 precedes add_file's active-follow-up reservation at 957-964. This is inherited in the full merge-base diff, not newly introduced by the Windows-only final commit.
Reviewer keys: astra
Verification
- Final audit: pinned #505 Linux handler/consumer probe exited 0 and reproduced dropped second-write admission; simplified in-flight sink, not native end-to-end indexing. See final-audit.json for commands and output.
- Reconciler verified both completed statuses, provenance validity, exact pinned metadata/worktree HEAD, full-index diff bytes, report SHA-256 hashes and distinct actual assistant-message provider/model/responseModel identities.
- Both reviewers ran uv run --no-sync mypy chunkhound: 993 errors in 89 files. Astra shadowed all three changed production files with merge-base versions and obtained the same normalized diagnostics.
- Sonnet targeted pytest: two collection errors, zero tests run. Astra targeted pytest including watchdog import isolation: three collection errors, zero tests collected successfully.
- Astra supplementary AST-extracted production-logic checks passed for attribute normalization, read rejection, Windows mask guards/idempotence (fake external Windows module), and a real Linux watchdog 6 observer read/append check.
- Reconciler traced events.py normalization into pipeline.py:1092-1095 add_file processing and confirmed both startup and dynamic directory scheduling use the same event filter.
Limitations
- The native extension is missing from the shared environment, preventing application-test collection; no environment repair was attempted.
- Linux and watchdog 6.0.0 only: actual Windows notifications and watchdog 7 behavior were not executed locally. Isolated checks do not replace application or Windows tests.
- CI was green at the pinned inventory snapshot; no fresh remote CI run was performed by the reconciler.
- CI is a captured snapshot, not a fresh run or a guarantee of current branch status.
- Model identities are verified declarations supplied by the reconciler; the renderer does not inspect raw reports or provenance events.
Disposition of discarded / merged findings
- Final audit supersedes the previous no-bug conclusion for the full diff: the pinned #505 runtime probe reproduces #504's filtering/dedup interaction. The incremental Windows change remains without a separate finding. Attribute this shared issue to #504 and avoid posting duplicate comments when reviewing the stack jointly.
- Sonnet process-wide watchdog flag observation is documented behavior; no second in-process watchdog consumer or concrete regression was demonstrated. Not promoted to a finding.
- Sonnet timing/flakiness concern is not backed by a failing run; retained only as Windows verification risk, not a defect.
- Sonnet startup observer protocol concern is preexisting: Astra baseline comparison found identical normalized diagnostics. No runtime bug established.
Independent reviewer provenance
- sonnet — provider: amat-tfy; requested model: standard-chat-dev/claude-sonnet-5.5; verified response model: aws-aidev-models/us.anthropic.claude-sonnet-5-5. Identity evidence · Raw report
- astra — provider: amat-tfy; requested model: frontier-chat-dev/gpt-6-astra; verified response model: gpt-6-astra. Identity evidence · Raw report
CI snapshot
Captured: 2026-11-11T14:18:23.581921+00:00. Eligibility green: True. Counts: {"SKIPPED": 2, "SUCCESS": 23}
- site-build: SUCCESS (COMPLETED)
- site-build-validation (ubuntu-latest): SUCCESS (COMPLETED)
- site-build-validation (macos-latest): SUCCESS (COMPLETED)
- site-build-validation (windows-latest): SUCCESS (COMPLETED)
- rust-checks (ubuntu-latest): SUCCESS (COMPLETED)
- rust-checks (macos-latest): SUCCESS (COMPLETED)
- rust-checks (windows-latest): SUCCESS (COMPLETED)
- native-wheel-smoke-arm64: SUCCESS (COMPLETED)
- native-dev-macos: SUCCESS (COMPLETED)
- watchman-runtime-validation (ubuntu-latest, 3.14): SUCCESS (COMPLETED)
- watchman-runtime-validation (windows-latest, 3.14): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 3): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 3): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 3): SUCCESS (COMPLETED)
- old-linux-wheel-smoke (Ubuntu 20.04 (glibc 2.31), UBUNTU_20_04_IMAGE, ca-certificates curl, 3.12): SUCCESS (COMPLETED)
- old-linux-wheel-smoke (Ubuntu 22.04 + Python 3.10, UBUNTU_22_04_IMAGE, ca-certificates curl pytho...: SUCCESS (COMPLETED)
- watchman-rollout-gate: SUCCESS (COMPLETED)
- pages-artifact: SKIPPED (COMPLETED)
- deploy: SKIPPED (COMPLETED)
Reviewed by Ariel Vaknin via pi.dev
Brings in chunkhound#507 (never drop a duplicate event while the path's change is being processed), which the review's stale-index finding needs, and chunkhound#489. One conflict, in the startup.py import from .events: both names kept (forward_to_loop from main, watchdog_event_filter from this branch). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…filtered With read-only events dropped, two writes reach the consumer as modified, modified, with no open or close between them. The test drives the real handler with the Linux sequence (write, the indexing run's read, a second write inside the duplicate-event window) through the real consumer and process loop, and checks the second write is processed. It fails without the consumer's rule that a path being processed never has a duplicate dropped (chunkhound#507). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… debounce With read-only events dropped, every save after the first reaches the consumer as a duplicate `modified` and is suppressed before add_file, which is what pushed the pending debounce back. On Linux a burst of saves was then indexed part-way through and again afterwards (10 saves 0.3 s apart: 5 passes instead of 1, each queueing an embed pass). The suppression branch now refreshes the debounce horizon for a write whose change is waiting in debounce. Tests: a burst of saves closer than the debounce delay is indexed once, with the final content; the write-after-read test now uses fake services, a long duplicate window so it always exercises the rule, and gathers its tasks on the way out. The events.py comment no longer says dropping `closed` changes nothing indexed: that holds only with the consumer's two rules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…windows-attrib-upstream Brings in chunkhound#504's review changes: main (with chunkhound#507's active-path rule), the consumer's debounce refresh for a suppressed duplicate write, and their tests. Two conflicts: - events.py: this branch's WATCHDOG_TO_CONSUMER_EVENT and ignore_windows_last_access() are kept; the opening comment takes chunkhound#504's corrected wording (dropping `closed` is safe only with the consumer's two rules). - startup.py: the import from .events names all four symbols. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up to the debounce refresh. The duplicate check is back to main's exact condition, so a repeated delete or directory event no longer resolves its path; only a suppressed write looks up its debounce key. The refresh applies on every backend that goes through the consumer (watchdog on any OS, Watchman): a burst of saves is indexed once, and a file written without pause is indexed once it goes quiet, which is what the debounce documents. The burst test now waits for the indexing pass instead of a fixed sleep, so a stalled runner cannot end it before the pass runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…windows-attrib-upstream Brings in chunkhound#504's review follow-up (the debounce key is resolved only for a suppressed write; the burst test waits for the indexing pass). No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@VakninAriel thanks. As you noted, the finding comes from #504's filter, not from the attrib change, so it's fixed on #504 and merged in here (8c0f961, then ad7e239 for #504's last follow-up). #504's reply has the detail: #507's rule on main keeps a write made while the file is being processed, and a dropped duplicate save now still pushes the pending debounce back. Both come with tests. On this branch:
🤖 Generated with Claude Code, reviewed by FStrasz |
|
Looks good to me! |
Brings in chunkhound#504's squash (11d1753) and chunkhound#510. This branch already carries chunkhound#504's final head (4e10023), and the squash is byte-identical to that head merged onto 84ab53d, so the conflicts in realtime/events.py and realtime/startup.py resolve to this branch merged with 84ab53d, which merges cleanly. No other conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in chunkhound#534. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@VakninAriel, following up on your review. The finding came from #504's read-only filter, and its fix landed with #504 (11d1753, details). This branch includes it. The test you suggested is 🤖 Generated with Claude Code, reviewed by FStrasz |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er factory Main's _create_watchdog_observer (chunkhound#509) now takes the inotify overflow callback and returns (observer, detection). The test's assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged main into this branch after #509 landed. A follow-up commit updates On this head, CI's windows job ran 🤖 Generated with Claude Code, reviewed by FStrasz |
|
looks good! |
The issues in this review are reviewed
Problem
Two Windows problems with the watchdog backend, both left open in #504.
1. Most in-place writes are never indexed.
FILE_ACTION_MODIFIEDrecord asattribwhenever itsLastChangeTimeis ahead of itsLastModificationTime(winapi._parse_extended_event_buffer). NTFS updates those two timestamps on its own schedule, so an ordinary append usually loses that race.open(path, "a")1.2 s apart): 26 arrived asattribonly, 4 asmodifiedonly.open(path, "r+")behaves the same way._consume_eventsacts oncreated/modified/deleted/dir_*only, so anattrib-only write is never queued for indexing.2. Every read takes a queue slot.
FILE_NOTIFY_CHANGE_LAST_ACCESS. With last-access updates on (fsutil behavior query disablelastaccess), every read of a file not read for over an hour raises an event:attribon watchdog 7,modifiedon 6.Fix
attribtomodified. Inevents.py,WATCHDOG_TO_CONSUMER_EVENTreplacesCONTENT_EVENT_TYPESas the one place a watchdog type is admitted, and mapsattribtomodified.modified.attribisIN_ATTRIB(chmod, touch). watchdog 6, the versionuv.lockpins, already reports that asmodified(inotify.py:elif event.is_attrib or event.is_modify). So on watchdog 7 this restores the watchdog 6 behaviour rather than adding new work.ignore_windows_last_access()clearsFILE_NOTIFY_CHANGE_LAST_ACCESSfromwatchdog.observers.winapi.WATCHDOG_FILE_NOTIFY_FLAGS. It is called in_create_watchdog_observer()before theObserveris built.ReadDirectoryChangesWcall, so clearing it before the observer starts covers every watch.LAST_WRITE,SIZEandATTRIBUTES.Measured
Setup: Windows 11, NTFS with last-access updates on, a real
chunkhound mcp --no-daemon(watchdog backend, regex only) on a 1,436-file TypeScript repository.query_readyand a 90 s quiet window, each run appended a token to one file five times, 3 s apart (outside the 2 s dedup window), and regex-searched for each token.live_indexing_statewhen quietbusy(157 queued)idleidleevents.py/startup.pycode.idle; after, 5 of 5 were found in 2.3–3.4 s and the state wasidle.Tests
tests/realtime/test_realtime_windows_attrib.pyadds two tests. Both fail without this commit and pass with it, on watchdog 7.1.0 and on 6.0.0.test_attrib_event_is_queued_as_a_change: anattribevent on an indexable file is queued as("modified", path). Without the commit it is queued as("attrib", path), which the consumer ignores.test_windows_read_raises_no_event_and_write_is_a_change(Windows only): this uses a real watchdog observer from_create_watchdog_observer().modified.attrib(7.1) ormodified(6.0).st_atime, i.e. last-access updates are off.monkeypatch.Realtime suites, run on Windows with Python 3.13 against both watchdog versions:
tests/realtime,tests/test_realtime_backend_config.py,tests/test_realtime_failures.py,tests/test_realtime_functional.py,tests/test_mcp_watchman_fallback.py,tests/unit/test_daemon_realtime_lifecycle.py,tests/unit/test_realtime_compaction_retry.py,tests/unit/test_realtime_embed_starvation.py,tests/unit/test_watchdog_import_isolation.py,tests/test_mcp_startup_barrier.py,tests/test_mcp_read_only.py.test_file_debouncing_cleans_up_state. It passed in 3 of 3 reruns on the same base.Related: #104 ("Failed to queue event" on a large Windows project): its traceback shows a burst of
FileModifiedEvents fromWindowsApiObserver, which fits problem 2 here (reads raise events on watchdog 6).🤖 Generated with Claude Code, reviewed by FStrasz