fix(server): use keyset cursors for ListTasks page tokens - #1282
Merged
mykytanetipa merged 3 commits intoSep 30, 2026
Merged
Conversation
A ListTasks page token was the ID of the first task of the next page, and each store looked that task up again to decide where to resume. If the task was updated between requests, the listing restarted and returned duplicates; if it was deleted, the request failed with InvalidParamsError. The token now carries the sort position (timestamp, id) of the last task returned, and the next page starts strictly after it, so changes to that task no longer affect pagination. The database store no longer needs an extra query to resolve the token. Tokens issued by earlier versions are still accepted and resolved the old way. Fixes a2aproject#1280
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/tasks/database_task_store.py | 92.45% | 92.47% | 🟢 +0.02% |
| src/a2a/utils/task.py | 95.16% | 96.55% | 🟢 +1.39% |
| Total | 92.92% | 92.94% | 🟢 +0.02% |
Generated by coverage-comment.yml
Drop the version field and the length cap from cursor tokens: a cursor is
recognized by its exact {ts, id} shape, and the cap could reject tokens
issued for long task IDs. Convert last_updated with protobuf Timestamp
instead of hand-rolled epoch arithmetic.
mykytanetipa
marked this pull request as ready for review
September 30, 2026 10:16
mykytanetipa
pushed a commit
that referenced
this pull request
Sep 30, 2026
🤖 I have created a release *beep* *boop* --- ## [1.2.1](v1.2.0...v1.2.1) (2026-09-30) ### Bug Fixes * **server:** use keyset cursors for ListTasks page tokens ([#1282](#1282)) ([b7cba7c](b7cba7c)), closes [#1280](#1280) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A ListTasks page token was the ID of the first task of the next page, and each store looked that task up again to decide where to resume. If the task was updated between requests, the listing restarted and returned duplicates; if it was deleted, the request failed with InvalidParamsError.
The token now carries the sort position (timestamp, id) of the last task returned, and the next page starts strictly after it, so changes to that task no longer affect pagination. The database store no longer needs an extra query to resolve the token. Tokens issued by earlier versions are still accepted and resolved the old way.
Fixes #1280