Skip to content

fix: update pushsender#256

Merged
nahapetyan-serob merged 2 commits intomainfrom
serob/update-pushsender
Mar 3, 2026
Merged

fix: update pushsender#256
nahapetyan-serob merged 2 commits intomainfrom
serob/update-pushsender

Conversation

@nahapetyan-serob
Copy link
Copy Markdown
Collaborator

Refactored the push notification system to send a2a.Event instead of a2a.Task.
Notifications are now sent immediately as events happen, final messages were skipped before.
Updated the tests to comply with, and added test to verify the changes.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the push notification mechanism by transitioning from task-based notifications to event-driven notifications. This change ensures that external systems receive real-time updates for all relevant a2a.Event types, improving the responsiveness and completeness of the notification stream. The refactoring involved modifying core processing logic and the push sender implementation, along with comprehensive test updates to validate the new behavior.

Highlights

  • Event-driven Push Notifications: The push notification system has been refactored to send a2a.Event objects instead of a2a.Task objects, allowing for more granular and immediate notifications as events occur.
  • Immediate Notification Delivery: Push notifications are now dispatched immediately when an event happens, resolving an issue where final messages or intermediate events might have been skipped previously.
  • Updated Push Sender Interface: The push.Sender interface and its HTTPPushSender implementation were updated to accept and process the new a2a.Event type, including logic to extract the relevant TaskID from various event types.
  • Comprehensive Test Coverage: Existing tests were updated, and new tests were added to ensure the correct behavior of the event-driven push notification system across different event types (Task, Message, Status Update, Artifact Update) and error conditions.
Changelog
  • a2asrv/agentexec.go
    • Modified the Process method to invoke sendPushNotifications earlier with a2a.Event.
    • Removed a redundant call to sendPushNotifications that previously used a2a.Task.
    • Updated the sendPushNotifications function signature to accept a2a.Event and implemented a type switch to derive the TaskID.
  • a2asrv/handler_test.go
    • Updated TestRequestHandler_SendMessage_PushNotifications to simulate a sequence of diverse a2a.Event types.
    • Adjusted test assertions to expect multiple push notifications corresponding to the simulated event stream.
    • Added verification logic to confirm that Task, Message, TaskStatusUpdateEvent, and TaskArtifactUpdateEvent types are correctly pushed.
  • a2asrv/push/api.go
    • Updated the SendPush method signature within the Sender interface to accept a2a.Event instead of *a2a.Task.
  • a2asrv/push/sender.go
    • Modified the SendPush method to accept a2a.Event as its payload.
    • Implemented a type switch to extract the TaskID from various a2a.Event implementations.
    • Changed the JSON marshaling process to wrap the a2a.Event within an a2a.StreamResponse.
    • Added validation to ensure that events being pushed contain a valid TaskID.
  • a2asrv/push/sender_test.go
    • Refactored TestHTTPPushSender_SendPushSuccess into a table-driven test to cover different a2a.Event types.
    • Updated the unmarshaling target from receivedTask to received of type a2a.StreamResponse.
    • Expanded TestHTTPPushSender_SendPushError to include error scenarios for various a2a.Event types and a specific test for missing TaskID.
  • internal/testutil/push_sender.go
    • Updated TestPushSender to store a slice of a2a.Event (PushedEvents) instead of *a2a.Task (PushedTasks).
    • Modified the SendPush method signature and its internal logic to correctly handle a2a.Event.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the push notification system to send notifications for each a2a.Event instead of only for the final a2a.Task state. This provides more granular updates to consumers. The changes are well-implemented across the agentexec, push, and test files. The tests have been updated to cover the new event-driven notification logic.

I've identified an opportunity to simplify the code by removing duplicated logic for extracting the TaskID from events. By using the TaskInfoProvider interface, which all events implement, we can make the code more concise and maintainable. Please see my specific comments for details.

@nahapetyan-serob nahapetyan-serob requested a review from ishymko March 3, 2026 11:23
@nahapetyan-serob nahapetyan-serob merged commit 5f7a594 into main Mar 3, 2026
4 checks passed
@nahapetyan-serob nahapetyan-serob deleted the serob/update-pushsender branch March 3, 2026 12:36
yarolegovich pushed a commit that referenced this pull request Mar 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.0.0](v1.0.0-alpha.3...v1.0.0)
(2026-03-17)


### Features

* implement the new rest error handling
([#282](#282))
([a3bda30](a3bda30))
* use v2 suffix for module ID and provide compat support
([#270](#270))
([dd1b6ba](dd1b6ba)),
closes [#250](#250)


### Bug Fixes

* a2asrv jsonrpc Content-Type
([#265](#265))
([2568a46](2568a46))
* bugs before going from alpha
([#279](#279))
([b1f055c](b1f055c))
* GetTaskRequest nil pointer assignment check
([#258](#258))
([440bb79](440bb79))
* inject headers into service params
([#277](#277))
([d33f3bd](d33f3bd)),
closes [#275](#275)
* propagate cancelation signal using task store
([#272](#272))
([5e1d462](5e1d462)),
closes [#245](#245)
* regenerate spec and fix returnImmediately
([#284](#284))
([2eee0b9](2eee0b9))
* task modified after save
([#266](#266))
([c15febe](c15febe))
* taskupdater result mutable
([#274](#274))
([6038d92](6038d92))
* update pushsender
([#256](#256))
([5f7a594](5f7a594))
* use enum values as in the spec
([#261](#261))
([eb98981](eb98981)),
closes [#251](#251)


### Documentation

* **a2asrv:** add Example_* test functions for pkg.go.dev documentation
([#262](#262))
([7888e37](7888e37))
* add example tests a2a
([#240](#240))
([4fe08a9](4fe08a9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants