Skip to content

fix: preserve historyLength=0 and reject invalid REST listTasks pageSize - #685

Merged
bartek-gralewicz merged 2 commits into
a2aproject:mainfrom
anxkhn:fix/rest-list-tasks-zero-params
Sep 17, 2026
Merged

bartek-gralewicz merged 2 commits into
a2aproject:mainfrom
anxkhn:fix/rest-list-tasks-zero-params

Conversation

@anxkhn

@anxkhn anxkhn commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

  • Follow the CONTRIBUTING Guide
  • Conventional Commits title
  • Tests and linter pass
  • Docs updated if necessary

Fixes #679

Summary

RestTransportHandler.listTasks used truthy Number() on query strings. historyLength=0 became undefined, so listTasks returned full history instead of omitting it. getTask already keeps 0 via parseHistoryLength. The JS REST client sends historyLength=0, so a same-SDK call was wrong.

pageSize=abc became NaN. The range check pageSize < 1 || pageSize > 100 is false for NaN, so the store did slice(0, NaN) and returned an empty page with HTTP 200.

Closed unmerged PR #625 called out the REST Number() hole. Open PR #639 caps historyLength at 1000 and does not fix the 0 drop or NaN pageSize.

listTasks now reuses parseHistoryLength and adds parsePageSize (integer 1..100). DefaultRequestHandler.listTasks also rejects non-integer pageSize so JSON-RPC/gRPC cannot slip NaN through.

Testing

npx --no-install vitest run test/server/rest_transport_handler.spec.ts test/server/default_request_handler.spec.ts

130 passed.

@anxkhn
anxkhn requested a review from a team as a code owner August 27, 2026 21:10
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/server/transports/rest/rest_transport_handler.ts 98.69% 98.81% 🟢 +0.12%
Total 85.23% 85.25% 🟢 +0.02%

Generated by coverage-comment.yml

@bartek-gralewicz
bartek-gralewicz merged commit 32c1865 into a2aproject:main Sep 17, 2026
17 checks passed
bartek-gralewicz added a commit that referenced this pull request Sep 18, 2026
🤖 I have created a release *beep* *boop*
---


## [1.2.0](v1.1.0...v1.2.0)
(2026-09-18)


### Features

* **server:** Introduce SettleByTaskId method
([#692](#692))
([e856bda](e856bda))


### Bug Fixes

* accept GetExtendedAgentCard JSON-RPC calls with omitted params
([#687](#687))
([047d970](047d970))
* avoid mutating caller message configuration
([#725](#725))
([e3a6428](e3a6428))
* **client:** cache the extended Agent Card only after signature
verification ([#711](#711))
([55b601c](55b601c))
* guard terminal state transitions and make cancelTask atomic
([#636](#636))
([7b87c94](7b87c94))
* preserve call context for JSON-RPC tenant requests
([#708](#708))
([ae20aca](ae20aca))
* preserve HeadersInit in authenticating fetch
([#721](#721))
([f8c33fa](f8c33fa))
* preserve historyLength=0 and reject invalid REST listTasks pageSize
([#685](#685))
([32c1865](32c1865))
* reject empty task IDs with RequestMalformedError in getTask/cancelTask
([#629](#629))
([71aae97](71aae97))
* reject invalid ListTasks status filters with RequestMalformedError
([#631](#631))
([a881fae](a881fae))
* reject missing required extensions before mutating task history
([#690](#690))
([3b4ef3f](3b4ef3f))
* reject whitespace-only taskId on sendMessage
([#689](#689))
([85227a0](85227a0))
* return 404/-32001 for missing push notification configs
([#630](#630))
([34f06e3](34f06e3))
* scope ExecutionEventBusManager by tenant and owner to match TaskStore
([#707](#707))
([69d8899](69d8899))
* stamp the resolved taskId onto sendMessage push configs
([#688](#688))
([cfb19a8](cfb19a8))

---
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: Bartek Gralewicz <[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.

[Bug]: REST listTasks drops historyLength=0 and accepts NaN pageSize

2 participants