Skip to content

fix: preserve zero history length in REST get task - #1327

Open
Linux2010 wants to merge 41 commits into
a2aproject:mainfrom
Linux2010:codex/fix-rest-zero-history-length
Open

Linux2010 wants to merge 41 commits into
a2aproject:mainfrom
Linux2010:codex/fix-rest-zero-history-length

Conversation

@Linux2010

@Linux2010 Linux2010 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A REST GetTask with historyLength=0 omits the query parameter, so a server can return history even though the caller requested none. The A2A specification distinguishes zero from an unset limit.

Forward every explicitly set history length, including zero, and include the original request's history length and tenant in the interceptor payload. Add HTTP-level coverage for zero and unset values; the existing test covers a positive value.

Validation

  • Confirmed the new zero-limit test failed against the previous implementation.
  • mvn -pl client/transport/rest -am test (675 tests passed)
  • git diff --check

dependabot Bot and others added 27 commits November 18, 2026 10:51
…ct#1323)

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](softprops/action-gh-release@efb3536...8a0cd65)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 3.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…2aproject#1322)

Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 6.1.1 to 6.1.2.
- [Release notes](https://github.com/amannn/action-semantic-pull-request/releases)
- [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md)
- [Commits](amannn/action-semantic-pull-request@48f2562...2252a14)

---
updated-dependencies:
- dependency-name: amannn/action-semantic-pull-request
  dependency-version: 6.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 6.1.0 to 6.2.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@b843ebf...77dd5b2)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a2aproject#1315)

A blocking SendMessage reads the task back from the TaskStore once consumption
completes, but completion only proves the consumer saw the events that had
already been distributed to it. The last event of an agent turn can still be
inside MainEventBusProcessor at that point, which persists it *after* the
consumer is done, so the read returns the state from before that event:
SUBMITTED or WORKING instead of INPUT_REQUIRED, with nothing logged and no error
raised.

Terminal states never hit this - the awaitingFinalEvent machinery keeps the
consumer waiting for the final event. Interrupted states (INPUT_REQUIRED,
AUTH_REQUIRED) are not final, and neither is an artifact-only tail.

EventQueue#awaitDrained waits until no event accepted by the queue is left in
flight, i.e. until every semaphore permit taken at enqueue time has been
released by MainEventBusProcessor - which happens in its finally block, after
the event has been persisted and distributed. ChildQueue delegates to its
parent, since in-flight events are tracked there.

The blocking path now waits there between waiting for consumption and reading
the TaskStore. A timeout is logged and the previous behaviour is kept, so a
stuck processor degrades to what callers had before instead of failing the
request.

Fixes a2aproject#1302
…oject#1313)

Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.6.3 to 1.6.6.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](qos-ch/logback@v_1.6.3...v_1.6.6)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…2.0 (a2aproject#1310)

Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.51.0 to 2.52.0.
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.51.0...v2.52.0)

