Repository navigation
Build a project's map in one process at a time - #11
Merged
Merged
Conversation
Each MCP server analyzed a project on its own, so sessions that opened the same repository at once ran the same analysis side by side. A map build now takes an exclusive transaction on build.lock beside the map; a process that finds it held waits, then finds the version built there, or builds from it. The system releases the lock when its process stops, however it stops. A capture whose version already exists takes no lock, so queries do not wait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each MCP server built a project's map on its own. Sessions that open the same repository at once, as #10 saw with two
tscprocesses on one repository, ran the same analysis side by side, each with its own memory.A map build now takes an exclusive transaction on
build.lock, beside the project's map in the cache. A process that finds the lock held waits. Once it has the lock, it checks again: if the other process built the same version, it uses that one. Otherwise it builds, replaying from what the other one built.Refs #10. This does not close the issue: the build still starts when the client connects, and
tsc's memory on that repository is not addressed.Known cost
A build has no time limit. While a process holds the lock, for example one stopped with Ctrl-Z, other sessions of the same repository cannot build the map until it resumes or exits. Their tool calls still return "still building" after 40 seconds instead of hanging. If a build hangs because of the repository's contents, another session building on its own would most likely hang too.
Testing
test/store.test.ts, 2 new tests:tscand biome pass. 7 related test files (36 tests) pass locally; the full suite was not run locally.layermap mcpprocesses started on a 3,312-file TypeScript monorepo with 220 tsconfigs and itsnode_modules, from a fresh cache each time:tsc, 4.4 GB peak, both ready at 48 stsc, 1.9 GB peak, both ready at 40.6 sSIGKILLmid-buildSIGSTOPfor 100 sSIGCONTNot run on Windows, apart from CI, and not tried under the Codex desktop app.
🤖 Generated with Claude Code