Skip to content

fix(index): coordinate rebuilds with running MCP daemons (#1325) - #2051

Merged
colbymchenry merged 4 commits into
mainfrom
fix/1325-index-while-mcp-running
Sep 27, 2026
Merged

colbymchenry merged 4 commits into
mainfrom
fix/1325-index-while-mcp-running

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Problem

On Windows, an MCP daemon surviving client shutdown retained SQLite handles, causing codegraph index to fail with EPERM.

Fix

Build on @hbui290's #1375 with current identity safeguards, confirmed termination, and rebuild ownership that prevents daemon/proxy reopening. Preserve foreign and replacement locks and report failed shutdown accurately.

Validation

  • Windows VM repro: main exited 1 with EPERM; fix-1325 exited 0.
  • Five focused suites: daemon-registry, daemon-manager, index-command, index-daemon-rebuild, and writer-lock.
  • Windows: 43 passed, including real MCP-close/rebuild and active-client recovery.
  • macOS and Linux Docker: 42 passed, 1 Windows-only skip each.
  • Builds passed; npx tsc --noEmit passed on Windows and macOS.

Fixes #1325

🤖 Generated with Claude Code

hbui290 and others added 4 commits September 27, 2026 10:11
Stop verified project daemons and confirm termination before recreating SQLite.
Fence daemon and proxy reopening throughout rebuilds while preserving foreign and newer locks.
Add Windows lifecycle coverage and cross-platform shutdown regressions.

Co-authored-by: Harry B ✦ <drewavesx0@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Carry the #1325 rebuild fence through the upstream explicit-project lifecycle, read-only engine opens, synchronous initialization retries, and direct writer acquisition. Preserve shared project leases, read-only fallback behavior, freshness handling, and direct-mode query pools.

Cover watched, unwatched, and read-only engines blocking during a foreign rebuild and recovering after the fence is released.
#1325)

A projectPath call during `codegraph index` hit assertNoRebuild's plain Error
and returned isError; it is an expected, temporary condition, so it now uses a
RebuildInProgressError that the tool handler answers success-shaped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegraph index fails with "database file is in use" when MCP server is still running

2 participants