---
updated-dependencies:
- dependency-name: com.google.errorprone:error_prone_core
  dependency-version: 2.52.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…unk (a2aproject#1308)

TaskArtifactUpdateEvent#append means the content of an artifact is appended to a
previously sent artifact with the same ID. The 0.3 accumulation path only merged
the parts, so a chunk carrying its own metadata had that metadata silently
dropped, and keys the chunk wanted to override kept the value of the first chunk.
The v1.0 path already merges both, since a2aproject#616 (reported in a2aproject#615).

Mirror that behaviour in Utils_v0_3.appendArtifactToTask so the same stream
produces the same artifact through either client.

Artifact_v0_3.Builder#metadata rejects null, because it wraps the map in
Collections.unmodifiableMap(new HashMap<>(metadata)); the v1.0 builder tolerates
null, this one does not. The merged map is therefore only set when at least one
of the two artifacts actually carries metadata.

Cover both the utility and the client-side accumulation, which had no tests for
this path before.
…o 3.11.0 (a2aproject#1309)

chore: bump com.diffplug.spotless:spotless-maven-plugin

Bumps [com.diffplug.spotless:spotless-maven-plugin](https://github.com/diffplug/spotless) from 3.10.4 to 3.11.0.
- [Release notes](https://github.com/diffplug/spotless/releases)
- [Changelog](https://github.com/diffplug/spotless/blob/main/CHANGES.md)
- [Commits](diffplug/spotless@maven/3.10.4...maven/3.11.0)

---
updated-dependencies:
- dependency-name: com.diffplug.spotless:spotless-maven-plugin
  dependency-version: 3.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1.12 (a2aproject#1311)

chore: bump io.github.ascopes:protobuf-maven-plugin

Bumps [io.github.ascopes:protobuf-maven-plugin](https://github.com/ascopes/protobuf-maven-plugin) from 5.1.11 to 5.1.12.
- [Release notes](https://github.com/ascopes/protobuf-maven-plugin/releases)
- [Commits](ascopes/protobuf-maven-plugin@v5.1.11...v5.1.12)

---
updated-dependencies:
- dependency-name: io.github.ascopes:protobuf-maven-plugin
  dependency-version: 5.1.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: validate JSON-RPC response IDs

* fix: bind nonnull stream future directly

* fix: preserve HTTP error details without response id
* fix: improve server conformance and local ITK runs

Validate message input modes across transports and correct REST and JSON-RPC
wire formats, streaming responses, and push notification errors. Preserve
opening messages in task history and distribute persisted task snapshots.

Add a local ITK and ACTS launcher with Podman support and a results summary,
along with regression coverage for server and transport behavior.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>

* Updating TCK to main

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>

---------

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
…t a string (a2aproject#1343)

RestErrorMapper called getAsString() on the message, error and reason
fields of an error body. A JSON null or a non-primitive value made it
throw UnsupportedOperationException, which escaped RestTransport instead
of the A2AClientException that carries the HTTP status and headers.

Read these fields only when they are JSON primitives and otherwise treat
them as absent, so such responses map to an A2AClientHTTPError.

Fixes a2aproject#1342
….78.0 (a2aproject#1340)

chore: bump no.entur.mapstruct.spi:protobuf-spi-impl

Bumps [no.entur.mapstruct.spi:protobuf-spi-impl](https://github.com/entur/mapstruct-spi-protobuf) from 1.76.0 to 1.78.0.
- [Commits](entur/mapstruct-spi-protobuf@release-1.76.0...release-1.78.0)

---
updated-dependencies:
- dependency-name: no.entur.mapstruct.spi:protobuf-spi-impl
  dependency-version: 1.78.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…project#1346)

* fix(server): stop interrupted event consumers from busy-spinning

An interrupted EventConsumer now fails its stream with InternalError and closes
its queue, instead of polling again with the interrupt flag set.
InMemoryQueueManager.close(taskId) now also closes the task's child queues, as
the QueueManager.close contract states, so closing a task queue ends its
consumers. consumeOne now wraps the spec InternalError, not
java.lang.InternalError.

This fixes a2aproject#1345

* docs(server): explain why an interrupted poll ends the event consumer

* fix(server): skip MainQueue close callbacks when already closed
…rams (a2aproject#1337)

A v0.3 SendMessage with no messageId or with empty parts makes a message
record throw IllegalArgumentException: the v1.0 Message during the v0.3
to v1.0 conversion, or Message_v0_3 when REST and gRPC read the request.
Only JSONRPCHandler_v0_3.onMessageSend mapped it to invalid params, so
REST, gRPC and JSON-RPC message/stream reported an internal error.

Convert the exception where it is raised, as v1.0 does in
ProtoUtils.FromProto.convert(): Convert_v0_3_To10RequestHandler now
throws InvalidParamsError when converting the params, and
ProtoUtils_v0_3.FromProto.messageSendParams throws
InvalidParamsError_v0_3.

Fixes a2aproject#1336
Identify the field containing an invalid enum value in JSON-RPC requests and omit protobuf enum type names from the error. Fall back to reporting the value when the field cannot be identified.

Cover invalid values and supported JSON field conversions in parsing tests.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Provide a non-null request to client interceptors and reject null payloads at construction. For REST extended agent card calls, expose the tenant to interceptors and use the returned tenant when building the request URL.

Add tests for tenant interception and null payload validation.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
…-api from 2.0.1 to 2.2 (a2aproject#1341)

chore: bump org.eclipse.microprofile.telemetry:microprofile-telemetry-api

Bumps [org.eclipse.microprofile.telemetry:microprofile-telemetry-api](https://github.com/eclipse/microprofile-telemetry) from 2.0.1 to 2.2.
- [Release notes](https://github.com/eclipse/microprofile-telemetry/releases)
- [Commits](microprofile/microprofile-telemetry@2.0.1...2.2)

---
updated-dependencies:
- dependency-name: org.eclipse.microprofile.telemetry:microprofile-telemetry-api
  dependency-version: '2.2'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Ignore unrecognized fields in requests, responses, and streaming events for
forward compatibility with protocol extensions. Remove unknown fields using
protobuf descriptors before strict parsing so invalid values for known fields,
including enum values, are still rejected.

Preserve REST streaming error mapping when an error event has no response
payload. Add coverage for nested fields, invalid values, and error events.
…oject#1363)

Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.6.6 to 1.6.8.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](qos-ch/logback@v_1.6.6...v_1.6.8)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…project#1362)

Bumps org.mock-server:mockserver-netty from 9.2.0 to 9.4.0.

---
updated-dependencies:
- dependency-name: org.mock-server:mockserver-netty
  dependency-version: 9.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…3.0 (a2aproject#1360)

Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.52.0 to 2.53.0.
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.52.0...v2.53.0)

---
updated-dependencies:
- dependency-name: com.google.errorprone:error_prone_core
  dependency-version: 2.53.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ect#1359)

Bumps [com.uber.nullaway:nullaway](https://github.com/uber/NullAway) from 0.14.3 to 0.14.4.
- [Release notes](https://github.com/uber/NullAway/releases)
- [Changelog](https://github.com/uber/NullAway/blob/master/CHANGELOG.md)
- [Commits](uber/NullAway@v0.14.3...v0.14.4)

---
updated-dependencies:
- dependency-name: com.uber.nullaway:nullaway
  dependency-version: 0.14.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@77dd5b2...d1374f8)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
dependabot Bot and others added 13 commits November 24, 2026 16:01
…2aproject#1361)

Bumps [org.codehaus.mojo:exec-maven-plugin](https://github.com/mojohaus/exec-maven-plugin) from 3.6.4 to 3.7.0.
- [Release notes](https://github.com/mojohaus/exec-maven-plugin/releases)
- [Commits](mojohaus/exec-maven-plugin@3.6.4...3.7.0)

---
updated-dependencies:
- dependency-name: org.codehaus.mojo:exec-maven-plugin
  dependency-version: 3.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
….79.0 (a2aproject#1358)

chore: bump no.entur.mapstruct.spi:protobuf-spi-impl

Bumps [no.entur.mapstruct.spi:protobuf-spi-impl](https://github.com/entur/mapstruct-spi-protobuf) from 1.78.0 to 1.79.0.
- [Commits](entur/mapstruct-spi-protobuf@release-1.78.0...release-1.79.0)

---
updated-dependencies:
- dependency-name: no.entur.mapstruct.spi:protobuf-spi-impl
  dependency-version: 1.79.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ject#1353)

When the agent opens a task with a status or artifact update (e.g.
AgentEmitter.startWork()), onMessageSendStream relayed that update as
the first stream item, so the client received an update of a task it
was never sent. A2A spec 3.1.2 requires: "If the agent returns a Task,
the stream MUST begin with the Task object."

Emit the task's Task (for a new task, the Task the TaskStore creates
for it; for an existing task, the task as the request updated it)
before a first status or artifact update. A first Task or Message is
unchanged.

This fixes a2aproject#1352
…otification config (a2aproject#1319)

GrpcTransport resolves a default tenant once, in its constructor, and
applies it to every request it builds: sendMessage, getTask, cancelTask,
listTasks, subscribeToTask, getExtendedAgentCard, get/delete/list push
notification configs all go through resolveTenant(request.tenant()).

createTaskPushNotificationConfiguration was the one exception. It mapped
the domain config straight to proto, so the tenant was only set when the
caller had passed one explicitly. GrpcTransportProvider always seeds the
transport with agentInterface.tenant(), which means a client built from a
tenant-scoped interface sent that tenant with every call except this one.
The proto carries tenant as field 1, so the request arrived with an empty
tenant and the config was created against the server's default tenant
instead of the requested one - a multi-tenant server either rejects it as
task-not-found or stores it where notifications for that task never fire.

Route the payload through resolveTenant as well, so all ten operations
agree on which tenant the request belongs to.
…project#1314)

* fix(server): wait for in-flight events before reading the task in blocking sendMessage

A blocking SendMessage reads the task from the TaskStore once the
consumer stops, but only a final event keeps the consumer polling after
the handler closes its queue. When persisting the agent's last event
takes longer than the consumer's poll, an interrupted state
(INPUT_REQUIRED, AUTH_REQUIRED) or a trailing artifact was still in
flight and the call returned the previous state.

After consumption completes and the agent has returned, wait (bounded by
the consumption timeout) until the MainQueue has no events left in the
event bus. MainQueue now wakes waiters when MainEventBusProcessor
releases a permit.

Fixes a2aproject#1302

Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>

* fix(server): skip the drain wait when the agent is still running

Follow-up to a2aproject#1315 on top of current main.

- EventQueue#awaitDrained is no longer abstract. The default returns true, so
  custom EventQueue subclasses written before a2aproject#1315 keep compiling and do not
  make the blocking path wait.
- MainQueue wakes awaitDrained when a permit is released instead of polling
  every millisecond. The permit released on a failed enqueue goes through
  releaseSemaphore() too, so it also wakes waiters.
- The blocking SendMessage path only waits for the drain when the agent
  finished within agentCompletionTimeoutSeconds. A still-running agent can keep
  enqueueing, and its later events are not part of the returned task anyway.

Tests cover a trailing artifact whose persistence is slow, the skipped drain
when the agent times out, and the default implementation.

This fixes a2aproject#1302

Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>

---------

Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
…alized task (a2aproject#1316)

fix(jpa): keep the original finalization instant on re-save

JpaTask.setFinalizedAt() is documented as idempotent - "it only sets the
timestamp on the first transition to a final state" - and the instance
path (setTask) does honor that guard. JpaDatabaseTaskStore.save() does not
use it: it builds a fresh detached entity through JpaTask.createFromTask(),
whose finalizedAt starts null, so updateFinalizedTimestamp() stamps
Instant.now() and em.merge() writes it over the stored value.

finalized_at is the only input to the replication grace period read by
isTaskActive(). Re-persisting an already finalized task - an at-least-once
replicated replay, an idempotent retry, a late status message - therefore
restarts the window on every write, and the guard in
ReplicatedQueueManager.onReplicatedEvent never closes: late replicated
events keep rebuilding queues for a task that ended long ago.

save() now reads the persisted finalized_at for the task ID (only that
column, not the task JSON) and hands it to a new createFromTask overload.
The existing setFinalizedAt guard keeps it, and a first finalization still
records now.
…aproject#1356)

* fix(jsonrpc): don't open a stream when streaming is not supported

When the agent card does not support streaming, SendStreamingMessage
and SubscribeToTask over JSON-RPC answered HTTP 200 with an SSE stream
whose only event was the UnsupportedOperationError. RestHandler already
returns that error as a plain response, and as discussed in a2aproject#791, a
StreamResponse cannot carry an error, so an error known before any event
exists is returned without opening a stream.

JSONRPCHandler now throws the preflight UnsupportedOperationError, and
A2AServerRoutes lets an error thrown by the handler propagate, so it is
written as an ordinary JSON-RPC error response that keeps the request
id. Other preflight errors are still sent inside the stream, as in
RestHandler.

* fix(jsonrpc): stream unexpected preflight errors in SubscribeToTask

onMessageSendStream reports an unexpected exception from preflight as
an InternalError inside the stream, and RestHandler does the same for
both streaming methods. onSubscribeToTask only caught A2AError there,
so such an exception escaped the handler and the route answered with a
plain InternalError without the request id. Catch Throwable there too.
* fix: cancel in-flight HTTP futures on REST transport close

Track active REST streaming futures in both protocol implementations,
remove completed futures, and cancel pending futures when closing.
Cover completion, shutdown races, idempotence, and JDK socket release.

This fixes a2aproject#1194

* fix: complete REST streams before cancellation

Signal normal terminal completion before cancelling HTTP streams in both
REST protocol implementations. Close every stream when a terminal handler
throws, and aggregate failures without self-suppression.

Add regressions for cancellation errors, throwing handlers, and setup races.

This fixes a2aproject#1194
Bumps the quarkus group with 2 updates: [io.quarkus:quarkus-bom](https://github.com/quarkusio/quarkus) and io.quarkus:quarkus-maven-plugin.


Updates `io.quarkus:quarkus-bom` from 3.40.1.1 to 3.40.1.2
- [Release notes](https://github.com/quarkusio/quarkus/releases)
- [Commits](quarkusio/quarkus@3.40.1.1...3.40.1.2)

Updates `io.quarkus:quarkus-maven-plugin` from 3.40.1.1 to 3.40.1.2

Updates `io.quarkus:quarkus-maven-plugin` from 3.40.1.1 to 3.40.1.2

---
updated-dependencies:
- dependency-name: io.quarkus:quarkus-bom
  dependency-version: 3.40.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-maven-plugin
  dependency-version: 3.40.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: quarkus
- dependency-name: io.quarkus:quarkus-maven-plugin
  dependency-version: 3.40.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: quarkus
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Emmanuel Hugonnet <ehsavoie@users.noreply.github.com>
* fix: honor interceptor payload in REST request URLs

* fix: honor interceptor payload in gRPC transport

* fix: honor interceptor URL fields in v0.3 REST

* fix: reject null intercepted REST payloads

* fix: align v0.3 interceptor payloads with shared validation

Signed-off-by: andy <linux2011@qq.com>

---------

Signed-off-by: andy <linux2011@qq.com>
* fix(jsonrpc): cancel in-flight streams on close

JSONRPCTransport.close() and JSONRPCTransport_v0_3.close() were
no-ops. Client.close() and Client_v0_3.close() therefore left their
active SSE streams open.

Both transports now track their active streams and close them in
close(). AbstractSSEEventListener and SSEEventListener_v0_3 each get
a new closeStream() method. closeStream() calls signalTerminal(null)
before it cancels the stream's future. The auto-close paths now call
closeStream() too.

When closeStream() cancels the future, JdkA2AHttpClient releases the
connection. For VertxA2AHttpClient or AndroidA2AHttpClient,
cancel(true) does not release the connection.

After cancel(true), JdkA2AHttpClient can pass
IOException("Request cancelled") to the error handler.
signalTerminal() accepts only the first terminal signal. Because
closeStream() calls signalTerminal(null) first, signalTerminal()
drops the later IOException.

HelloWorldClient now closes its Client with try-with-resources.
streamingErrorHandler now returns when error is null, because null
means normal completion.

This fixes a2aproject#1354

* fix(jsonrpc): return early from trackStream() for a null future

When A2AHttpClient.PostBuilder.postAsyncSSE() returns null,
sendMessageStreaming() and subscribeToTask() throw a
NullPointerException from trackStream(). JSONRPCTransport_v0_3
already returns early in that case.

Return early in JSONRPCTransport.trackStream() as well.

This fixes a2aproject#1354
@Linux2010

Copy link
Copy Markdown
Contributor Author

Rebased onto current main. The implementation from the original version of this PR (stamping historyLength including 0 and tenant on the GetTaskRequest, and including historyLength=0 in the URL) was landed independently in #1333. This branch now keeps only the two regression tests (getTaskIncludesZeroHistoryLength / getTaskOmitsUnsetHistoryLength), adapted to the post-interceptor effective payload introduced by #1333. ./docs/mvnw -pl client/transport/rest -am -DskipDockerTests=true clean test passes locally (70 tests in the REST module).

This branch has not been deployed

No deployments
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.