Skip to content

fix(codegraph): run the indexer daemon below normal priority#3948

Merged
esengine merged 1 commit into
main-v2from
fix/3797-codegraph-low-priority
Jun 11, 2026
Merged

fix(codegraph): run the indexer daemon below normal priority#3948
esengine merged 1 commit into
main-v2from
fix/3797-codegraph-low-priority

Conversation

@esengine

Copy link
Copy Markdown
Owner

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.Spec gains a LowPriority flag, applied only to the first-party CodeGraph spec:

  • Windows: BELOW_NORMAL_PRIORITY_CLASS set at process creation (composes with the existing CREATE_NO_WINDOW — covered by test).
  • Unix/macOS: 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.

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.
@esengine esengine requested a review from SivanCola as a code owner June 11, 2026 04:41
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development mcp MCP servers / plugins (internal/plugin, codegraph) config Configuration & setup (internal/config) labels Jun 11, 2026
@esengine esengine merged commit 2a7d83f into main-v2 Jun 11, 2026
14 checks passed
@esengine esengine deleted the fix/3797-codegraph-low-priority branch June 11, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration & setup (internal/config) mcp MCP servers / plugins (internal/plugin, codegraph) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant