Skip to content

fix: accept ListTasks responses with fewer tasks than pageSize - #1273

Merged
kabir merged 1 commit into
a2aproject:mainfrom
RaphaelFakhri:fix/list-tasks-page-size
Nov 3, 2026
Merged

kabir merged 1 commit into
a2aproject:mainfrom
RaphaelFakhri:fix/list-tasks-page-size

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Description

ListTasksResult throws when the response pageSize differs from the number of tasks in tasks. The client transports build a ListTasksResult from every ListTasks response, so Client.listTasks(...) fails with InvalidParamsError on any page that is not full.

The A2A specification allows this case. The request pageSize is the maximum number of tasks to return, and the service may return fewer. The response pageSize is "the page size used for this response". The List Tasks examples in the specification return "pageSize": 10 with a single task, and the SDK rejects them.

This change:

  • Removes the pageSize == tasks.size() check from the ListTasksResult compact constructor. The non-negative checks stay.
  • Updates the pageSize Javadoc to match the specification.
  • Adds JSONRPCUtilsTest.testListTasksResponse_PageSizeLargerThanReturnedTasks, which parses a ListTasks JSON-RPC response with pageSize 10 and one task.

Server behavior does not change. The server-side task stores still set pageSize to the number of tasks they return.

Fixes #1260

The A2A specification defines the response pageSize as the page size
used for the response, and a server may return fewer tasks than that.
ListTasksResult rejected any response where pageSize differed from the
number of tasks, so clients failed with InvalidParamsError on every
partial page.

Fixes a2aproject#1260
@kabir
kabir merged commit 9c5cf41 into a2aproject:main Nov 3, 2026
14 checks passed
@kabir

kabir commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Thank you @RaphaelFakhri !

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]: ListTasksResult rejects valid responses when pageSize ≠ number of returned tasks (InvalidParamsError)

2 participants