Skip to content

Gate git watcher behind auto_watch config (contained indexing)#625

Closed
Andy11-cpu wants to merge 2 commits into
DeusData:mainfrom
Andy11-cpu:fix/contained-indexing
Closed

Gate git watcher behind auto_watch config (contained indexing)#625
Andy11-cpu wants to merge 2 commits into
DeusData:mainfrom
Andy11-cpu:fix/contained-indexing

Conversation

@Andy11-cpu

@Andy11-cpu Andy11-cpu commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Split from the original bundled PR per review feedback. This PR covers auto_watch only; sibling PRs handle the other changes:

This PR

  • Add auto_watch config (default false)
  • Do not register the git watcher on MCP initialize unless auto_watch is enabled
  • Re-index only via index_repository, or when auto_watch is turned on after a manual index
  • index_repository registers the watcher only when auto_watch is enabled

Motivation

On multi-project setups, registering the git watcher on every MCP connect caused background re-index storms even when auto_index was false.

Test plan

  • cli_config_get_bool covers auto_watch default false
  • mcp_auto_watch_disabled_skips_watcher_on_connect in test_mcp.c
  • make -f Makefile.cbm test passes (CI)
  • MCP connect with existing index: watcher.skip (not watcher.watch) when auto_watch=false

Signed-off-by: Andy11-cpu canada11@duck.com

@Andy11-cpu Andy11-cpu force-pushed the fix/contained-indexing branch 3 times, most recently from f6fc7cd to 3450263 Compare June 25, 2026 17:52
@Andy11-cpu Andy11-cpu marked this pull request as draft June 26, 2026 07:27
@Andy11-cpu Andy11-cpu marked this pull request as ready for review June 26, 2026 07:37
@Andy11-cpu Andy11-cpu marked this pull request as draft June 26, 2026 07:41
@Andy11-cpu Andy11-cpu marked this pull request as ready for review June 26, 2026 07:43
@DeusData

Copy link
Copy Markdown
Owner

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.

@DeusData DeusData added enhancement New feature or request stability/performance Server crashes, OOM, hangs, high CPU/memory ux/behavior Display bugs, docs, adoption UX priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Jun 29, 2026
@DeusData

DeusData commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Thanks. This bundles several independent behavior changes: auto_watch, project deduplication, RAM tiering, and hook opt-in defaults. Please split these or link focused tracking issues for each. Also please remove generated/co-author/session attribution trailers from non-merge commits. Because this changes MCP initialization/watchers and install defaults, each behavior needs focused tests and CI evidence.

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>
@Andy11-cpu Andy11-cpu changed the title Contained indexing: manual re-index only, dedup projects, lower RAM on 16GB Gate git watcher behind auto_watch config (contained indexing) Jul 2, 2026
@Andy11-cpu Andy11-cpu force-pushed the fix/contained-indexing branch from 444863f to fae93c3 Compare July 2, 2026 01:57
@Andy11-cpu Andy11-cpu requested a review from DeusData as a code owner July 2, 2026 01:57
@Andy11-cpu

Copy link
Copy Markdown
Contributor Author

Thanks for the review — addressed all three points:

1. Split into focused PRs

2. Removed co-author / session attribution trailers
Non-merge commits now have a single Signed-off-by line only (no Co-authored-by: Cursor).

3. Focused tests per behavior

CI should run on each PR independently. Happy to adjust merge order if you prefer a different stack.

@DeusData

DeusData commented Jul 4, 2026

Copy link
Copy Markdown
Owner

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!

@DeusData DeusData closed this Jul 4, 2026
rarepops pushed a commit to rarepops/codebase-memory-mcp that referenced this pull request Jul 4, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority/normal Standard review queue; useful PR with ordinary maintainer urgency. stability/performance Server crashes, OOM, hangs, high CPU/memory ux/behavior Display bugs, docs, adoption UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants