Skip to content

Fix shell process cleanup#564

Merged
rumpl merged 2 commits intodocker:mainfrom
rumpl:fix-shell
Oct 24, 2025
Merged

Fix shell process cleanup#564
rumpl merged 2 commits intodocker:mainfrom
rumpl:fix-shell

Conversation

@rumpl
Copy link
Copy Markdown
Member

@rumpl rumpl commented Oct 20, 2025

Instead of using exec.CommandContext and keeping the process handlers in the tool, select either the tool completion or the context cancellation, in the case a cancelled context, terminate the whole process group.

Draft for now, need to do it for windows too.

Fixes #562 (once I'm done)

@rumpl rumpl added the area/tools For features/issues/fixes related to the usage of built-in and MCP tools label Oct 20, 2025
@rumpl rumpl self-assigned this Oct 20, 2025
This was referenced Oct 21, 2025
@rumpl rumpl force-pushed the fix-shell branch 2 times, most recently from ab2833a to 5f50c1d Compare October 23, 2025 13:04
Terminating the command executed and all of its children too

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl rumpl marked this pull request as ready for review October 23, 2025 14:52
@rumpl rumpl requested a review from a team as a code owner October 23, 2025 14:52
Copy link
Copy Markdown
Contributor

@trungutt trungutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for Mac, when stop the stream, it also stops the child process

@trungutt
Copy link
Copy Markdown
Contributor

But it still doesn't handle cleanly long-running process yet

@rumpl
Copy link
Copy Markdown
Member Author

rumpl commented Oct 24, 2025

If the LLM starts a npm dev that never stops then you can cancel the stream and the thing will end. Here I am only handling clean stop of shell tools.

Background tools will come later if needed

@rumpl rumpl merged commit 3375277 into docker:main Oct 24, 2025
5 checks passed
@rumpl rumpl deleted the fix-shell branch November 4, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tools For features/issues/fixes related to the usage of built-in and MCP tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails to build on Windows platform

3 participants