Skip to content

feat: send task as a first subscribe event#716

Merged
ishymko merged 3 commits into1.0-devfrom
ishymko/675-subscribe-change
Feb 20, 2026
Merged

feat: send task as a first subscribe event#716
ishymko merged 3 commits into1.0-devfrom
ishymko/675-subscribe-change

Conversation

@ishymko
Copy link
Member

@ishymko ishymko commented Feb 20, 2026

Following

The operation MUST return a Task object as the first event in the stream

introduced in 1.0: https://a2a-protocol.org/latest/specification/#316-subscribe-to-task

It also correctly uses UnsupportedOperationError as per the "Errors" section from the documentation linked above.

Fixes #675

Following

> The operation MUST return a Task object as the first event in the stream

introduced in 1.0: https://a2a-protocol.org/latest/specification/#316-subscribe-to-task
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ishymko, 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 brings the subscribe_to_task operation into full compliance with version 1.0 of the A2A protocol specification. It ensures that consumers of the task stream receive the Task object as the very first event, providing immediate context. Additionally, it refines the error reporting for attempts to subscribe to tasks that are already in a completed state, aligning the error type with the specified UnsupportedOperationError.

Highlights

  • Protocol Compliance: Implemented the A2A protocol specification 1.0 requirement to send the Task object as the first event in the subscribe_to_task stream.
  • Error Handling Update: Updated error handling for subscribe_to_task when a task is in a terminal state, now raising UnsupportedOperationError instead of InvalidParamsError as per the specification.
  • Testing: Added and modified unit tests to ensure compliance with the new subscribe_to_task behavior and error handling.
Changelog
  • src/a2a/server/request_handlers/default_request_handler.py
    • The on_subscribe_to_task asynchronous generator now yields the Task object as its first event.
    • The error raised when subscribing to a task in a terminal state was changed from InvalidParamsError to UnsupportedOperationError.
  • tests/server/request_handlers/test_default_request_handler.py
    • A new assertion was added to test_on_subscribe_to_task_resubscribe to confirm the first event received is the Task object.
    • The test_on_subscribe_to_task_in_terminal_state test was updated to expect UnsupportedOperationError.
Activity
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
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 correctly implements changes to align with the A2A protocol specification. It ensures that subscribing to a task stream now correctly yields the task object as the first event and raises an UnsupportedOperationError when subscribing to a task in a terminal state. The tests have been updated accordingly to verify this new behavior. I have one minor suggestion to improve code consistency in the test suite.

ishymko and others added 2 commits February 20, 2026 14:38
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ishymko ishymko force-pushed the ishymko/675-subscribe-change branch from 5053c4e to e02e84c Compare February 20, 2026 13:42
@ishymko ishymko marked this pull request as ready for review February 20, 2026 13:43
@ishymko ishymko requested a review from a team as a code owner February 20, 2026 13:43
@ishymko ishymko enabled auto-merge (squash) February 20, 2026 13:44
@ishymko ishymko merged commit e71ac62 into 1.0-dev Feb 20, 2026
9 checks passed
@ishymko ishymko deleted the ishymko/675-subscribe-change branch February 20, 2026 13:44
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