Skip to content

fix(server)!: align ListTasks cursors and update ordering - #312

Merged
MisterVVP merged 5 commits into
mainfrom
fix/309-list-tasks-cursor-pagination
Oct 22, 2026
Merged

MisterVVP merged 5 commits into
mainfrom
fix/309-list-tasks-cursor-pagination

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #309. Targets v0.6.0; the released v0.5.2 pagination contract is unchanged.

ListTasks previously used numeric offsets and creation order, so later task mutations did not move tasks to the front and offsets could shift between requests. Both stores now order by storage update time descending, then task ID descending, and return opaque versioned cursor boundaries.

  • Address both review findings: round-trip embedded NUL bytes in cursor task IDs, and reject exhausted signed 64-bit update timestamps before changing task contents, revision or ordering. Add deterministic continuation and timestamp-boundary regressions.
  • Track every successful task mutation, including history, artifacts, cancellation and CAS updates. Use an ordered in-memory index and PostgreSQL seek queries with ordering indexes.
  • Apply authorization before counting and selecting pages, scan bounded batches, and re-authorize selected tasks before projection. Cursor validation does not look up boundary resources.
  • Add shared store and transport tests for timestamp ties, filters, malformed/end cursors, concurrent mutations and permission changes. Update client examples and document exact-count costs and weak consistency between requests.
  • Make the update-order unit test use a deterministic, strictly increasing storage clock so microsecond timestamp ties cannot make its ordering assertion flaky on macOS.
  • Keep SDK documentation in mdBook, including the cursor contract, PostgreSQL migration, security implications and unreleased v0.6.0 notes. Preserve root repository policies and v0.5.2 release metadata from main.

Compatibility: numeric offset tokens are rejected; clients must restart with an empty token and follow returned cursors. Custom stores used with secured listing must supply aligned task cursor metadata. PostgreSQL schema changes and migration guidance are documented in the mdBook cursor-pagination guide.

Authorship and AI usage

  • Contains substantive content written by a human
  • Contains substantive content generated by an AI agent

The implementation, tests and documentation were generated by an AI agent.

Testing

Validation includes the cursor-ID and timestamp-exhaustion fixes and test refactors on the branch merged with main at b58ebd8458bc87bd4ce20641954a17f1c07cdf11:

  • ./scripts/verify_changes.sh passed, including formatting, build, CTest and clang-tidy. All 777 configured checks completed with zero failures and two expected TLS skips; lint passed for all 132 translation units.
  • The three test files previously flagged by CI pass the full test lint profile using clang-tidy 18 and GoogleTest 1.14 system headers. Cursor continuation, ownership revocation, caller scope and token validation have smaller focused cases; no checks are suppressed.
  • Both test files updated for these review findings pass the full test lint profile using clang-tidy 18 and GoogleTest 1.14 system headers, including all new boundary cases.
  • Shared store and binding tests passed for in-memory and PostgreSQL stores across gRPC, JSON-RPC and HTTP+JSON.
  • The update-order test that failed on macOS passes 1,000 consecutive local runs with the injected clock; the updated unit test file passes the full clang-tidy 18 test profile.
  • Performance smoke completed with 54 result rows and zero errors.
  • mdbook build book passed; 51 rendered HTML pages and 1,474 local page/anchor references checked successfully. The new cursor chapter is in the book navigation; the deleted root documentation folder is not recreated.
  • Unmodified upstream TCK (5daf0144b4a4adbdefb62180739b13c5bd7d8196) completed across all three transports for each backend: 249 passed, 16 conditional skips, with no assertion failures.

TCK coverage exception: upstream reports 80.9% mandatory coverage and 80.0% overall coverage, reflecting registry requirements without executable fixtures. This does not meet the 100% mandatory gate in AGENTS.md. The maintainer explicitly approved publication with this documented gap; the TCK and its report were not modified to increase coverage.

Checklist

  • ./scripts/verify_changes.sh passed locally
  • Docs updated if behavior changed

Order both task stores by storage update time and task ID, paginate with opaque versioned boundaries, and keep caller authorization ahead of counting and page selection. Add PostgreSQL ordering indexes, cross-binding/store tests, and cursor compatibility documentation.

Refs #309.

BREAKING CHANGE: ListTasks numeric offset tokens are rejected; restart pagination with an empty token and follow returned cursors. Custom secured stores must return task cursor boundaries.

Authorship: generated by an AI agent.
@MisterVVP MisterVVP added the AI agent AI agent contribution label Oct 21, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP added the bug Something isn't working label Oct 21, 2026
@MisterVVP MisterVVP self-assigned this Oct 21, 2026
@MisterVVP

Copy link
Copy Markdown
Owner Author

Moving this into v0.6.0. Postponed until v0.5.2 is released.

MisterVVP added a commit that referenced this pull request Oct 21, 2026
## Summary

Prepare **v0.5.2** from `main` at
`6a2a0fa0e204b9e0da633bda55b5b3a2fee12fd3`, following #250's
release-preparation pattern. Consolidate public SDK documentation into
mdBook so users have one maintained guide instead of duplicated pages
and internal planning records.

