Gate git watcher behind auto_watch config (contained indexing)#625
Gate git watcher behind auto_watch config (contained indexing)#625Andy11-cpu wants to merge 2 commits into
Conversation
f6fc7cd to
3450263
Compare
|
Huge thanks for opening this PR and for the work you put into it. The maintainer shop is currently full, so this may sit for a bit before it gets a proper review. We will come back to this as soon as possible with real feedback; I wanted to make sure it did not sit unacknowledged in the meantime. |
|
Thanks. This bundles several independent behavior changes: |
Reuse an existing cached project when the same repository is opened from a different path. Match by git canonical root or canonical filesystem path so duplicate .db files are not created. Signed-off-by: Andy11-cpu <canada11@duck.com>
Do not register the git watcher on MCP initialize unless auto_watch is explicitly enabled (default false). Re-index on connect only when auto_index is set; ongoing git polling requires auto_watch after a manual index. Signed-off-by: Andy11-cpu <canada11@duck.com>
444863f to
fae93c3
Compare
|
Thanks for the review — addressed all three points: 1. Split into focused PRs
2. Removed co-author / session attribution trailers 3. Focused tests per behavior
CI should run on each PR independently. Happy to adjust merge order if you prefer a different stack. |
|
Thank you — the auto_watch gate was the right idea for multi-project containment, and your instinct to gate the watcher registration was sound. We carried the auto_watch half over the line as 54efcef (PR #849) with you credited as co-author, defaulting the key to true (opt-out) so every existing user keeps background auto-sync exactly as before — only users who explicitly want containment flip it off. We deliberately left the bundled project-dedup commit out of this one: it's a substantial feature that deserves its own focused review, and it stays with #754 where it can get that. Closing this in favor of the distilled auto_watch gate — thanks again, and please do keep #754 moving on its own! |
…on (default on) Add the auto_watch config key (default: true) and route both session watcher-registration sites in mcp.c (autoindex completion and the already-indexed connect path) through a register_watcher_if_enabled() helper. When disabled, the skip is logged as a short structured line (watcher.register.skipped reason=auto_watch_off). Default is TRUE (opt-out): existing users keep background auto-sync unchanged; the knob exists for multi-project users who want each session contained to explicit indexing. Distilled from the auto_watch half of PR DeusData#625. The PR's bundled project-index dedup commit is excluded here — it belongs to DeusData#754's own review. Unlike the original PR, no watch registration is added to the index_repository handler (none exists on main; adding one would be new behavior beyond the gate), and the default is flipped from off to on to preserve current behavior. Tests: default-unset registers the watcher on connect (guards the no-behavior-change promise); auto_watch=false registers nothing — verified RED against the ungated production code, GREEN with the gate. Co-authored-by: Andy11-cpu <canada11@duck.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Summary
Split from the original bundled PR per review feedback. This PR covers auto_watch only; sibling PRs handle the other changes:
--hooks)This PR
auto_watchconfig (default false)initializeunlessauto_watchis enabledindex_repository, or whenauto_watchis turned on after a manual indexindex_repositoryregisters the watcher only whenauto_watchis enabledMotivation
On multi-project setups, registering the git watcher on every MCP connect caused background re-index storms even when
auto_indexwas false.Test plan
cli_config_get_boolcoversauto_watchdefault falsemcp_auto_watch_disabled_skips_watcher_on_connectintest_mcp.cmake -f Makefile.cbm testpasses (CI)watcher.skip(notwatcher.watch) whenauto_watch=falseSigned-off-by: Andy11-cpu canada11@duck.com