fix(shell): resolve bash timeout hang when daemon inherits stdio pipes#10
Merged
Merged
Conversation
Collaborator
Author
055a1ca to
7183e78
Compare
- destroy stdout/stderr on abort to release stdio pipes held by detached daemons\n- use `exit` instead of `close` event to resolve exit promise
7183e78 to
cf73f1f
Compare
RealKai42
approved these changes
May 25, 2026
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
Fixes a bug where the Bash tool'''s timeout would not take effect when a command spawned a detached daemon process that inherited stdio pipes. The agent would hang indefinitely because the process exit promise waited for stdio streams to close, which never happened while the daemon held the pipe file descriptors open.
1. Destroy stdio streams on abort in BashTool
Problem: When a Bash command spawned a detached daemon that inherited stdout/stderr pipes, aborting the shell command did not release those pipes. The daemon kept the file descriptors open, preventing the
closeevent from firing and causing the agent to hang indefinitely.What was done:
proc.stdoutandproc.stderrin the abort handler insideBashToolto forcibly close the stdio pipes.2. Use
exitinstead ofclosein LocalProcessProblem:
child.on('\''close'\'')waits for all stdio streams to close before resolving the exit promise. If a detached daemon inherits stdio pipes, thecloseevent never fires.What was done:
closetoexitinLocalProcessso the exit promise resolves as soon as the child process itself terminates, regardless of stdio stream state.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.