Summary
Cherry-picked commit d4d0132 (fix(mcp): detect stale DB after re-indexing and reconnect) from upstream abhigyanpatwari/GitNexus into our fork's main branch.
Upstream PR: abhigyanpatwari#297
Upstream commit: abhigyanpatwari/GitNexus@d4d0132
Applied as: 38a4f90 on this fork's main
What the fix does
ensureInitialized() now reads meta.json on each tool call to compare indexedAt against the stored loadedAt timestamp. When gitnexus analyze rebuilds the index, the next query closes the stale LadybugDB pool entry and re-opens a fresh connection automatically.
Files changed:
src/mcp/local/local-backend.ts — staleness detection logic
test/integration/augmentation.test.ts — mock loadMeta
test/integration/local-backend-calltool.test.ts — mock loadMeta
test/unit/calltool-dispatch.test.ts — mock loadMeta
Why this matters for evaOS
After running gitnexus analyze to re-index a repo, the MCP server was serving stale results from the old DB connection until the process was restarted. This fix auto-reconnects on the next tool call.
Notes
The cherry-pick applied cleanly via path remapping (upstream uses a gitnexus/ prefix subdirectory, our fork has files at root). No conflicts.
Summary
Cherry-picked commit
d4d0132(fix(mcp): detect stale DB after re-indexing and reconnect) from upstreamabhigyanpatwari/GitNexusinto our fork's main branch.Upstream PR: abhigyanpatwari#297
Upstream commit: abhigyanpatwari/GitNexus@d4d0132
Applied as: 38a4f90 on this fork's main
What the fix does
ensureInitialized()now readsmeta.jsonon each tool call to compareindexedAtagainst the storedloadedAttimestamp. Whengitnexus analyzerebuilds the index, the next query closes the stale LadybugDB pool entry and re-opens a fresh connection automatically.Files changed:
src/mcp/local/local-backend.ts— staleness detection logictest/integration/augmentation.test.ts— mockloadMetatest/integration/local-backend-calltool.test.ts— mockloadMetatest/unit/calltool-dispatch.test.ts— mockloadMetaWhy this matters for evaOS
After running
gitnexus analyzeto re-index a repo, the MCP server was serving stale results from the old DB connection until the process was restarted. This fix auto-reconnects on the next tool call.Notes
The cherry-pick applied cleanly via path remapping (upstream uses a
gitnexus/prefix subdirectory, our fork has files at root). No conflicts.