Repository navigation
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/compat/v0_3/grpc_transport.py | 63.64% | 65.73% | 🟢 +2.10% |
| src/a2a/compat/v0_3/jsonrpc_transport.py | 75.23% | 75.68% | 🟢 +0.45% |
| src/a2a/compat/v0_3/proto_utils.py | 90.57% | 90.94% | 🟢 +0.37% |
| src/a2a/server/cluster/database_event_stream.py | 96.94% | 92.86% | 🔴 -4.08% |
| Total | 93.17% | 93.19% | 🟢 +0.02% |
Generated by coverage-comment.yml
This branch has not been deployed
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.
A v0.3 agent cannot be asked for an empty history, so the compat transports have to apply the v1.0
history_lengthsemantics to the task they return.Background
The two protocol versions disagree on
history_length = 0:0truncates the history to zero items; unlimited requires the field to be left unset (apply_history_lengthinsrc/a2a/utils/task.py).0means unlimited. The repo already encodes this rule and tests it intests/compat/v0_3/test_proto_utils.py::test_message_send_configuration_history_length("A v0.3 history_length of 0 means unlimited, as in task_query_params"), andproto_utils.FromProto.task_query_params/FromProto.message_send_configurationalready normalise0toNone.The gap
The compat client transports forward the caller's
history_lengthto the v0.3 agent verbatim and then return whatever comes back:rest_transport.get_tasksendsparams['historyLength'] = request.history_lengthjsonrpc_transport.get_task/send_messagesend the value produced byto_compat_get_task_request/to_compat_send_message_configurationgrpc_transport.get_tasksendshistory_length=request.history_lengthSo a v1.0 caller that asks for
history_length = 0(i.e. no history) gets the entire history back from a v0.3 agent - the exact opposite of the request.history_length = N > 0happens to work only because the v0.3 agent also does the truncation.This is the outbound direction (v1.0 caller -> v0.3 agent). The inbound direction (v0.3 request -> v1.0 handler) is a separate fix in
to_core_get_task_request/to_core_send_message_configuration, already covered by #1312, so this PR deliberately does not touch it.Fix
Apply the existing
apply_history_lengthhelper to the converted task inget_taskandsend_messageof the three compat transports. This is done on the result rather than on the request because v0.3 has no representation for "no history" - the transports ask for everything and then honour the v1.0 contract locally.history_length0N > 0Tests
tests/compat/v0_3/test_history_length_compat.pycoversget_taskfor all three transports withhistory_lengthof0,1and unset, plussend_messagefor REST and JSON-RPC. Reverting the source change fails 8 of the 11 new tests; the 3 "unset keeps history" cases pass both ways and act as the control.Full suite:
uv run pytest-> 2286 passed, 183 skipped, 3 xfailed, 1 xpassed. The 4 errors undertests/integration/cross_version/client_server/are environmental: they pass in isolation both with and without this change.ruff checkandruff format --checkare clean.AI disclosure
This change was produced with AI assistance and was checked against the specification and the existing tests cited above.