fix(insight): terminate dashboard when Claude/MCP exits#296
Open
flightlesstux wants to merge 6 commits intomksglu:nextfrom
Open
fix(insight): terminate dashboard when Claude/MCP exits#296flightlesstux wants to merge 6 commits intomksglu:nextfrom
flightlesstux wants to merge 6 commits intomksglu:nextfrom
Conversation
The ctx_insight dashboard was spawned with `detached: true` + `unref()` and never tracked, so it outlived the MCP process and kept running in the background after Claude closed. - Track the spawned child in `_insightChild` and SIGTERM it from `shutdown()` (also kills it on re-invocation within the same session). - Pass `INSIGHT_PARENT_PID` and add a 5s watchdog in `insight/server.mjs` that exits on `ESRCH` — covers SIGKILL / crash paths where `shutdown()` cannot run, plus orphans from prior sessions. - Update skill doc to note auto-cleanup. Co-Authored-By: Claude Opus 4.7 (1M context) <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
detached: true+unref()and never tracked, so it kept running after Claude closed_insightChildand SIGTERM it fromshutdown()(also kills prior child on re-invocation)INSIGHT_PARENT_PIDand add a 5sprocess.kill(ppid, 0)watchdog ininsight/server.mjsfor SIGKILL / crash / prior-session-orphan pathsWhy
User expectation: closing Claude should close the dashboard. Current behavior leaked a node process + bound port across sessions.
Test plan
ctx_insight, confirm dashboard upkill -9the MCP process, confirm dashboard self-exits within ~5s (watchdog)ctx_insightin same session, confirm old child killed before new one spawns