feat(a2a-nats): add minimal server message_stream handler#357
Conversation
yordis
commented
Jun 19, 2026
- Final per-op slice: bootstrap unary reply + JetStream event pump. Cancellation tracking, audit emission, and terminal push-notification dispatch are Bridge-level concerns and land with the Bridge PR.
Bootstrap reply + JetStream event pump complete the unary-style portion of the streaming contract; cancellation tracking, audit emission, and terminal push-notification dispatch are Bridge-level concerns and land with the Bridge PR. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
PR SummaryMedium Risk Overview On success, the handler replies on NATS with a JSON-RPC bootstrap Errors use the usual JSON-RPC framing (parse/invalid params, handler failures, invalid task id). Requests without a reply subject or id-less notifications are dropped. Cancellation, audit, and terminal push notifications are explicitly deferred to a later Bridge PR. Reviewed by Cursor Bugbot for commit 46c9ce4. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Review limit reached
More reviews will be available in 36 minutes and 39 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds the Changesmessage/stream JSON-RPC handler
Sequence Diagram(s)sequenceDiagram
participant NATS as NATS Subscriber
participant handle as message_stream::handle
participant A2aExecutor
participant NATSReply as NATS Reply Subject
participant JetStream as JetStream task-events
NATS->>handle: payload, reply_subject, prefix
handle->>handle: parse JSON-RPC, extract id, decode SendMessageRequest
handle->>A2aExecutor: message_stream(SendMessageRequest)
A2aExecutor-->>handle: (Task, TaskEventStream)
handle->>handle: derive A2aTaskId from Task
handle->>NATSReply: publish JSON-RPC bootstrap response (Task)
loop TaskEventStream events
handle->>JetStream: publish serialized StreamResponse
end
Note over handle,NATSReply: on any error: publish_bootstrap_error → NATSReply
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Coverage SummaryDetailsDiff against mainResults for commit: 46c9ce4 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
…onse Client deserializes the bootstrap as SendMessageResponse (same as message/send), which wraps the task under a task key. Serializing a bare Task fails client-side deserialization and the stream never starts; wrap consistently so the bootstrap shape matches the contract. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 618ac20. Configure here.
The client subscribes with consumer filter
{prefix}.tasks.*.events.{req_id} using its own JSON-RPC string id;
publishing under a server-minted ReqId means every event misses the
filter and the stream never reaches the subscriber. Validate the id is
a string before calling the handler so a non-routable bootstrap fails
fast.
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
