fix(hub): close transport after IO loop to prevent sub-agent process leak#93
Merged
yishuiliunian merged 3 commits intomainfrom Apr 9, 2026
Merged
fix(hub): close transport after IO loop to prevent sub-agent process leak#93yishuiliunian merged 3 commits intomainfrom
yishuiliunian merged 3 commits intomainfrom
Conversation
…ent process leak (#91) Sub-agent processes (`--serve`) hung indefinitely after completion due to a stdin pipe deadlock: the Hub never closed its write end, so the child's `tokio::io::stdin()` blocking read never received EOF. - Close transport in `finish_and_deliver` after emit/unregister/delivery, giving the child EOF on stdin so the process can exit - Break IPC reader task on `tx.send()` failure instead of silently continuing - Add `AgentProcess::wait_or_kill(timeout)` utility for bounded reaping
yishuiliunian
added a commit
that referenced
this pull request
Apr 9, 2026
test_load_settings_empty_json_file_uses_defaults asserted a specific default model string, but LOOPAL_MODEL set by a parallel test (test_load_settings_all_env_var_scenarios) could override it. Replace with a non-empty check — the exact default is already verified in the serialized env-var test.
yishuiliunian
added a commit
that referenced
this pull request
Apr 9, 2026
test_load_settings_empty_json_file_uses_defaults asserted a specific default model string, but LOOPAL_MODEL set by a parallel test (test_load_settings_all_env_var_scenarios) could override it. Replace with a non-empty check — the exact default is already verified in the serialized env-var test.
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
loopal --serve) hung indefinitely after completion due to a stdin pipe deadlock: the Hub never closed its write end of the child's stdin, sotokio::io::stdin()'s blocking read never received EOFlsofthat pipes were still openagent_proc.wait()), child waits for stdin EOF (blocking thread, uncancellable per tokio docs)Changes
finish.rs: Moveconn.close()intofinish_and_deliver— closes transport writer after emit/unregister/delivery, giving the child EOF on stdinagent_io.rs: Passconntofinish_and_deliver; remove standaloneconn.close()calls fromspawn_io_loopandstart_agent_ioconnection.rs: IPC reader task breaks ontx.send()failure instead of silently continuing when incoming channel is droppedprocess.rs: AddAgentProcess::wait_or_kill(timeout)utility for bounded process reaping (not yet wired into default path)transport_close_test.rs: 5 tests — transport disconnect, EOF propagation, result-before-close ordering, child crash path, registry cleanupreader_exit_test.rs: 1 test — reader task exits and releases Mutex after channel dropTest plan
bazel build //...compilesbazel build //... --config=clippyzero warningsbazel test //...— 50/50 pass