fix: stop --mcp alone from triggering the UI keep-alive loop - #57
Open
JProck21 wants to merge 2 commits into
Open
fix: stop --mcp alone from triggering the UI keep-alive loop#57JProck21 wants to merge 2 commits into
JProck21 wants to merge 2 commits into
Conversation
ui_enabled was true for bare --mcp, not just --ui/--ui=. That made every plain stdio MCP session (the documented, standard invocation) hit the post-stdin-EOF "UI still serving" keep-alive loop on client disconnect, so the worker process (and its supervisor) never exited. Confirmed via ~/.infigraph/mcp.log: 119/133 sessions logged "stdin loop exited" yet their processes were still resident days later, some orphaned to pid 1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Regression test for the --mcp-alone-triggers-UI-loop leak fix — extracts the flag check into ui_enabled_from() so it's directly unit testable.
JProck21
requested review from
WinterQuant,
johnintuit,
murari316 and
sandeep-mewara
as code owners
August 11, 2026 17:51
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
infigraph-mcpwas leaking worker processes: passing--mcpalone incorrectlyset
ui_enabled = true, which puts the process into aloop { sleep(3600s) }keep-alive after stdin EOF instead of exiting. Over repeated MCP client
restarts this accumulates orphaned worker processes.
Root cause:
ui_enabledwas derived fromargs.iter().any(|a| a == "--ui" || a.starts_with("--ui=") || a == "--mcp")—the
|| a == "--mcp"clause meant bare--mcp(no--ui) still enabled theUI keep-alive path. Fix removes that clause so
ui_enabledonly reflects anactual
--ui/--ui=flag.Also extracted the check into
ui_enabled_from(args: &[String]) -> boolsoit's unit-testable in isolation from
run().Test plan
cargo test --allpassescargo clippy --all-targetspassesThe above exited 0 after the update.
Notes
No behavior change for
--ui/--ui=<port>/--mcp --uicombinations; only bare--mcpis affected.