Skip to content

Conversation

@fjuma
Copy link
Collaborator

@fjuma fjuma commented Jul 16, 2025

Description

This PR brings in the updates required to align with the A2A v0.2.4 and v0.2.5 spec versions.

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests pass
  • Appropriate READMEs were updated (if necessary)

Fixes #183 🦕

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.

Summary of Changes

Hello @fjuma, 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 updates the A2A client and server implementations to align with versions v0.2.4 and v0.2.5 of the A2A specification. The core changes revolve around enhancing push notification management by introducing new API methods for listing and deleting configurations, and refining the AgentCard structure to include protocol versioning and additional interface declarations.

Highlights

  • Updated A2A Specification Alignment: The client and server implementations now fully support A2A spec versions v0.2.4 and v0.2.5. This includes updates to the AgentCard structure to incorporate protocolVersion, additionalInterfaces, and preferredTransport fields, ensuring compatibility with the latest protocol definitions.
  • Enhanced Push Notification Management: New JSON-RPC methods (tasks/pushNotificationConfig/list and tasks/pushNotificationConfig/delete) have been introduced. These allow agents to programmatically list all active push notification configurations for a given task and delete specific configurations, providing more granular control over task notifications.
  • Refactored Push Notification Backend: The server-side architecture for push notifications has been significantly modularized. The monolithic PushNotifier has been replaced by two distinct interfaces: PushNotificationConfigStore for managing configuration storage (with an in-memory implementation provided) and PushNotificationSender for handling the actual dispatch of notifications. This improves maintainability and extensibility.
  • Improved Client API for Push Notifications: The A2AClient now offers overloaded methods for getTaskPushNotificationConfig to support specifying a particular configuration ID. Additionally, new client methods have been added for listTaskPushNotificationConfig and deleteTaskPushNotificationConfig, providing a complete client-side interface for the new server capabilities.
  • Standardized Error Handling: Error handling has been refined across the codebase. A2AServerException now consistently captures and propagates the underlying cause of exceptions. JSONRPCResponse constructors have been updated for better type safety, especially for responses with Void results. A new PushNotificationNotSupportedError is introduced for cases where an agent's capabilities do not include push notifications.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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 introduces significant feature updates, aligning the codebase with A2A spec versions v0.2.4 and v0.2.5, primarily focusing on enhancing push notification handling with support for multiple configurations per task. The changes include refactoring the PushNotifier with PushNotificationConfigStore and PushNotificationSender, along with adding list and delete operations for push notification configurations. The code is generally well-structured, and the new features are accompanied by a comprehensive set of tests. The review comments suggest minor improvements for code clarity and correctness.

Comment on lines +295 to 305
private PushNotificationConfig getPushNotificationConfig(List<PushNotificationConfig> notificationConfigList,
String configId) {
if (configId != null) {
for (PushNotificationConfig notificationConfig : notificationConfigList) {
if (configId.equals(notificationConfig.id())) {
return notificationConfig;
}
}
}
return notificationConfigList.get(0);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

When a specific configId is provided but not found, the current implementation falls back to returning the first available configuration. This could be misleading for the client, as it might receive a configuration it didn't ask for.

It would be more explicit and less error-prone to throw an error, such as InternalError or a more specific custom error, to indicate that the requested configuration was not found.

Suggested change
private PushNotificationConfig getPushNotificationConfig(List<PushNotificationConfig> notificationConfigList,
String configId) {
if (configId != null) {
for (PushNotificationConfig notificationConfig : notificationConfigList) {
if (configId.equals(notificationConfig.id())) {
return notificationConfig;
}
}
}
return notificationConfigList.get(0);
}
private PushNotificationConfig getPushNotificationConfig(List<PushNotificationConfig> notificationConfigList,
String configId) throws JSONRPCError {
if (configId != null) {
for (PushNotificationConfig notificationConfig : notificationConfigList) {
if (configId.equals(notificationConfig.id())) {
return notificationConfig;
}
}
throw new InternalError("Push notification config with id '" + configId + "' not found.");
}
return notificationConfigList.get(0);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is intentional. The configId is optional. The spec says that the server "will return one of the associated configurations if config id is not specified". The python implementation returns the first one in this case, so we've done the same.

Comment on lines +38 to +45
Iterator<PushNotificationConfig> notificationConfigIterator = notificationConfigList.iterator();
while (notificationConfigIterator.hasNext()) {
PushNotificationConfig config = notificationConfigIterator.next();
if (config.id().equals(notificationConfig.id())) {
notificationConfigIterator.remove();
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The while loop with an iterator to find and remove an element can be simplified using List.removeIf(). This is more concise and idiomatic in modern Java (8+).

Suggested change
Iterator<PushNotificationConfig> notificationConfigIterator = notificationConfigList.iterator();
while (notificationConfigIterator.hasNext()) {
PushNotificationConfig config = notificationConfigIterator.next();
if (config.id().equals(notificationConfig.id())) {
notificationConfigIterator.remove();
break;
}
}
notificationConfigList.removeIf(config -> config.id().equals(notificationConfig.id()));

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

List.removeIf() will check every item in the list but we don't need to do this. We can simply break from the loop once we've found the right config.

Comment on lines +65 to +72
Iterator<PushNotificationConfig> notificationConfigIterator = notificationConfigList.iterator();
while (notificationConfigIterator.hasNext()) {
PushNotificationConfig config = notificationConfigIterator.next();
if (configId.equals(config.id())) {
notificationConfigIterator.remove();
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the setInfo method, this while loop with an iterator can be simplified by using List.removeIf(). This will make the code more readable and modern.

Suggested change
Iterator<PushNotificationConfig> notificationConfigIterator = notificationConfigList.iterator();
while (notificationConfigIterator.hasNext()) {
PushNotificationConfig config = notificationConfigIterator.next();
if (configId.equals(config.id())) {
notificationConfigIterator.remove();
break;
}
}
notificationConfigList.removeIf(config -> configId.equals(config.id()));

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same here, the loop allows us to break once we've found the right push notification config.

}
}

protected void deletePusNotificationConfigInStore(String taskId, String configId) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a typo in the method name deletePusNotificationConfigInStore. It should be deletePushNotificationConfigInStore.

Correcting this will improve readability and consistency. Please also update all call sites of this method.

Suggested change
protected void deletePusNotificationConfigInStore(String taskId, String configId) throws Exception {
protected void deletePushNotificationConfigInStore(String taskId, String configId) throws Exception {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Collaborator

@kabir kabir left a comment

Choose a reason for hiding this comment

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

The main things standing out to me are:

a) TCK_VERSION in .github/workflows/run-tck.yml should be updated to v0.2.5
b) We need a v0.2.5 tag of the TCK

Or all PRs will fail the TCK going forward

@fjuma
Copy link
Collaborator Author

fjuma commented Jul 17, 2025

The main things standing out to me are:

a) TCK_VERSION in .github/workflows/run-tck.yml should be updated to v0.2.5 b) We need a v0.2.5 tag of the TCK

Or all PRs will fail the TCK going forward

I've updated the TCK version to v0.2.5. Note that the tck job will fail until the tag is available.

@fjuma fjuma merged commit 93d6bae into a2aproject:main Jul 17, 2025
4 of 5 checks passed
kabir pushed a commit to kabir/a2a-java that referenced this pull request Dec 23, 2025
# Description

This PR brings in the updates required to align with the A2A v0.2.4 and
v0.2.5 spec versions.

- [X] Follow the [`CONTRIBUTING` Guide](../CONTRIBUTING.md).
- [X] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [X] Ensure the tests pass
- [X] Appropriate READMEs were updated (if necessary)

Fixes a2aproject#183  🦕
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.

[Feat]: Implement the spec updates for v0.2.4 and v0.2.5

2 participants