Skip to content

auto_watch misses successful index_repository targets from another session root #2733

Closed

Description

@WarGloom

With auto_watch=true, an active MCP session can successfully index another repository or linked worktree, yet that target never joins the background watcher. This also affects explicitly named indexes.

Reproduction:

  1. Start an MCP session in an already indexed workspace.
  2. Call index_repository(repo_path="/workspace/service-worktree", name="service-review", mode="fast") and wait for success.
  3. Call index_status(project="service-review").
  4. Edit a source file in that worktree.

The target reports watched: false / not_session_project and remains stale until explicitly reindexed. The session coordinator registers only its path-derived startup project and stores one watch membership per session.

Expected behavior: with the existing auto_watch setting enabled, successfully indexed targets should be owned by the requesting live MCP session as additional watches. Keep their actual project names and root paths, retain other session watches, and release a watch when its final owner disconnects. Async indexing should attach only after success and only if the requester is still connected. Failed indexing and one-shot CLI calls should not acquire watches.

This is the automatic registration slice related to #1429 and #1660. It preserves session-scoped lifetime and the existing MCP tools/parameters; it does not require permanent daemon-owned watches.

Prepared with Codex on behalf of wargloom.

Activity

  1. DeusData commented on Oct 25, 2026

    @DeusData
    Owner

    Thank you for the named-worktree reproduction and the clear session-lifetime boundary. Attaching a successfully indexed target to its requesting live session needs maintainer review, particularly the asynchronous completion case. Sorry for the delay; I’ll follow up soon.

  2. DeusData commented on Oct 25, 2026

    @DeusData
    Owner

    Fixed on main by #2737 (merge commit 46c01c4). Thank you for the named-worktree reproduction and the precise session-lifetime contract. A successful index_repository from a live MCP session now registers its target for auto-sync; an async index attaches only after success while the requesting session is still connected; failed and CLI indexes add no watch; and auto_watch=false removes all watches. Please reopen if a target still reports not_session_project after upgrading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeditor/integrationEditor compatibility and CLI integrationux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions