Skip to content

fix(llm): Prevent tool child processes from being killed by SIGINT#555

Merged
JeanMertz merged 1 commit intomainfrom
prr122
Apr 15, 2026
Merged

fix(llm): Prevent tool child processes from being killed by SIGINT#555
JeanMertz merged 1 commit intomainfrom
prr122

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

When the user presses Ctrl+C, Unix sends SIGINT to all processes in JP's process group, including any tool subprocesses. This caused tool executions to be killed by the signal rather than being cleanly managed through the cancellation token.

Two changes address this: process_group(0) isolates the child into its own process group on Unix, so terminal signals no longer reach it. kill_on_drop(true) ensures the child is still cleaned up when the tokio task is aborted on cancellation, preventing orphaned processes.

When the user presses Ctrl+C, Unix sends SIGINT to all processes in JP's
process group, including any tool subprocesses. This caused tool
executions to be killed by the signal rather than being cleanly managed
through the cancellation token.

Two changes address this: `process_group(0)` isolates the child into its
own process group on Unix, so terminal signals no longer reach it.
`kill_on_drop(true)` ensures the child is still cleaned up when the
tokio task is aborted on cancellation, preventing orphaned processes.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 50ed9a2 into main Apr 15, 2026
13 checks passed
@JeanMertz JeanMertz deleted the prr122 branch April 15, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant