Skip to content

fix(pbconv): leave an unset ListTasks page size unset - #576

Merged
yarolegovich merged 2 commits into
a2aproject:mainfrom
ShivamSharma43:fix-pbconv-list-tasks-page-size
Nov 16, 2026
Merged

yarolegovich merged 2 commits into
a2aproject:mainfrom
ShivamSharma43:fix-pbconv-list-tasks-page-size

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Problem

A gRPC ListTasks call made without a page size fails against servers that check the page size. For example, the Python SDK answers it with InvalidParams: minimum page size is 1. JSON-RPC and REST calls aren't affected because they leave pageSize out when it is 0.

Cause

page_size is optional int32 in the v1 proto, and its doc says "If unspecified, at most 50 tasks will be returned. The minimum value is 1." ToProtoListTasksRequest always sets the field, so a2a.ListTasksRequest{} goes out with an explicit page_size: 0. The Python handler validates the field whenever it is present (if params.HasField('page_size'): validate_page_size(params.page_size)), and 0 is out of range there. The Go server doesn't notice the problem because its in-memory store treats 0 as the default.

Fix

ToProtoListTasksRequest sets page_size only when PageSize isn't 0. PageSize 0 already means "not set" in a2a.ListTasksRequest, and the JSON and REST clients treat it that way. FromProtoListTasksRequest already reads an absent field as 0, so the round trip is unchanged.

Test

New TestToProtoListTasksRequest: an unset page size stays unset (this fails on main with page_size:0), and a set page size is still sent.

go build ./..., go vet and go test ./a2apb/... ./a2agrpc/... ./e2e/... pass.

🤖 Generated with Claude Code

ToProtoListTasksRequest always set the optional page_size field, so a
request without a page size was sent over gRPC with an explicit
page_size of 0. The spec says the minimum value is 1, and servers which
validate a present page_size, such as the Python SDK, reject the request
as invalid params.

Set page_size only when PageSize is not zero.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 09:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@1AbdullahButt 1AbdullahButt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks correct. Here's what I checked.

  • ListTasksRequest is the only request with an optional page size. In a2apb/v1/a2av1.pb.go, ListTasksRequest.PageSize is *int32 (proto3,oneof, :2889). ListTasksResponse.PageSize and ListTaskPushNotificationConfigsRequest.PageSize are plain int32 (:3000, :3320), and an int32 of 0 isn't sent on the wire. So to_proto.go:563 (PageSize: int32(req.PageSize) for push configs) doesn't need the same change.
  • The reverse direction already treats unset as 0. from_proto.go:254 reads int(req.GetPageSize()), and GetPageSize() returns 0 for a nil pointer. So a Go server gets the same a2a.ListTasksRequest whether the field is unset or explicitly 0, and the round trip doesn't change for Go-to-Go calls.
  • JSON-RPC and REST already leave it out. a2a.ListTasksRequest.PageSize has json:"pageSize,omitempty" (a2a/core.go:896), and the REST server only sets it from the pageSize query parameter (a2asrv/rest.go:204). So this brings gRPC in line with the other two.
  • new(int32(...)) builds. go.mod is go 1.26.0, and the HistoryLength line right below already uses the same new(expr) form.
  • The test compares with proto.Equal, so it tells an unset field apart from one set to 0. A plain struct comparison wouldn't.

I didn't run the tests.

Reviewed with help from Claude Code.

@yarolegovich
yarolegovich enabled auto-merge (squash) November 16, 2026 09:28
@yarolegovich
yarolegovich merged commit 5a3d99d into a2aproject:main Nov 16, 2026
5 checks passed
ickeep pushed a commit to HuashiCloud/a2a-go that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


## [2.9.0](a2aproject/a2a-go@v2.8.0...v2.9.0)
(2026-11-17)


### Features

