fix(codegraph): run the indexer daemon below normal priority#3948
Merged
Conversation
The CodeGraph daemon walks and indexes the whole project tree in the background; on large repos it saturates CPU/IO alongside the system indexer (Spotlight on macOS) and has frozen M1 machines (#3797), and its idle file-watch load is the prime suspect for #3771. Spawn it below normal scheduling priority: BELOW_NORMAL_PRIORITY_CLASS at creation on Windows, renice +10 after start elsewhere, via a new LowPriority flag on plugin.Spec.
This was referenced Jun 11, 2026
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.
Problem
The CodeGraph daemon (
codegraph serve --mcp) indexes the project tree in the background at normal priority. On large repos that competes head-on with everything else on the machine — on Apple Silicon it has collided with Spotlight indexing the same tree hard enough to freeze the system (#3797), and its steady-state watch load is the prime suspect in the idle-CPU report (#3771).Fix
plugin.Specgains aLowPriorityflag, applied only to the first-party CodeGraph spec:BELOW_NORMAL_PRIORITY_CLASSset at process creation (composes with the existingCREATE_NO_WINDOW— covered by test).setpriority(PRIO_PROCESS, pid, 10)right after start.The daemon still uses every idle cycle, but the scheduler now lets the interactive session, the build you're running, and the OS indexer win contention instead of deadlocking against them. User-configured MCP servers are unaffected.
The disable escape hatch (
[codegraph] enabled = false) remains for machines where even background indexing is unwanted.