Skip to content

fix(proc): reap codegraph's process tree off Windows via process groups#3787

Merged
esengine merged 2 commits into
main-v2from
fix/codegraph-reap-unix
Jun 10, 2026
Merged

fix(proc): reap codegraph's process tree off Windows via process groups#3787
esengine merged 2 commits into
main-v2from
fix/codegraph-reap-unix

Conversation

@esengine

Copy link
Copy Markdown
Owner

The Unix/macOS counterpart of the Windows codegraph reaping (#3755). Off Windows, KillTree only signalled the direct child (Process.Kill), so a launcher whose sub-daemon outlives it — codegraph's bundled node runtime — left orphan grandchildren after reasonix exited.

StartTracked now starts the child in its own process group (Setpgid), and KillTree reaps the whole group with a negative-pid SIGKILL (falling back to a direct kill if the child isn't a group leader). SetProcessGroupKill exposes the same for one-shot children started outside StartTracked (codegraph init). It's a no-op on Windows, where the Job Object from #3755 already covers the tree, so transport_stdio.go needs no change.

Adds a !windows regression test that a launcher's backgrounded grandchild is reaped via the group, not left alive.

Cross-compiles for windows/linux/darwin; go vet clean. The macOS/Linux test jobs exercise the new path.

Closes #3735

Co-authored-by: ttmouse ttmouseg@gmail.com

KillTree off Windows only signalled the direct child, so a launcher whose
sub-daemon outlives it (codegraph's bundled node runtime) left orphan
grandchildren after exit — the Unix counterpart of the Windows Job Object
reaping. StartTracked now starts the child in its own process group
(Setpgid) and KillTree kills the whole group with a negative-pid signal;
SetProcessGroupKill exposes the same for one-shot children (codegraph init).
No-op on Windows, where the Job Object already covers the tree.

Co-authored-by: ttmouse <ttmouseg@gmail.com>
@esengine esengine requested a review from SivanCola as a code owner June 10, 2026 05:18
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development mcp MCP servers / plugins (internal/plugin, codegraph) labels Jun 10, 2026
@esengine esengine merged commit daf60e8 into main-v2 Jun 10, 2026
12 of 13 checks passed
@esengine esengine deleted the fix/codegraph-reap-unix branch June 10, 2026 05:27
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
…ps (esengine#3787)

* fix(proc): reap codegraph's process tree off Windows via process groups

KillTree off Windows only signalled the direct child, so a launcher whose
sub-daemon outlives it (codegraph's bundled node runtime) left orphan
grandchildren after exit — the Unix counterpart of the Windows Job Object
reaping. StartTracked now starts the child in its own process group
(Setpgid) and KillTree kills the whole group with a negative-pid signal;
SetProcessGroupKill exposes the same for one-shot children (codegraph init).
No-op on Windows, where the Job Object already covers the tree.

Co-authored-by: ttmouse <ttmouseg@gmail.com>

* test(proc): lift the reap-poll break into the loop condition (QF1006)

---------

Co-authored-by: reasonix <reasonix@deepseek.com>
Co-authored-by: ttmouse <ttmouseg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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