* **plugins:** extend clients and servers with `a2aclient.WithPlugins`
and `a2asrv.WithPlugins`. Client plugins wrap calls; server plugins wrap
calls, the agent executor, the task store and push delivery. The
`a2aplugin` package builds plugins from hooks
([a2aproject#572](a2aproject#572),
[a2aproject#581](a2aproject#581))
([5216340](a2aproject@5216340),
[b25d155](a2aproject@b25d155))
* **a2aclient/oauth:** OAuth 2.0 client support. `oauth.Manager`
discovers authorization servers from agent cards and Protected Resource
Metadata, signs users in (authorization code or device grant), and its
plugin attaches and refreshes tokens
([a2aproject#568](a2aproject#568),
[a2aproject#570](a2aproject#570))
([c42999a](a2aproject@c42999a),
[50dd177](a2aproject@50dd177))
* **a2aclient:** errors received from a server carry the response HTTP
headers or gRPC metadata in `a2a.Error.ServiceParams`
([a2aproject#595](a2aproject#595))
([d6a1d26](a2aproject@d6a1d26))
* **a2asrv:** pass the client's accepted output modes to agents in
`ExecutorContext.AcceptedOutputModes`
([a2aproject#603](a2aproject#603))
([57ee56c](a2aproject@57ee56c))


### Behavior Changes

* **a2asrv:** `SendMessage` and `SendStreamingMessage` return at most
`Config.HistoryLength` messages of task history
([a2aproject#603](a2aproject#603))
([57ee56c](a2aproject@57ee56c))
* **a2asrv:** `NewAgentCardEnforcer` rejects messages with a push config
when the card doesn't support push notifications
([a2aproject#603](a2aproject#603))
([57ee56c](a2aproject@57ee56c))
* **a2asrv:** a message reply gets the execution's contextId when the
agent doesn't set one, and its taskId is cleared
([a2aproject#577](a2aproject#577),
[a2aproject#609](a2aproject#609))
([eee75ec](a2aproject@eee75ec),
[97de334](a2aproject@97de334))
* **a2asrv:** getting a missing push config returns `TaskNotFound`
instead of an internal error, and a REST push config delete returns `{}`
([a2aproject#578](a2aproject#578),
[a2aproject#600](a2aproject#600))
([ff3fcf8](a2aproject@ff3fcf8),
[0d1ac2a](a2aproject@0d1ac2a))
* **a2aclient:** a JSON-RPC HTTP error without a JSON-RPC body is an
`*a2a.Error` (`ErrUnauthenticated` for 401, `ErrUnauthorized` for 403,
`ErrServerError` otherwise) instead of a plain error
([a2aproject#595](a2aproject#595))
([d6a1d26](a2aproject@d6a1d26))
* **a2aclient:** stream responses of an unknown type are skipped instead
of ending the stream with an error
([a2aproject#532](a2aproject#532))
([212512b](a2aproject@212512b))


### Bug Fixes

* **a2a:** accept pointer OAuth flow types when marshalling
([a2aproject#541](a2aproject#541))
([fe407e3](a2aproject@fe407e3))
* **a2aacp:** don't count exited agents in makeRoom
([a2aproject#563](a2aproject#563))
([6b0c5bd](a2aproject@6b0c5bd))
* **a2aacp:** drop empty parts instead of sending a block without
content ([a2aproject#594](a2aproject#594))
([d8323ce](a2aproject@d8323ce))
* **a2aacp:** fail turns of a stopped agent with `AgentStoppedError`
([a2aproject#573](a2aproject#573))
([4acb390](a2aproject@4acb390))
* **a2aacp:** release the context lock before reporting the end of a
turn, so `RejectBusyContext` accepts the next message
([a2aproject#601](a2aproject#601))
([964e814](a2aproject@964e814))
* **a2aacp:** reserve pool capacity during startup
([a2aproject#587](a2aproject#587))
([621d73b](a2aproject@621d73b))
* **a2av0:** keep unset ListTasks history length unset
([a2aproject#527](a2aproject#527))
([9b4435f](a2aproject@9b4435f))
* **pbconv:** leave an unset ListTasks page size unset
([a2aproject#576](a2aproject#576))
([5a3d99d](a2aproject@5a3d99d))
* **sse:** support carriage-return event line endings
([a2aproject#487](a2aproject#487))
([ecaea9c](a2aproject@ecaea9c))
* **taskexec:** don't end remote subscriptions at the caller's message
([a2aproject#575](a2aproject#575))
([d0710f5](a2aproject@d0710f5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Yaroslav Shevchuk <[email protected]>
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.

4 participants