feat: add receive_timeout parameter to Connection class#1
Open
feat: add receive_timeout parameter to Connection class#1
Conversation
…rotocol#88) Bumps the uv group with 1 update in the / directory: [uv](https://github.com/astral-sh/uv). Updates `uv` from 0.9.7 to 0.11.6 - [Release notes](https://github.com/astral-sh/uv/releases) - [Changelog](https://github.com/astral-sh/uv/blob/main/CHANGELOG.md) - [Commits](astral-sh/uv@0.9.7...0.11.6) --- updated-dependencies: - dependency-name: uv dependency-version: 0.11.6 dependency-type: indirect dependency-group: uv ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…tclientprotocol#89) Bumps the uv group with 1 update in the / directory: [pytest](https://github.com/pytest-dev/pytest). Updates `pytest` from 8.4.2 to 9.0.3 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@8.4.2...9.0.3) --- updated-dependencies: - dependency-name: pytest dependency-version: 9.0.3 dependency-type: direct:development dependency-group: uv ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ientprotocol#86) * fix: reject pending requests on EOF to prevent infinite hang 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> * fix: fail fast after connection EOF --------- Co-authored-by: Debug Agent <debug@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Chojan Shang <psiace@apache.org>
agentclientprotocol#90) Bumps the uv group with 1 update in the / directory: [python-dotenv](https://github.com/theskumar/python-dotenv). Updates `python-dotenv` from 1.2.1 to 1.2.2 - [Release notes](https://github.com/theskumar/python-dotenv/releases) - [Changelog](https://github.com/theskumar/python-dotenv/blob/main/CHANGELOG.md) - [Commits](theskumar/python-dotenv@v1.2.1...v1.2.2) --- updated-dependencies: - dependency-name: python-dotenv dependency-version: 1.2.2 dependency-type: direct:development dependency-group: uv ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: bump acp protocol to 0.12.2 Signed-off-by: Chojan Shang <psiace@apache.org> * *: refine Signed-off-by: Chojan Shang <psiace@apache.org> --------- Signed-off-by: Chojan Shang <psiace@apache.org>
…tclientprotocol#92) Some ACP clients (notably Zed) send a date string like "2024-11-05" as the protocolVersion instead of an integer. The Rust SDK already handles this gracefully — its Deserialize impl maps any string to V0 with the comment "Old versions used strings". The Python SDK rejected strings outright, causing the agent process to crash on the very first handshake. Changes: - Add `_coerce_protocol_version` field_validator to `InitializeRequest` in `src/acp/schema.py` that maps non-integer values to 1 (current stable version), mirroring the Rust SDK's lenient behaviour. - Add `CLASS_VALIDATOR_INJECTIONS` table and `_inject_field_validators` post-processing step to `scripts/gen_schema.py` so the validator is re-applied automatically on future schema regenerations. - Add `_ensure_pydantic_import` helper used by the injection step to add `field_validator` to the generated pydantic import line. Ref: https://github.com/agentclientprotocol/rust-sdk/blob/main/crates/agent-client-protocol-schema/src/version.rs Co-authored-by: liuyuan90 <liuyuan90@meituan.com> Co-authored-by: Chojan Shang <psiace@apache.org>
…tocol#87) _receive_loop only checked for EOF (b""), but blank lines like b"\n" or b"\r\n" are truthy and reached json.loads(), causing JSONDecodeError. Strip each line and skip when empty before parsing.
- Add optional receive_timeout parameter to Connection.__init__ - Implement timeout handling in _receive_loop using asyncio.wait_for - Raise RequestError.internal_error on timeout for graceful error handling This allows users to configure a timeout for receiving messages from agents, preventing indefinite hangs when an agent becomes unresponsive.
af5eae4 to
3cfbcb9
Compare
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
Adds
receive_timeoutparameter toConnectionclass to prevent indefinite hangs when agents become unresponsive.Related issues
None
Testing
Ran the following checks:
Output:
make testOutput:
Docs & screenshots
No documentation updates included in this PR. The parameter is optional and defaults to
None, preserving existing behavior. Documentation can be added in a follow-up PR if needed.