Repository navigation
Conversation
The JSON-RPC transport never looked at the status of a response. An
error that something in front of the agent answers itself (an
authenticating proxy's 401, a gateway's 429 or 502) carries no
JSON-RPC envelope, so the caller got "failed to parse JSON-RPC
response" and could not tell a credential or rate-limit problem from
a broken server. A streaming call answered that way without a content
type was handed to the SSE parser and came back as an empty stream.
A body that is not a JSON-RPC envelope is now reported with its
status, as the REST transport already does ("HTTP 429 Too Many
Requests: <body>"); a JSON-RPC envelope is still decoded whatever the
status, and a non-success status is never treated as a stream.
Fixes: a2aproject#404
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: gulldan <[email protected]>
The streaming test matched on the result and panicked in an `Ok` arm that a passing run never reaches, so that line stayed uncovered. Taking the error with `.err().expect()` keeps the assertion and needs no `Debug` on the stream. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: gulldan <[email protected]>
google.protobuf.Value carries every number as a double, and
proto_value_to_json_value turned each one back into a JSON float, so
an integer in a data part or in metadata reached the executor, and a
client's decoded response, as 3600.0. serde then refuses it for an
integer type ("invalid type: floating point `3600.0`, expected u32").
A whole number within +-2^53, where a double is exact, is now given
back as an integer; other numbers stay floats. The round-trip tests
that used floats to work around this now use integers, and a new
protojson test decodes a JSON-RPC SendMessage whose data part holds an
integer and deserializes it into u32.
Fixes: a2aproject#399
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: gulldan <[email protected]>
InMemoryTaskStore never removed a task, and TaskStore has no delete, so a long-running agent kept every task it ever served: 20,000 tasks with a 4 KiB artifact each held 192 MiB. InMemoryTaskStore::with_terminal_task_limit(n) keeps at most n tasks in a terminal state and purges the one that reached its terminal state earliest. Tasks that are not terminal are never purged, and a purged task reads as TaskNotFoundError, which A2A 3.3.2 allows for a task that was completed and purged. new() keeps every task, as before. With a limit of 1,000 the same run stays at about 20 MiB. Fixes: a2aproject#401 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: gulldan <[email protected]>
gulldan
force-pushed
the
feat/inmemory-task-store-limit
branch
from
October 31, 2026 19:44
14447fd to
1997ab7
Compare
This was referenced Oct 31, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Nov 1, 2026
Member
|
Superseded by #441, which carries the same commit on an in-repo branch so the stack can be reviewed one commit at a time. |
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.
Fixes #401.
Problem
InMemoryTaskStorenever removes a task,TaskStorehas no delete, and onceDefaultRequestHandler::newtakes the store the embedder cannot reach it, so a long-running agent keeps every task it has ever served. 20,000 tasks with one 4 KiB artifact each held 192 MiB RSS (program in #401). §13.4: agents SHOULD implement appropriate data retention policies.Change
InMemoryTaskStore::new().with_terminal_task_limit(n)keeps at mostntasks in a terminal state:update,begin_cancel, orcreateof an already terminal task; re-applying the same terminal state does not count it again;n, the task that reached its terminal state earliest is purged, under the same write lock;TaskNotFoundError, which §3.3.2 describes for a task "already completed and purged".InMemoryTaskStore::new()keeps every task and tracks nothing extra, as before.save_taskreturns the task it wrote rather than re-reading the store, so a task that is purged right after finishing still gets its response.Tests
test_terminal_task_limit_purges_the_oldest_finished_task: limit 2; three tasks complete, the first is purged, a working task survives, a re-applied terminal state is not counted twice, a cancel and acreateof a failed task each push out the next oldest, and the store ends with exactly two entries.test_unlimited_store_keeps_every_finished_task: without a limit all 100 finished tasks stay and no order is tracked.with_terminal_task_limit(1_000): 19.6, 19.9, 20.7, 18.9 MiB RSS at 5,000/10,000/15,000/20,000 tasks, 1,000 stored (onmain: 51.7 → 192.2 MiB, all 20,000 stored).cargo metadata --locked,cargo hack check --all-targets --each-feature,cargo fmt --check,cargo hack clippy --all-targets --each-feature -- -D warnings,cargo test --workspace --exclude itk-rust-current-agent, copyright headers — all green.Overlap with the A2A 1.1 stack
#385–#397 also edit
inmemory.rs(e.g.list_scoped) and keep the plainHashMap, so this diff does not apply as is onrefs/pull/396/head; the change is local to the store and carries over directly. Happy to rebase once the stack lands.🤖 Generated with Claude Code