Skip to content

fix: snapshot merge and indexing stuck issues (#276)#282

Merged
zc277584121 merged 2 commits intozilliztech:masterfrom
zc277584121:fix/snapshot-merge-and-indexing-stuck
Mar 11, 2026
Merged

fix: snapshot merge and indexing stuck issues (#276)#282
zc277584121 merged 2 commits intozilliztech:masterfrom
zc277584121:fix/snapshot-merge-and-indexing-stuck

Conversation

@zc277584121
Copy link
Collaborator

Summary

  • Snapshot cross-process overwrite fix (snapshot file gets overwritten #276): Multiple MCP server processes sharing ~/.context/mcp-codebase-snapshot.json would overwrite each other's entries. Changed saveCodebaseSnapshot() to use read-merge-write with mkdir-based file locking, ensuring concurrent processes preserve each other's data.

  • Indexing stuck fix: When a codebase gets stuck in "indexing" state (e.g., due to process crash), force=true re-index was blocked by the "already being indexed" check. Two changes:

    1. handlers.ts: Allow force=true to bypass the indexing check and clear stale state via removeCodebaseCompletely()
    2. snapshot.ts: On MCP server startup, reset any interrupted "indexing" entries to "indexfailed" status, preserving the last attempted percentage for diagnostics

Test plan

  • E2E: Normal index succeeds
  • E2E: Non-force index on stuck "indexing" state returns "already being indexed" error
  • E2E: Force reindex on stuck "indexing" state bypasses block and starts indexing
  • E2E: MCP restart resets stale "indexing" to "indexfailed" with correct error message and preserved progress
  • E2E: Normal index works after stale state reset
  • Build passes (pnpm build:mcp)

…rrupted indexing on startup

When a codebase gets stuck in "indexing" state (e.g., due to process crash or restart),
force reindex was blocked by the "already being indexed" check. This fix:

1. handlers.ts: Let force=true bypass the indexing check and clear stale state via
   removeCodebaseCompletely(), instead of being blocked indefinitely.
2. snapshot.ts: On MCP server startup, reset any interrupted "indexing" entries to
   "indexfailed" status, preserving the last attempted percentage for diagnostics.

Signed-off-by: Cheney Zhang <chen.zhang@zilliz.com>
@zc277584121 zc277584121 merged commit 76497e1 into zilliztech:master Mar 11, 2026
4 checks passed
@zc277584121 zc277584121 deleted the fix/snapshot-merge-and-indexing-stuck branch March 11, 2026 14:59
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.

1 participant