Repository navigation
feat(server): complete opt-in async unary execution and cancellation - #318
Conversation
## Summary Introduce a transport-independent request lifecycle for pending asynchronous server operations, so applications can retain request metadata and distinguish client cancellation, deadline expiry, shutdown, success and application failure. The complete request execution module uses `a2a::server::engine`: public API at `include/a2a/server/engine/request_execution.h`, with implementation and state in `src/server/engine/`. Implements **PR 1 of #268**. This PR leaves #268 open and keeps executor, dispatcher, transport, streaming and outbound-client integration for their planned follow-ups. - Add a non-copyable `RequestExecution` owner and copyable `RequestExecutionContext` with an immutable snapshot of the existing `RequestContext`, monotonic deadline and C++20 cancellation token. - Choose exactly one terminal outcome atomically. Completion checks deadline expiry; cancellation observers run inline without an SDK mutex and retain safe state during reentrancy/owner destruction. Pending owner destruction signals shutdown. - Require the caller's scheduler to drive deadline notification. The API starts no timer or worker thread and leaves synchronous APIs unchanged. - Add 15 deterministic lifecycle tests covering metadata lifetime, pre-cancellation, late/removed observers, in-progress observer destruction, completion/cancellation races, deadline boundaries, shutdown and releasing the final owner from an observer. Include this optional target in the TSAN runner when available. - Probe C++20 cancellation support and export `A2A_HAS_REQUEST_EXECUTION`; omit the new implementation/tests on older standard libraries while preserving synchronous builds. Document availability, ownership, precedence, scheduling and observer lifetime guarantees in the server book. ## Authorship and AI usage - [ ] Contains substantive content written by a human - [x] Contains substantive content generated by an AI agent ## Testing Current-head validation: the engine target builds, all 15 lifecycle tests pass, and formatting, targeted clang-tidy, and `mdbook build book` pass. The full SDK, TCK, sanitizer, and performance suites were not repeated for this final namespace/file relocation. Earlier full Linux validation, before the final namespace/file relocation: - Clean Debug SDK build and CTest: zero failures across 790 cases (two TLS fixture skips). - 15 lifecycle tests pass with ThreadSanitizer and AddressSanitizer/UndefinedBehaviorSanitizer (`detect_leaks=0`; LeakSanitizer is restricted in this environment). - Repository formatting checks and `mdbook build book` pass. - Native cancellation capability probe passes; the forced-unavailable CMake graph excludes the new source/test and exports `A2A_HAS_REQUEST_EXECUTION=0`. TSAN target selection and shell syntax are verified in both configurations. - Unmodified upstream TCK `d4d6fae7887f88ef607fb461c13e3b0e1802f19b` passes across gRPC, JSON-RPC and HTTP+JSON on both in-memory and PostgreSQL stores: 249 passed, 16 conditional skips per store. MUST registry coverage remains **80.9%**, matching the documented release baseline in `book/src/compatibility/conformance.md`; 21 MUST requirements have no upstream executable fixtures. This is not a claim of 100% TCK compliance. - Python validation-tool dependency audit reports no known vulnerabilities. The native OSV scan was attempted but its API endpoint is denied by the environment network policy; SDK dependency manifests are unchanged. - Performance smoke: gRPC/HTTP+JSON, in-memory store, two requests at concurrency one, no warmup/duration; 54 result rows and zero errors (Debug SDK build). - `./scripts/run_clang_tidy.sh build` and `A2A_VERIFY_POSTGRES=1 A2A_VERIFY_BUILD_DIR=build ./scripts/verify_changes.sh` both exit 0. The exact CI `clang-format --dry-run --Werror` mechanism also passes (Clang 19). Local lifecycle benchmark (GCC 15, `-O2`, median of 5 samples of 100,000 operations): metadata snapshot 72.7 ns/op; snapshot plus lifecycle/context/completion 159.1 ns/op. These measurements describe the new opt-in primitive, not network I/O or end-to-end async execution. ## Checklist - [x] `./scripts/verify_changes.sh` passed locally before the final namespace/file relocation; scoped checks passed for the latest change - [x] Docs updated if behavior changed
## Summary Implements **Phase 2 / PR 2 of #268** against `feat/async-server`. Applications can initiate unary work and return immediately, then complete it from any thread through the new opt-in `a2a::server::engine::AsyncAgentExecutor` and `AsyncDispatcher`. - Supports SendMessage, GetTask, ListTasks, CancelTask, push-config create/get/list/delete, and extended agent cards through the existing provider. - Extracts one shared typed operation router and pipeline for sync/async payload checks, security, interceptor ordering, agent-card retrieval, and history projection. Required extensions use the existing validator. Public synchronous APIs remain source-compatible; each dispatch snapshots its interceptor list. - Uses a fixed worker pool and bounded in-flight admission. Pending application work holds no SDK worker. Executor initiation, hooks, policies/providers, and transport completion run on workers. The existing inline, non-blocking stop-observer contract is retained. - Delivers one terminal completion and one reverse-order AfterDispatch pass, including errors/cancellation. Completion receives an owned lifecycle context, so it is safe even before Dispatch returns its cancellation handle. Deadlines remain transport-driven, with start/completion checks. - Handles shutdown, late/duplicate replies, executor release, and dispatcher destruction from completion/cancellation observers. The existing security/store and agent-card provider facilities run on bounded workers; they retain their synchronous contracts. Adds API/threading documentation and immediate-result microbenchmarks. Native transport registration remains PR 3; #268 stays open. ## Authorship and AI usage - [ ] Contains substantive content written by a human - [x] Contains substantive content generated by an AI agent ## Testing - `A2A_VERIFY_POSTGRES=1 A2A_VERIFY_BUILD_DIR=build ./scripts/verify_changes.sh` — passed; **839 tests**. - Exact `./scripts/run_clang_tidy.sh build` and CI `clang-format --dry-run --Werror` mechanism — passed. New benchmark also passed targeted clang-tidy. - **49 fake-transport/component tests**, covering every operation, errors, metadata, security/history, extensions, admission, lifecycle races, and shutdown; 50 consecutive runs passed before the final test-guard cleanup. - TCK via `run_tck_sut.sh` / `run_tck_mandatory.sh` / `stop_tck_sut.sh`, with grpc/jsonrpc/http_json: **249 passed, 16 conditional skips on each of PostgreSQL and in-memory stores**. - `mdbook build book` — passed. - Required performance smoke: **54 rows, 0 errors**. - Python dependency audit — no known vulnerabilities. Native OSV scanning was attempted but this environment blocks `api.osv.dev`; SDK dependency versions are unchanged. The TCK retains the **previously approved baseline from PR #315**: **80.9% MUST / 80.0% overall coverage**, with 21 registered MUST requirements lacking upstream tests. All executable tests passed; this is not a claim of 100% specification compliance. Upstream TCK revision: `d4d6fae7887f88ef607fb461c13e3b0e1802f19b`. ## Performance evidence RelWithDebInfo, GCC 15, identical immediate in-memory GetTask response, one outstanding request, no interceptors/security; five repetitions with a 0.2 s minimum. The base comparison links the original dispatcher from `44d927b` with the same fixture and dependencies. | Path | Median wall time | | --- | ---: | | Original synchronous dispatcher | 0.408 µs | | Shared synchronous pipeline | 0.631 µs | | Async dispatcher, one SDK worker | 19.690 µs | The shared sync path adds approximately **0.22 µs (+55%)** in this microbenchmark, recorded explicitly for review. Async timing includes admission, lifecycle, queue scheduling and the benchmark's future-based reply handoff. These measurements cover immediate-result overhead; broader concurrency/latency evidence remains PR 4. The fake transport tests independently prove 32 pending operations can initiate on at most two SDK workers. ## Checklist - [x] `./scripts/verify_changes.sh` passed locally - [x] Docs updated if behavior changed
…#317) ## Summary Completes the remaining PR 3 and PR 4 scope of #268 in one PR, targeting `feat/async-server`, as requested. Adds opt-in `AsyncGrpcServerTransport` for all nine unary RPCs. It connects the existing async engine to native gRPC callbacks, copies metadata/auth, propagates deadlines and cancellation, and queues application execution, stop observers, interceptors, and response finalization on the bounded SDK worker pool. Shared helpers preserve synchronous validation, status/ErrorInfo mapping, extension trailers, and ListTasks conversion. Adds explicit service shutdown, native lifecycle/concurrency tests, an installed-package consumer example, a platform availability guide, async unary TCK profiles for both stores, and reproducible sync/async thread and latency evidence. Existing synchronous registration remains available. Streaming, HTTP scheduling, outbound clients, and async database I/O remain outside #268. Older gRPC releases receive the exported stable-callback API opt-in. Installed-package dependency discovery resolves gRPC before a Protobuf fallback, avoiding partial target exports. Request envelopes initialize the operation directly before payload conversion, and the server-deadline test disables the competing client timer. The test and measurement clients use one explicitly polled completion queue per fixture, keeping client thread counts fixed across both service paths and supporting legacy Windows gRPC. Installed-consumer validation generates only the SDK configuration installed for the test. Windows scratch cleanup is best-effort when build tools retain directory handles; installation, build, and smoke-test errors still propagate. Lifecycle assertions are grouped into focused helpers so Ubuntu's GTest 1.14 macro expansions remain within the lint complexity limit. ## Evidence With two SDK workers and controller-held pending replies, 32/128 concurrent async requests used two application threads in both cases; the equivalent synchronous path used 32/128. Representative loopback p50/p95 values, configurations, limitations, and reproduction commands are in the new guide. The TCK adapter executes the existing synchronous fixture on bounded workers and is explicitly documented as a compatibility fixture. ## Testing - Canonical `A2A_VERIFY_POSTGRES=1 A2A_VERIFY_BUILD_DIR=build ./scripts/verify_changes.sh`: 880 tests passed. - Repository formatter, exact CI dry-run formatting, and `./scripts/run_clang_tidy.sh build`: passed; lint uses a local cache keyed by translation-unit dependencies and tool/configuration inputs. - ASan/UBSan: 84 native/async-engine tests passed. ThreadSanitizer: 65 lifecycle/async-engine tests passed. - Native deadline-versus-completion boundary race: application replies scheduled before, at, and after the server deadline; verifies exactly-once completion/AfterDispatch and ignores duplicate replies after gRPC teardown and SDK destruction. Passed 30 repetitions (90 RPCs), plus 10 repetitions under ASan/UBSan. - Native cancellation/deadline/admission race cases: 30 repetitions passed; the isolated server-deadline case also passed 50 consecutive runs. - Clang-tidy 18 with GTest 1.14 system headers passed for the dispatcher tests and native client fixture; the original complexity diagnostics were reproduced before the fix. Isolated Protobuf dependency-order and multi-config installed-consumer checks reproduce the old failures and pass with the fixes. - Installed SDK consumer and native example smoke passed; unsupported-library fallback returns CTest skip code 77. - Official TCK start/run/stop flow: synchronous in-memory and PostgreSQL each 249 passed / 16 skipped; native async gRPC each 68 passed / 197 skipped due to transport/capability selection. - Performance smoke: 54 cases, zero errors. mdBook build and Python/workflow syntax checks passed. - `pip-audit`: no known vulnerabilities. Native OSV scan attempted but blocked by the environment's HTTP 403 policy for `api.osv.dev`; no dependency versions changed. The previously authorized TCK baseline exception is retained: the upstream registry reports 80.9% MUST coverage (80.0% overall) because 21 MUST requirements have no upstream tests. All executable tests passed; this is not a claim of complete registered-requirement coverage. Local Linux GCC validation and all required CI checks, including Windows, macOS, sanitizers, conformance, performance, and CodeQL, passed on `768fde3`. ## Authorship and AI usage - [ ] Contains substantive content written by a human - [x] Contains substantive content generated by an AI agent ## Checklist - [x] `./scripts/verify_changes.sh` passed locally - [x] Docs updated if behavior changed @MisterVVP ready for your review.
|
@codex review Please perform the final review of the complete #268 implementation against |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
left a comment
There was a problem hiding this comment.
Ideally we want a single TCK with async i/o rather that having per transport TCK for async i/o. Can we refactor our approach so we build one TCK and tests for async i/o with only gRPC enabled within this PR? So this way we can expand on it.
Pls answer PR comments and explain reasoning. Also avoid writing unnecessary inline code comments
|
@codex review Please review b8a1b69 against release/v0.6.0, including the maintainer's architectural feedback. The synchronous three-transport TCK remains intact; tck_async_sut is one shared async setup with only gRPC enabled initially. Both setups share application fixtures and policies, register SDK services directly, and avoid nested synchronous dispatch. The async fixture uses bounded backend work for existing synchronous store APIs. The gRPC mapping, wire encoding, metadata, and task-conversion components now have cohesive source/header pairs and focused tests. Local validation passed: canonical 893-test suite, exact formatting/lint, CI-compatible clang-tidy 18/GTest 1.14, ASan/UBSan (32 focused tests), ThreadSanitizer (44 selected tests), all four TCK setup/store combinations, performance smoke (54 cases, zero errors), and docs. Review-thread explanations and the PR description are updated; the approved upstream TCK coverage baseline remains explicit. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
) ## Summary Switch the async server execution API from completion callbacks to Boost.Asio coroutines. `AsyncDispatcher` now awaits `CoroutineAgentExecutor` operations directly, including shared validation, interception, authorization, dispatch and response projection. This replaces the callback engine rather than wrapping it. Targets **feat/async-server**, continuing #268 / #318. - Remove `AsyncAgentExecutor`, `AsioAgentExecutor`, and the dispatcher's custom worker queue. All eight executor unary operations return typed `boost::asio::awaitable<core::Result<T>>`; agent-card providers remain in the dispatcher. - Run each request on an application-owned Asio context with a per-request strand. Preserve immediate admission limits, owned metadata, stop-token propagation, deadline arbitration, exactly-once hooks/terminal delivery, and safe late backend completion. `max_pending` also bounds frames retained after logical cancellation. The completion sink at the gRPC transport boundary remains required by gRPC's callback reactor API. - Share typed operation routing with synchronous dispatch without a callback adaptation layer. Keep the synchronous SDK independent of Boost. Async dispatch, its native gRPC transport, examples, tests and benchmarks live in optional `a2a::asio`, enabled by `A2A_ENABLE_ASIO=ON`; there is no callback execution fallback. - Migrate the async SUT, fixtures, installed consumers, examples and benchmarks to the coroutine engine. Preserve the synchronous three-transport TCK setup and the unified async setup across its transport facades. Native async listening remains gRPC; synchronous fixture/store operations run on bounded backend workers. - Fix the macOS Asio build on current gRPC: the client deadline-checking option has been removed upstream. Native deadline tests detect whether it exists and check the terminal signal actually observable by the server, while retaining strict exactly-once and late-result safety checks. Older gRPC still tests an isolated server deadline. The LLVM/libc++ header-ordering fix is retained. - Fix an HTTP streaming teardown race uncovered by full validation: retain the process-global pool, join reactors, then drain callback workers before releasing global state. Defer all pool cleanup from reactor threads to avoid cross-shard join/lock cycles as well. Add shutdown and cleanup regression coverage. - Defer Windows GoogleTest discovery until CTest runs, after parallel linking and app-local DLL deployment finish. Allow 30 seconds to enumerate the JSON-RPC integration executable, which exceeded CMake's five-second default; actual test execution limits are unchanged. - Install checksum-pinned **simdjson 4.6.11** in the Linux lint/build profile, matching the locally validated dependency. Ubuntu's 3.0.1 header contains invalid CRTP member lookup rejected by Clang 19. The installer builds and installs successfully; its header matches the local validated header byte-for-byte, and Ubuntu's Clang 19 passes the JSON implementation with it. The SDK minimum stays at simdjson 3.0. - Select **clang-tidy 19** for Linux CI. Clang 18 incorrectly analyzes a suspended Boost.Asio coroutine as running before its frame is attached; the finding reproduces locally. Keep the analyzer enabled and retain the build compiler matrix. - Use **Boost 1.92.0**, the latest stable release, via the checksum-pinned installer and optional vcpkg Asio feature. Include Boost license notices; the SDK remains Apache-2.0. Exercise coroutine builds in Linux, Windows, macOS, ASan/UBSan and TSan CI. **API migration:** derive from `CoroutineAgentExecutor`, use `co_return`/`co_await`, construct `AsyncDispatcher(application, scheduler, options)`, and link `a2a::asio`. Replace `worker_count` with a caller-owned execution context, and drain it during shutdown. Coroutine cancellation cannot forcibly interrupt uncooperative backend I/O. Blocking security/store APIs still need bounded workers; coroutine streaming and native async HTTP/JSON-RPC listeners remain follow-up work. ## Validation - `A2A_VERIFY_POSTGRES=1 A2A_VERIFY_BUILD_DIR=build ./scripts/verify_changes.sh`: **916 registered tests**, no failures, two expected TLS-without-SUT skips; complete source/test lint passes. Asio enabled with Boost 1.92.0. - Exact CI formatting check and explicit `./scripts/run_clang_tidy.sh build`: exit 0. Changed test translation units also pass Clang 18 / GoogleTest 1.14 complexity checks. - Focused coroutine, native-gRPC, SUT and HTTP suites: **142 tests pass under ASan/UBSan with leak detection**; the final cleanup/capacity changes were rerun in 45 focused tests. **86 SDK-owned engine/lifecycle tests pass under TSan**, plus 45 final HTTP/capacity tests, without suppressions. - Simulate current gRPC without the removed client-deadline option: both native deadline cases pass for **10 repetitions**, including completion races and late backend results after transport destruction. - Official start/run/stop TCK flow with both stores: synchronous three-transport profile **249 passed / 16 skipped** per store; coroutine async gRPC profile **68 passed / 197 skipped** per store. No executable failures. Final PostgreSQL rerun also passes. Existing upstream registry coverage gaps remain (80.9% synchronous MUST coverage); publication follows the previously approved documented baseline. - HTTP cancellation/process teardown: 40 isolated process runs pass. PostgreSQL cross-binding scenarios pass five consecutive runs after the cleanup fix. - Required gRPC + HTTP/JSON performance smoke: **54 scenarios, zero errors**. Feature-disabled SDK builds with Boost discovery disabled; installed coroutine and native-gRPC consumers pass. - `mdbook build book`, workflow YAML parsing and changed shell-script syntax checks pass. Python dependency `pip-audit` reports no known vulnerabilities. The Boost archive checksum/license were verified. OSV Scanner does not support this vcpkg manifest, so this is not a complete automated C++ dependency advisory audit. Controlled native-gRPC evidence (RelWithDebInfo, GCC 15, gRPC 1.51.1, Boost 1.92.0; backend held for 10 ms): | Pending requests | Sync application threads | Coroutine application threads | Sync p50 / p95 | Coroutine p50 / p95 | | --- | --- | --- | --- | --- | | 32 | 32 | 2 | 14.237 / 14.613 ms | 11.273 / 11.361 ms | | 128 | 128 | 2 | 31.570 / 34.306 ms | 14.045 / 14.580 ms | The coroutine process stayed at 13 threads for both request counts; the synchronous process rose from 11 to 42 / 138 threads. This demonstrates bounded application-thread use for a controlled asynchronous backend, not general database throughput. Immediate-dispatch Google Benchmark samples were also recorded; the previous callback-adapter timing is no longer evidence for this replacement design. ## Authorship and AI usage - [ ] Contains substantive content written by a human - [x] Contains substantive content generated by an AI agent ## Checklist - [x] `./scripts/verify_changes.sh` passed locally - [x] Docs updated if behavior changed
## Problem and resulting behavior DevEx follow-up to #268 and #318. SDK consumers currently have to implement a bounded work queue, an awaitable bridge, eight forwarding methods, and runtime lifetime management to reuse a blocking executor with the coroutine engine. This adds 15 files to the TCK consumer. The SDK now provides three composable conveniences: - `engine::BlockingExecutorAdapter`: an explicit compatibility adapter for an owned, thread-safe `AgentExecutor`. It bounds queued plus running work, checks cancellation/deadlines before backend execution, preserves typed results/errors, contains backend exceptions, and delivers completion on the awaiting executor. - `engine::AsyncRuntime`: an optional owner for a fixed Asio pool and `AsyncDispatcher`, with separate nonblocking shutdown and draining join. Existing caller-supplied Asio executors remain supported. Explicit joins from an owner's worker are rejected instead of deadlocking. - `ServerBindings`: owns SDK transport registrations and their route references. Sync construction registers all three transports; async construction registers native gRPC unary operations and HTTP agent-card discovery. Hosts retain ownership of listeners, credentials, and signals. Shared extension requirements and configured HTTP paths apply consistently. An existing blocking application can use: ```cpp auto adapted = std::make_shared<engine::BlockingExecutorAdapter>(legacy, limits); engine::AsyncRuntime runtime(adapted, execution_options); ServerBindings bindings(runtime.dispatcher(), card, binding_options); ``` Native coroutine applications pass their executor directly to `AsyncRuntime`. The installed-SDK examples cover both paths and native gRPC hosting. The new guide documents ownership, admission, shutdown, and supported bindings. ## SUT simplification Measured against #318's release base (`1ac17b5`): | Metric | Before | After | | --- | ---: | ---: | | Added files under `tests/sut` | 15 | 1 | | Net added SUT lines | 616 | 61 | This removes **90.1% of net added SUT code** and 14 extra fixture files. Test-specific behavior, cards, policies, environment parsing, and listener hosting remain in the original fixture files. The single async entrypoint selects the shared setup. Configured REST and JSON-RPC paths now use the same shared normalizer in the transports, binding route matchers, and JSON-RPC root alias. Missing leading slashes, trailing slashes, empty paths, and root paths retain the underlying transports' configuration semantics. ## Preservation of #268 The request-lifecycle implementation, coroutine dispatcher, and native gRPC execution implementation are unchanged. Existing typed operations, extended-card providers, shared validation/interceptors/security, deadlines, exactly-once completion, cancellation precedence, and active/physical-cleanup admission semantics remain covered. The native gRPC lifecycle tests now also exercise the convenience composition. Synchronous execution and streaming remain available across all three transports, including feature-disabled builds without Boost or C++20 cancellation. The async setup retains gRPC unary execution plus HTTP discovery. Blocking adaptation uses a fixed bounded pool and remains explicit about blocking backend I/O. Validation exposed an existing timing-dependent sync streaming test. It now waits for the backend's pending read before cancelling, and synchronizes its fixture cancellation notification with that wait. Production streaming code is unchanged. Both cancellation cases passed 50 repetitions after the fixture fix. ## Platform build fixes - Protect SDK executor declarations, consumer headers, and the implementation after late Boost includes from Win32's `SendMessage` → `SendMessageA/W` macro alias. A portable compile regression exercises affected header orders with Asio enabled and disabled; a late-include reproducer fails before the fix and compiles afterward. - Normalize the generated gRPC header and source after generation, clearing `SendMessage` after dependency includes so the static library and SDK agree on the stub/service symbol names. The regression also instantiates both generated service types to check vtable linkage and avoids macro-redefinition warnings. - The cancelled `macos-build` never started: GitHub reported hosted-runner acquisition/internal errors and ARM capacity constraints. Move this non-Asio job to the supported `macos-15-intel` pool, retaining `macos-15` ARM coverage for Asio and independent matrix execution. ## Validation Latest review follow-up (`0a19974`): focused builds and **85 tests passed**, including 12 new REST/JSON-RPC path-configuration cases and existing async bindings tests. Targeted clang-tidy for all changed implementations and the test file, plus exact CI formatting, passed. Long verification/TCK/performance checks were not repeated; validation remains scoped as requested. Windows linker follow-up (`1b263cc`): focused build and all 44 gRPC/macro tests passed, as did targeted clang-tidy and exact CI formatting. Injecting the Win32-style macro into generated-code dependencies reproduces the old missing-symbol linker failure; the normalized object links and runs successfully. Long verification/TCK/performance checks were skipped for this follow-up at the maintainer's request. Full-suite results below are from preceding commits. - Canonical PostgreSQL-enabled `./scripts/verify_changes.sh`: 943 registered tests, zero failures; two expected TLS-without-SUT skips. - Explicit `./scripts/run_clang_tidy.sh build` and exact CI formatting check: passed. Lint reuses successful analyses by tool/configuration and source content; reuse for unchanged translation units is checked against compiler-recorded dependencies. - Focused ThreadSanitizer: 71 lifecycle, dispatcher, adapter, runtime, and SUT tests passed without suppressions. - Feature-disabled build without Boost/cancellation: synchronous SDK/SUT targets built; 14 focused tests passed. - Clean installed-SDK consumers: coroutine timer, native async gRPC, and blocking-executor examples passed. - Official TCK start/run/stop on both in-memory and PostgreSQL stores: sync **249 passed / 16 skipped**, async **68 passed / 197 skipped** per store. Zero executed failures across all four runs. - Required gRPC + HTTP/JSON performance smoke: **54 scenarios, zero errors**. - `mdbook build book`: passed. Python tooling `pip-audit`: no known vulnerabilities. Dependency manifests are unchanged; this is not a complete automated C++ dependency advisory audit. The previously approved TCK registry-coverage baseline is preserved: synchronous MUST 80.9% / overall 80.0%; async gRPC MUST 59.8% / overall 61.5%. Passing executable tests does not claim complete registered-requirement coverage. Platform CI will run on this PR; earlier heads' results do not replace those checks. ## Authorship and AI usage - [ ] Contains substantive content written by a human - [x] Contains substantive content generated by an AI agent
|
@codex review this PR |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Closes #268.
Completes opt-in asynchronous unary server execution for v0.6.0. Applications implement
CoroutineAgentExecutorwith Boost.Asio C++20awaitable<Result<T>>methods and supply an Asio executor toAsyncDispatcher. NativeAsyncGrpcServerTransportconnects that engine to gRPC unary reactors without waiting for backend completion on a reactor thread or allocating one SDK worker per pending request.The callback-based async application executor and its Asio bridge have been removed.
AsyncDispatcherdirectly awaitsCoroutineAgentExecutormethods. Native gRPC reactor callbacks, transport completion handlers, and cancellation observers remain at integration boundaries. Existing synchronousAgentExecutor,Dispatcher, transports, and streaming registration remain source-compatible and available without Boost.Architecture and lifecycle
a2a::server::engine. The application receives an owned execution context; first-terminal-transition precedence and exactly-once completion remain authoritative through late backend cleanup.AsyncRuntimeowner, which runs a fixed-size Boost.Asio thread pool. The owning application shuts down and drains the runtime; suspended frames retain their application and pipeline until cleanup completes. Cancellation remains cooperative.BlockingExecutorAdapterexposes a synchronous, thread-safeAgentExecutorthrough the coroutine contract. Its Boost.Asio backend pool has explicit worker and queued-plus-running capacity limits. It calls application operations directly without nested dispatch. Cancellation completes the transport logically while running blocking calls retain their capacity until physical cleanup. This is bounded worker adaptation, not nonblocking network or database I/O, and does not restore the removed callback executor API.a2a::asiotarget requires Boost 1.92 or newer and C++20 standard-library cancellation. Boost's license and notices are included; the SDK remains Apache-2.0. CI includes feature-enabled and feature-disabled builds and the previously fixed Windows/macOS compatibility paths.Conformance setups and limits
The existing
tck_sutretains synchronous execution, streaming, and all three transports. The separatetck_async_sutuses the coroutine engine and registers SDK transports directly, sharing application fixtures, stores, policies, providers, and listener infrastructure with the synchronous setup.The async setup currently enables gRPC only. HTTP serves agent-card discovery/caching, and JSON-RPC/HTTP+JSON operation routes are unavailable. Unsupported transport selections fail at startup; the card advertises only enabled capabilities. A small awaitable bridge moves blocking fixture application/store operations onto the existing bounded backend queue and delivers results on the awaiting executor. This does not provide async database or outbound network I/O.
Async HTTP scheduling (#270), streaming (#169), outbound clients (#269), and async database stores (#266) remain separate work. Downstream registration, ownership, supported-platform guidance, installed-consumer examples, and reproducible sync-versus-async thread/latency evidence are documented under
book/src/server/.Validation
The local results below were recorded during implementation. Current-head CI results are linked separately below.
A2A_VERIFY_POSTGRES=1 A2A_VERIFY_BUILD_DIR=build ./scripts/verify_changes.sh: 927 registered tests, zero failures; two expected TLS-without-SUT skips. Includes native gRPC lifecycle/race cases, synchronous transports, PostgreSQL, installed consumers, examples, and fixture runtime tests../scripts/run_clang_tidy.sh build: passed with Clang 19. The local lint cache keys successful analyses by tool/configuration, compile commands, and translation-unit dependency content. Ubuntu Clang 19 / GTest 1.14 readability and complexity checks also pass.523240c: the chunk-callback shutdown test now holds the SSE stream open and verifies cancellation, eliminating the EOF/shutdown race in its success assertion. The affected 30-test HTTP TSAN suite and 200 repeated executions passed locally. Canonical validation, explicit lint, formatting, TCK, and performance smoke also passed. The complete CI ThreadSanitizer profile has passed on the current head.mdbook build book: passed. Boost dependency and vcpkg manifest/configuration changes are included; Python toolingpip-auditreports no known vulnerabilities. This is not a complete automated C++ dependency advisory audit.All six pull-request workflows have completed successfully on the current head,
d47aa3435b: CI, TCK Conformance, CodeQL, Docs, Tutorials, and Commit messages.The previously approved TCK registry-coverage baseline remains explicit: synchronous reports show 80.9% MUST / 80.0% overall coverage; the narrower async gRPC reports show 59.8% MUST / 61.5% overall. Upstream report tables group untested requirements under “Failed”; no executed requirement fails. Passing executable tests does not claim complete registered-requirement coverage.
Authorship and AI usage
Checklist
./scripts/verify_changes.shpassed locally