fix(rest): include missing query params in listTasks and listTaskPushNotificationConfigs by sumitvairagar · Pull Request #1239 · a2aproject/a2a-java · GitHub
Skip to content

fix(rest): include missing query params in listTasks and listTaskPushNotificationConfigs - #1239

Open
sumitvairagar wants to merge 3 commits into
a2aproject:mainfrom
sumitvairagar:issue-1233
Open

sumitvairagar wants to merge 3 commits into
a2aproject:mainfrom
sumitvairagar:issue-1233

Conversation

@sumitvairagar

Copy link
Copy Markdown

What this fixes

Two query parameters were silently dropped by the REST transport client, making server-side features unreachable from Java.

Bug 1 — listTasks drops statusTimestampAfter

buildListTasksQueryString() handles every field in ListTasksParams except statusTimestampAfter. The field was added to the record after the query builder was written and was never included. Every call to GET /tasks from the Java client omitted the timestamp filter entirely, so the server always returned all tasks regardless of when they were last updated.

Bug 2 — listTaskPushNotificationConfigurations drops pageSize and pageToken

The URL was built as a plain string with no query parameters at all. The pageSize and pageToken fields on ListTaskPushNotificationConfigsParams were never appended, making pagination impossible for push notification configs.

What changed

  • Added statusTimestampAfter to buildListTasksQueryString(), formatted as ISO-8601 and URL-encoded (same pattern as existing string fields).
  • Extracted buildListPushNotificationConfigsQueryString() for the push notification configs method and updated listTaskPushNotificationConfigurations() to append the query string to the URL.
  • Added regression tests for both bugs. Each test configures MockServer to only respond when the expected query parameter is present, so the tests would have failed before this fix.

Fixes #1233

…NotificationConfigs

RestTransport.buildListTasksQueryString() iterated all fields of
ListTasksParams except statusTimestampAfter, which was silently
dropped from every GET /tasks request, making the server-side
timestamp filter unreachable from the Java client.

RestTransport.listTaskPushNotificationConfigurations() built its URL
as a plain string with no query parameters at all. The pageSize and
pageToken fields on ListTaskPushNotificationConfigsParams were ignored,
making pagination impossible.

Fix:
- Add statusTimestampAfter to buildListTasksQueryString(), formatted
  as ISO-8601 and URL-encoded (same pattern as existing string fields).
- Extract buildListPushNotificationConfigsQueryString() for the push
  notification configs method and append the query string to the URL.
- Add regression tests for both bugs using MockServer; each test
  asserts the query parameter is present in the outbound request.

This fixes a2aproject#1233

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is missing setting statusTimestampAfter

checkNotNullParam("request", request);
org.a2aproject.sdk.grpc.ListTaskPushNotificationConfigsRequest.Builder builder
= org.a2aproject.sdk.grpc.ListTaskPushNotificationConfigsRequest.newBuilder();
builder.setTaskId(request.id());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is missing setting pageSize and pageToken

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be URLEncoded

Three issues identified in review by @ehsavoie:

1. listTasks proto builder did not set statusTimestampAfter. Interceptors
   (auth, tracing) receive the builder before the REST URL is built, so
   missing fields there are invisible to the interceptor chain. Added the
   Timestamp conversion using getEpochSecond()/getNano().

2. listTaskPushNotificationConfigurations proto builder set only taskId.
   pageSize and pageToken were never set, making pagination invisible to
   interceptors. Added the two missing fields.

3. status enum value in buildListTasksQueryString was appended raw without
   URL-encoding. Applied URLEncoder.encode() for consistency with all other
   string parameters in the same method.

Added two regression tests using a capturing ClientCallInterceptor to assert
the proto builder carries the correct fields before the HTTP request is sent.

This fixes a2aproject#1233
@sumitvairagar

Copy link
Copy Markdown
Author

Thank you @ehsavoie — all three points addressed in the latest commit (e95a10a):

  1. listTasks proto builder missing statusTimestampAfter — added the Timestamp conversion using getEpochSecond()/getNano().
  2. listTaskPushNotificationConfigurations proto builder missing pageSize and pageToken — both fields now set when present.
  3. status not URL-encoded — wrapped in URLEncoder.encode() for consistency with the other string parameters.

Also added two regression tests using a capturing ClientCallInterceptor to verify the proto builder carries the correct fields before the HTTP request is sent. 35 tests passing.

…portTest

- Restore java.util.List<String>/java.util.ArrayList<> FQN style in
  buildListTasksQueryString and buildListPushNotificationConfigsQueryString
  to match the pre-existing pattern in the original file
- Replace org.a2aproject.sdk.spec.AgentCard FQN with short name in test
  interceptors (AgentCard is already imported)
- Fix AgentInterface import to correct alphabetical position in test file

This fixes a2aproject#1233
@sumitvairagar

Copy link
Copy Markdown
Author

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.

[Bug]: REST client drops task cutoff and push-config pagination parameters

2 participants