- Bump CMake, Doxygen, package manifests, the overlay source pin and
consumer examples to `0.5.2` / `v0.5.2`. Preserve historical release
notes.
- Consolidate complete storage/schema migration, streaming lifetime,
authentication/security, protocol-version, interoperability,
example/tutorial, performance and SDK validation guides under `book/`,
with every chapter in its navigation.
- Preserve `CONTRIBUTING.md`, `SECURITY.md`, `SUPPORT.md`,
`cpp_conventions.md` and `LICENSE` unchanged from `main`, with their
full repository-wide rules authoritative at the root. Retain the full
root `AGENTS.md` with a small documentation-location rule: prohibit the
root `docs/` folder, maintain SDK guides in mdBook under `book/`, and
keep repository policies in their related repository files. Remove the
mdBook copies of these policies. Retain the substantive root README
overview and correct its SDK guide links; source-folder READMEs point to
the book. Preserve tutorial knowledge-base Markdown as runtime input.
Remove the legacy duplicate SDK documentation tree and obsolete workflow
path filters.
- Move **44 internal planning/engineering records** to
[ai-db/repositories/a2a-cpp](https://github.com/MisterVVP/ai-db/tree/main/repositories/a2a-cpp),
with historical-status banners, corrected links, source provenance and
content hashes. The archive was published and verified before the SDK
branch was amended.
- Retain the test-only guard for an optional gRPC metadata constant when
the test helper is unavailable.

## Public release and deployment guides

- [Release and compatibility
notes](https://mistervvp.github.io/a2a-cpp/releases.html)
- [Security integration and signed Agent
Cards](https://mistervvp.github.io/a2a-cpp/auth/security.html)
- [Storage and PostgreSQL schema
migration](https://mistervvp.github.io/a2a-cpp/server/storage.html)
- [Protocol
versions](https://mistervvp.github.io/a2a-cpp/compatibility/protocol-versions.html)
and [conformance
evidence](https://mistervvp.github.io/a2a-cpp/compatibility/conformance.html)
- [Examples and
tutorials](https://mistervvp.github.io/a2a-cpp/examples/overview.html)
- [Performance
testing](https://mistervvp.github.io/a2a-cpp/performance/workloads.html)

These chapters publish through the existing Pages workflow after merge.
Raw clients must send A2A version `1.0`; configured security policies
enforce access before responses; downstream binaries should be rebuilt.
Numeric ListTasks tokens and creation ordering remain in v0.5.2. **PR
#312's cursor/order changes are reserved for v0.6.0**; the broader JSON
parsing migration is tracked in #311.

After merge and required CI checks, tag the merged release commit as
`v0.5.2`. v0.6.0 development follows.

## Authorship and AI usage

- [ ] Contains substantive content written by a human
- [x] Contains substantive content generated by an AI agent

Release metadata, documentation consolidation, archival metadata and the
test portability guard were generated by an AI agent.

## Testing

- Canonical PostgreSQL-enabled Debug verification passed again: **754
configured CTest checks, zero failures**, two expected in-process TLS
skips, full clang-tidy and formatting. Exact
`./scripts/run_clang_tidy.sh build` and the CI format command passed for
**132 translation units**. Signing was disabled locally; the merged
runtime baseline has passing signing-enabled CI.
- `mdbook build book` passed. Rendered chapter-link/anchor checks cover
**50 HTML pages and 1,439 local references**; all source chapters appear
in `SUMMARY.md`. A further 47 root/repository/website link targets
passed checks, and restored root policy files match `main` byte for byte
except for the requested documentation-location clarification in
`AGENTS.md`. The existing Doxygen job generates the C++ API landing
page.
- Private archive: **44 records**, 57 relative links, source/content
hashes and the published Git tree verified. Every former guide was
classified; tutorial runtime data and native source/header inputs are
unchanged from the already verified release commit.
- Performance smoke passed: **54 result rows, zero errors**. Workflow
YAML parsed successfully; existing job definitions are unchanged.
Package dependency requirements and baselines remain unchanged; the
supported Go-manifest vulnerability scan reported zero findings.
- Unmodified upstream TCK evidence for the same SDK implementation: all
three transports with both backends, **249 passed / 16 conditional skips
per store**, zero assertion failures. Reports retain **80.9% mandatory /
80.0% overall** coverage; registered requirements without executable
fixtures remain `NOT TESTED`. The maintainer-approved exception to the
100% gate in root `AGENTS.md` remains documented.

- Latest completed CI on the previous release head (`b9cad34`): the
dedicated ThreadSanitizer job passed all 160 tests, but the regular
macOS job failed
`SharedHttpClientTest.ReactorPoolDefersReleaseFromItsOwnThread`. The
existing helper races cancellation callback execution against dropping
its reactor reference; the same assertion was reproduced locally without
TSan. This documentation correction does not change that test or runtime
code. Fresh CI for the amended commit remains required before release.

## Checklist

- [x] `./scripts/verify_changes.sh` passed locally
- [x] Public guidance consolidated and links checked
- [x] Internal records preserved in the private knowledge base
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T16:33:27.346926Z 7df9712 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5c259d63b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/tasks/list_tasks.cpp Resolved
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex pls review this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 7df971242f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@MisterVVP
MisterVVP merged commit bed242d into main Oct 22, 2026
22 checks passed
@MisterVVP
MisterVVP deleted the fix/309-list-tasks-cursor-pagination branch October 22, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Align ListTasks cursor pagination and update-time ordering with A2A

1 participant