fix: reject pending requests on EOF to prevent infinite hang#86
Open
simonrosenberg wants to merge 1 commit intoagentclientprotocol:mainfrom
Open
fix: reject pending requests on EOF to prevent infinite hang#86simonrosenberg wants to merge 1 commit intoagentclientprotocol:mainfrom
simonrosenberg wants to merge 1 commit intoagentclientprotocol:mainfrom
Conversation
When the remote end closes the connection (e.g., subprocess crashes), _receive_loop exits cleanly on EOF without raising an exception. This means _on_receive_error is never called and pending outgoing request futures hang forever. Add reject_all_outgoing() after the receive loop breaks on EOF so callers get a ConnectionError instead of an infinite hang. Fixes agentclientprotocol#85 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
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
When the remote end closes the connection (e.g., an ACP subprocess crashes on startup),
_receive_loopexits cleanly on EOF without raising an exception. SinceTaskSupervisor._on_doneonly callson_errorfor exceptions,_on_receive_erroris never invoked and_state.reject_all_outgoing()is never called. Any in-flightsend_request()futures hang forever.This adds a
reject_all_outgoing()call after the receive loop breaks on EOF, so callers get aConnectionErrorinstead of an infinite hang.Test plan
ConnectionError("Connection closed: remote end sent EOF")instead of hangingFixes #85