Skip to content

fix: bugs before going from alpha#279

Merged
yarolegovich merged 18 commits intomainfrom
yarolegovich/bug-hunt
Mar 13, 2026
Merged

fix: bugs before going from alpha#279
yarolegovich merged 18 commits intomainfrom
yarolegovich/bug-hunt

Conversation

@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 delivers a suite of critical bug fixes and stability enhancements across the A2A Go library, aiming to solidify its foundation before moving beyond the alpha stage. The changes primarily focus on ensuring consistent and robust error handling across gRPC, REST, and JSON-RPC communication protocols, safeguarding against unintended data modifications during compatibility conversions, and optimizing resource management and concurrency patterns. These updates collectively contribute to a more reliable, predictable, and correct system behavior.

Highlights

  • Authentication Deserialization: Fixed an issue where OAuth2 security scheme description and metadata URL were not correctly deserialized from JSON.
  • Client Interceptor Removal: Removed the AddCallInterceptor method from the client, as it was unused and potentially non-thread-safe.
  • REST Client Timeout Consistency: Standardized the default REST client timeout to 3 minutes, aligning it with JSON-RPC timeout configurations.
  • Comprehensive Error Handling Improvements: Enhanced error handling across gRPC, REST, and JSON-RPC interfaces, including consistent error conversion for ListTasks, prioritizing ErrorInfo.Reason for gRPC error mapping, using errors.Is for robust REST error type checking, and mapping new A2A errors to JSON-RPC codes. Also, fixed potential error overriding in REST ListTasks parsing by collecting all errors.
  • Compatibility and Mutation Prevention: Prevented unintentional metadata mutations during DataPart conversions in compatibility layers by cloning maps, and extended AgentCard conversion to include ExtendedAgentCard support and Skills.
  • Concurrency and Resource Management: Improved concurrency by buffering the panicChan in JSON-RPC streaming to prevent panics, refined error handling in the distributed manager's Cancel method, corrected metadata map capacity allocation, and simplified ProcessError logic in agentexec.
Changelog
  • a2a/auth.go
    • Updated UnmarshalJSON to correctly deserialize OAuth2 security scheme description and metadata URL.
  • a2a/json_test.go
    • Updated OAuth2SecurityScheme test data and expected JSON to include new fields.
    • Improved test failure output by changing format strings from %v to %+v.
  • a2aclient/client.go
    • Removed the AddCallInterceptor method from the client.
  • a2aclient/rest.go
    • Increased the default HTTP client timeout for REST transport from 5 seconds to 3 minutes.
    • Updated related comments to reflect the new default timeout.
  • a2acompat/a2av0/conversions.go
    • Imported the maps package.
    • Prevented unintentional metadata mutations during DataPart conversions by cloning maps.
    • Extended AgentCard conversion to include SupportsAuthenticatedExtendedCard and convert Skills from v1 to legacy.
  • a2acompat/a2av0/jsonrpc_server.go
    • Removed the if result != nil check before encoding JSON-RPC server response.
    • Added a type assertion check for SendMessageResult in onSendMessage to prevent panics and return a proper error.
  • a2acompat/a2av0/migration.go
    • Imported the log package.
    • Added error logging and fallback for FromV1Event conversion in fromV1Payload.
  • a2agrpc/v1/client.go
    • Updated ListTasks to use grpcutil.FromGRPCError for standardized gRPC error conversion.
  • a2apb/v0/pbconv/to_proto.go
    • Imported the maps package.
    • Cloned part.Metadata in toProtoDataPart to prevent unintended side effects when adding compatibility metadata.
  • a2asrv/agentexec.go
    • Removed the unused processedCount field from the processor struct.
    • Simplified ProcessError logic to always attempt task failure state updates, removing conditional checks.
  • a2asrv/handler.go
    • Added a nil check for lastEvent in SendMessage to handle cases where no events are produced during execution.
  • a2asrv/jsonrpc.go
    • Ensured JSON-RPC responses are always sent, even for null results, by removing the if result != nil check.
    • Buffered the panicChan in handleStreamingRequest to prevent panics during write attempts to unbuffered channels.
  • a2asrv/jsonrpc_test.go
    • Added a new test case for DeletePushConfigResponse to ensure proper JSON-RPC handling.
  • a2asrv/rest.go
    • Set the default Content-Type header to application/json for all REST responses.
    • Improved handleListTasks to accumulate and report all parsing errors instead of stopping on the first one.
  • a2asrv/rest_test.go
    • Added new test cases to validate error handling for invalid query parameters in the ListTasks REST endpoint.
  • internal/grpcutil/errors.go
    • Improved gRPC error conversion by prioritizing ErrorInfo.Reason for more precise mapping to A2A errors.
  • internal/grpcutil/errors_test.go
    • Added comprehensive round-trip tests for gRPC error conversion to ensure all A2A sentinel errors are correctly mapped.
  • internal/jsonrpc/jsonrpc.go
    • Mapped new A2A errors (ErrExtensionSupportRequired, ErrVersionNotSupported) to JSON-RPC error codes.
  • internal/rest/rest.go
    • Imported the errors package.
    • Updated ToRESTError to use errors.Is for robust error type checking, supporting wrapped errors.
  • internal/taskexec/distributed_manager.go
    • Removed the log package import.
    • Refined task execution logic for new tasks and adjusted work queue interaction.
    • Improved error handling in the Cancel method by adding a break statement to stop processing events after an error.
  • internal/taskexec/distributed_manager_test.go
    • Updated test case for work queue write errors to align with changes in distributed manager logic.
  • internal/taskupdate/manager.go
    • Corrected metadata map capacity allocation in updateArtifact to use the length of artifact.Metadata.
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 introduces a substantial number of bug fixes across the codebase, enhancing stability and correctness. The changes address issues ranging from potential panics and race conditions to incorrect logic in data conversions and error handling. The fixes are well-implemented and include corresponding test updates.

I have one suggestion for improvement regarding context propagation in the compatibility layer to enhance observability, but overall, this is a solid set of fixes preparing for a more stable release.

@yarolegovich yarolegovich merged commit b1f055c into main Mar 13, 2026
4 checks passed
@yarolegovich yarolegovich deleted the yarolegovich/bug-hunt branch March 13, 2026 15:58
yarolegovich added a commit that referenced this pull request Mar 17, 2026
* fix wrong allocation target size
* terminate subscription after terminal event has been received
* fix missing break after error
* fix subscribing to a different taskID in case of work queue override
* fix response not sent for methods not returning values
* fix panic write attempt to unbuffered channel

re #279
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