Skip to content

fix(compat): honor ClientCallContext.timeout in the v0.3 gRPC client - #1497

Merged
Iwaniukooo11 merged 2 commits into
a2aproject:mainfrom
saquibjawedbit:fix/compat-grpc-call-timeout
Nov 20, 2026
Merged

Iwaniukooo11 merged 2 commits into
a2aproject:mainfrom
saquibjawedbit:fix/compat-grpc-call-timeout

Conversation

@saquibjawedbit

Copy link
Copy Markdown
Contributor

Description

The v0.3 gRPC client (compat/v0_3/grpc_transport.py) never passed ClientCallContext.timeout to its gRPC calls, so a caller's per-call timeout was silently ignored for all 10 methods (streaming included): a call to a slow or stuck v0.3 agent waited until the server answered, and the transport's own A2AClientTimeoutError mapping could never fire for a caller deadline. The timeout setting was added for all transports in #776; the v0.3 gRPC client (#779) landed just after and missed it. The v1.0 gRPC and HTTP clients already honour it.

Fix: pass timeout=self._get_grpc_timeout(context) on every call, using the same helper as the v1.0 gRPC client (client/transports/grpc.py).

Testing

New parametrized test in tests/compat/v0_3/test_grpc_transport.py checking that each of the 10 calls receives the context's timeout.

Before the fix:

10 failed, 6 deselected

Manual check against a real gRPC server that takes 2 s to answer, called with timeout=0.2:

before: returned task 't1' after 2.00s (timeout=0.2s was ignored)
after:  raised A2AClientTimeoutError after 0.20s

Full suite:

$ pytest tests --ignore=tests/integration/cross_version
2626 passed, 215 skipped, 4 xfailed, 1 xpassed

ruff check, ruff format and ty pass on the changed files.

Fixes #1496 🦕

CompatGrpcTransport called every stub method with only `metadata=`, so
the per-call `timeout` in `ClientCallContext` never reached gRPC. A call
to a slow or hung v0.3 gRPC server therefore waited forever, even though
the caller had set a deadline, and the DEADLINE_EXCEEDED ->
A2AClientTimeoutError mapping in this transport could never fire for
it.

The v1.0 GrpcTransport and the HTTP transports already pass the timeout
through (a2aproject#776). CompatGrpcTransport landed right after that change and
did not pick it up. Pass `timeout=` on all ten stub calls, the same way
GrpcTransport does.
@saquibjawedbit
saquibjawedbit requested a review from a team as a code owner November 18, 2026 19:08
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/compat/v0_3/grpc_transport.py 68.75% 88.27% 🟢 +19.52%
Total 93.81% 94.11% 🟢 +0.29%

Generated by coverage-comment.yml

@Iwaniukooo11 Iwaniukooo11 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Iwaniukooo11
Iwaniukooo11 merged commit 06cd528 into a2aproject:main Nov 20, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: v0.3 gRPC client ignores ClientCallContext.timeout, so calls never time out

2 participants