Skip to content

feat(http): add bounded event-driven server runtime - #327

Merged
MisterVVP merged 5 commits into
release/v0.6.0from
feat/270-event-driven-http-runtime
Nov 9, 2026
Merged

MisterVVP merged 5 commits into
release/v0.6.0from
feat/270-event-driven-http-runtime

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds the opt-in EventHttpServer listener in a2a::asio for HTTP+JSON, JSON-RPC, discovery, and finite/live SSE. The shared incremental byte codec preserves the blocking adapter API, while existing transports provide routing, validation, authentication metadata, protocol errors, and event serialization.

One network thread and a fixed application pool bound connections, pending work, input/output buffers, and admission. Persistent and pipelined requests retain response order. Receive EOF drains active responses, including finite SSE, and buffered requests before closing. TCP resets still cancel live production. Awaited event writes provide backpressure; native dispatcher cancellation wakes a pending socket write and closes its connection, with exactly-once completion on the awaiting executor. Delayed cancellation cannot affect a completed write or another stream generation. Disconnects, rejected responses, producer failures, idle expiry, and shutdown cancel pending production. Retained stream handles reject writes after completion or listener destruction. Synchronous extended-card requests preserve structured HTTP 500 errors and activated-extension headers when no dispatcher is configured; native preparation remains independent of a synchronous dispatcher. Socket shutdown precedes close.

The async TCK fixture uses the SDK listener. Includes native socket tests, an installed consumer example, lifecycle documentation, and a reproducible benchmark runner.

The listener currently accepts HTTP/1.1. HTTP/2 clients can connect through a reverse proxy with an HTTP/1.1 upstream; native HTTP/2 framing and multiplexing remain outside this implementation.

Authorship and AI usage

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

Testing

  • ./scripts/verify_changes.sh: exit 0; 1,103 registered tests, zero failures, three existing skips, including installed-consumer tests.
  • Exact CI clang-format dry run and ./scripts/run_clang_tidy.sh build: exit 0. Unchanged translation units reuse input-validated clang-tidy 19 results from this session.
  • New regression tests verify native cancellation during a backpressured SSE write releases the producer before listener shutdown, preserves listener availability, and races safely with peer reset and listener shutdown. The cancellation regression fails on the previous implementation and passes with this fix.
  • Regression tests also cover send-half-close after the first SSE event, pipeline draining, reset cancellation before shutdown, all extended-card aliases and their wire-error headers/body, ordinary unary error compatibility, and native preparation without a synchronous dispatcher.
  • Native cancellation stress: 100 repetitions of each of three new cases (300 executions), checking exactly-once cleanup and native executor affinity. Earlier lifecycle stress covered ten cases (1,000 executions), including 32 live streams with one native worker and one HTTP application worker.
  • Default SDK build with Asio and curl disabled: passed.
  • Required gRPC/HTTP+JSON performance smoke: 54 rows, zero errors.
  • mdbook build book: passed.
  • Current head a92a9b2: the focused ThreadSanitizer job passed all 334 cases, including all 23 EventHttpServer lifecycle tests and the three native cancellation/race regressions. The profile explicitly builds the HTTP test executable when Asio is enabled; no suppressions were added.
  • Previous head 60c9e7f passed all 15 main CI jobs, including Windows, macOS/Asio, ASan/UBSan, interoperability, and performance, plus CodeQL and documentation checks. Remaining workflows for the current revision are tracked in CI.
  • Dependency manifests and pins are unchanged. Online OSV access remains proxy-blocked (CONNECT 403).

Comparable optimized c1/c16/c64 and idle measurements reported zero workload errors. Total fixture threads stayed at 21 versus 73 for the synchronous baseline at 64 clients. Short c1 finite SSE is materially slower: 2,986 versus 7,963 requests/s, completion p99 0.581 versus 0.236 ms. Bounded backend dispatch, executor hand-offs, and awaited socket-write acknowledgements add scheduling cost relative to inline connection-thread execution. The runtime remains opt-in; these shared-host measurements do not claim throughput parity.

Existing TCK failures

The unmodified upstream TCK 104a7b4ae0d83f65c075e3793e322953a830eaba reports 242 passed, 17 skipped, four failed on gRPC, JSON-RPC, and HTTP+JSON, identically to a clean release/v0.6.0 at 40e70a239d18208e07738abb64415d9d97e1a601. Per-requirement statuses match the baseline.

  • The REST error-format test expects application/json; the existing serializer returns application/a2a+json.
  • CORE-SEND-003 fails on all three transports because upstream omits its expected-error declaration and treats the unsupported-content error as unexpected.

No TCK expectations were changed. Mandatory conformance is not 100%. The baseline failures and blocked online vulnerability scan remain unresolved.

Checklist

  • ./scripts/verify_changes.sh passed locally
  • User documentation updated

@MisterVVP MisterVVP added the AI agent AI agent contribution label Nov 9, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP self-assigned this Nov 9, 2026
@MisterVVP MisterVVP added enhancement New feature or request performance Performance improvement related tasks based on benchmark results. Performance tests changes. labels Nov 9, 2026
@MisterVVP

Copy link
Copy Markdown
Owner Author

@codex review this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T08:31:33.277989Z a5df2ce 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: a5df2ced8e

ℹ️ 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 tests/unit/http_codec_test.cpp Resolved
@MisterVVP
MisterVVP merged commit 2e92a3d into release/v0.6.0 Nov 9, 2026
22 of 23 checks passed
@MisterVVP
MisterVVP deleted the feat/270-event-driven-http-runtime branch November 9, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution enhancement New feature or request performance Performance improvement related tasks based on benchmark results. Performance tests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant