Skip to content

fix: migrate a2asrv after core type changes#216

Merged
yarolegovich merged 3 commits intoyarolegovich/a2aclient-migratefrom
yarolegovich/a2asrv-migrate
Feb 18, 2026
Merged

fix: migrate a2asrv after core type changes#216
yarolegovich merged 3 commits intoyarolegovich/a2aclient-migratefrom
yarolegovich/a2asrv-migrate

Conversation

@yarolegovich
Copy link
Member

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yarolegovich, 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 primarily focuses on migrating the A2A server (a2asrv) to align with recent core type changes, enhancing API consistency and simplifying internal data structures. The changes involve a comprehensive refactoring of method signatures, request parameter types, and event handling mechanisms across various server components. This standardization aims to improve maintainability and clarity of the codebase, ensuring that the server's interactions with core A2A types are uniform and robust.

Highlights

  • API Standardization: Refactored a2asrv method names by removing the On prefix (e.g., OnGetTask is now GetTask) and standardized request parameter types across the server to use dedicated *Request structs (e.g., a2a.MessageSendParams replaced with a2a.SendMessageRequest).
  • Streaming Response Consistency: Ensured all streaming responses in both JSON-RPC and REST handlers consistently wrap individual events within an a2a.StreamResponse object, providing a unified structure for event delivery.
  • Simplified Push Notification Authentication: Streamlined the push notification authentication configuration by changing a2a.PushAuthInfo.Schemes from a slice of strings to a single Scheme string, simplifying how authentication methods are specified.
  • Task State Management Refinement: Removed the Final boolean field from a2a.TaskStatusUpdateEvent and related logic, with task finalization now determined by the TaskState itself, including the addition of TaskStateInputRequired as a stopping condition for event processing.
  • Internal Path Helper Updates: Updated internal REST path helper functions and their usage across the a2aclient and a2asrv components to reflect new naming conventions and improved path generation.
Changelog
  • a2aclient/rest.go
    • Updated MakeTasksListPath function call to MakeListTasksPath.
  • a2asrv/agentexec.go
    • Updated comments regarding event processing termination conditions to include TaskStateInputRequired.
    • Removed explicit setting of event.Final = true for TaskStateCompleted status updates.
    • Migrated parameter types for CreateExecutor, loadExecutionContext, and createNewExecutionContext from *a2a.MessageSendParams to *a2a.SendMessageRequest.
    • Migrated parameter type for CreateCanceler from *a2a.TaskIDParams to *a2a.CancelTaskRequest.
    • Set Metadata to nil during CreateCanceler's execution context initialization.
  • a2asrv/handler.go
    • Renamed On* methods in the RequestHandler interface and defaultRequestHandler implementation to their non-prefixed versions (e.g., OnGetTask to GetTask).
    • Updated parameter types for all RequestHandler methods to use new *Request or *Create structs.
    • Renamed OnResubscribeToTask to SubscribeToTask.
    • Modified CreateTaskPushConfig to include the ID field in the returned TaskPushConfig.
    • Updated shouldInterruptNonStreaming function signature to use *a2a.SendMessageRequest.
  • a2asrv/handler_test.go
    • Updated testCase struct and various test inputs to use *a2a.SendMessageRequest.
    • Removed a test case related to the event final flag precedence.
    • Updated newArtifactEvent, a2a.NewArtifactUpdateEvent, a2a.NewMessage, and a2a.NewMessageForTask calls to use a2a.NewTextPart.
    • Removed res.Final = true assignment from newFinalTaskStatusUpdate.
    • Updated test calls to reflect new method names and request parameter types.
    • Adjusted TestRequestHandler_OnSetTaskPushConfig to match the new CreateTaskPushConfig request and response structure.
    • Changed LastUpdatedAfter to StatusTimestampAfter in a2a.ListTasksRequest within a test case.
  • a2asrv/intercepted_handler.go
    • Renamed On* methods to their non-prefixed versions to match the RequestHandler interface.
    • Updated parameter types for all intercepted handler methods to align with new request types.
    • Adjusted internal calls to the underlying handler methods to use the new naming conventions.
  • a2asrv/intercepted_handler_test.go
    • Updated mockHandler method signatures and internal logic to reflect new naming and parameter types.
    • Modified methodCalls slice to use the new method names and request types.
    • Adjusted test cases to interact with the updated method names and request types.
    • Updated TextPart usage to a2a.NewTextPart in test message creation.
    • Corrected text extraction logic in TestInterceptedHandler_RequestModification for a2a.Part interface.
  • a2asrv/jsonrpc.go
    • Wrapped SendMessageResult in a2a.StreamResponse for MethodMessageSend to ensure consistent streaming format.
    • Wrapped individual events in a2a.StreamResponse within eventSeqToSSEDataStream.
    • Updated on* methods to use the new *Request types and call the corresponding renamed handler methods.
    • Changed Transport field to ProtocolBinding in a2a.AgentInterface for client endpoint configuration.
  • a2asrv/jsonrpc_test.go
    • Updated methodCalls to reflect new method names and request types.
    • Changed Transport to ProtocolBinding in a2aclient.NewFromEndpoints.
    • Updated a2a.NewMessage calls to use a2a.NewTextPart in test cases.
  • a2asrv/push/sender.go
    • Modified SendPush to use config.Auth.Scheme (single string) instead of config.Auth.Schemes (slice of strings) for authentication.
  • a2asrv/push/sender_test.go
    • Updated test cases to use config.Auth.Scheme instead of config.Auth.Schemes for push authentication.
  • a2asrv/rest.go
    • Updated NewRESTHandler to use new path helper functions and new method names for routing.
    • Modified handleSendMessage to use a2a.SendMessageRequest and wrap the result in a2a.StreamResponse.
    • Updated handleStreamMessage to use a2a.SendMessageRequest and call handler.SendStreamingMessage.
    • Changed handleGetTask to use a2a.GetTaskRequest and call handler.GetTask.
    • Updated handleListTasks to use a2a.ListTasksRequest, call handler.ListTasks, and change LastUpdatedAfter to StatusTimestampAfter.
    • Modified handlePOSTTasks to use strings.CutSuffix for path parsing and call handler.CancelTask and handler.SubscribeToTask with new request types.
    • Updated handleCancelTask to use a2a.CancelTaskRequest and call handler.CancelTask.
    • Wrapped events in a2a.StreamResponse within handleStreamingRequest.
    • Renamed handleSetTaskPushConfig to handleCreateTaskPushConfig and updated its request type and handler call.
    • Updated handleGetTaskPushConfig, handleListTaskPushConfig, and handleDeleteTaskPushConfig to use new request types and handler calls.
    • Updated handleGetExtendedAgentCard to call handler.GetExtendedAgentCard.
  • a2asrv/rest_test.go
    • Updated methodCalls to reflect new method names and request types.
    • Changed Transport to ProtocolBinding in a2aclient.NewFromEndpoints.
    • Adjusted test paths and request bodies to match new REST paths and request types.
    • Updated a2a.NewMessage calls to use a2a.NewTextPart in test cases.
  • a2asrv/workqueue/queue.go
    • Renamed CancelParams to CancelRequest and updated its type to *a2a.CancelTaskRequest.
    • Renamed ExecuteParams to ExecuteRequest and updated its type to *a2a.SendMessageRequest.
  • internal/rest/rest.go
    • Renamed MakeTasksListPath() to MakeListTasksPath().
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 migrates the a2asrv package to align with recent core type changes. The changes are extensive and mostly involve renaming methods and updating parameter types across handlers, tests, and transport layers.

Overall, the migration appears to be thorough. The identified potential issues remain:

  • A possible functional regression in task cancellation where metadata is no longer passed.
  • An incorrect test assertion and a confusing data structure for creating push notification configurations.

Please see the specific comments for details.

@yarolegovich yarolegovich merged commit db7642a into yarolegovich/a2aclient-migrate Feb 18, 2026
2 checks passed
@yarolegovich yarolegovich deleted the yarolegovich/a2asrv-migrate branch February 18, 2026 08:15
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

Comments