Skip to content

Conversation

@pwwpche
Copy link
Contributor

@pwwpche pwwpche commented Jun 25, 2025

…vent, and add more error logs

  1. Fix the bug that during TaskManager.save_task_event, metadata from the updated task event is lost
  2. During EventQueue processing, if any of the processing asyncio task failed with an unexpected exception, this exception is silently caught but never exposed to user or logged in the console. Add more error logs to make errors visible during debugging.

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • 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 and linter pass (Run nox -s format from the repository root to format)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

…vent, and add more error logs

1. Fix the bug that during TaskManager.save_task_event, metadata from the updated task event is lost
2. During EventQueue processing, if any of the processing asyncio task failed with an unexpected
   exception, this exception is silently caught but never exposed to user or logged in the console.
   Add more error logs to make errors visible during debugging.
@pwwpche pwwpche requested a review from a team as a code owner June 25, 2025 21:41
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 @pwwpche, 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 addresses two critical areas: data integrity and error visibility. It fixes a bug where task metadata and context IDs were not being properly persisted during task status updates. Additionally, it enhances the error handling mechanisms across the event processing and agent execution paths, ensuring that unexpected exceptions are logged and not silently swallowed, which significantly improves debuggability.

Highlights

  • Data Persistence Fix: Corrected an issue in TaskManager.save_task_event where metadata and contextId from TaskStatusUpdateEvent were not being appended to the task, leading to potential data loss. The task.metadata is now correctly updated (merging new metadata with existing), and task.contextId is set if provided by the event.
  • Enhanced Error Logging: Improved error visibility by adding explicit exception handling and logging in EventConsumer.consume_all and DefaultRequestHandler.on_message_send. Previously, unexpected exceptions in these asynchronous operations were silently caught, making debugging difficult. Now, they are logged at appropriate levels (debug for consumer loop, error for agent execution) and re-raised where necessary.
  • New Test Coverage: A new test case, test_save_task_event_metadata_contextid_update, has been added to tests/server/tasks/test_task_manager.py to validate the correct persistence of metadata and contextId when a TaskStatusUpdateEvent is processed.
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 successfully fixes a bug where task metadata was not being updated from events and improves error logging for unexpected exceptions during event processing. The changes are well-implemented and include a new test case for the bug fix. I've provided a couple of suggestions to refine the new error handling logic for better debuggability.

@kthota-g kthota-g merged commit e106020 into a2aproject:main Jun 25, 2025
5 checks passed
holtskinner pushed a commit that referenced this pull request Jun 30, 2025
#238)

…vent, and add more error logs

1. Fix the bug that during TaskManager.save_task_event, metadata from
the updated task event is lost
2. During EventQueue processing, if any of the processing asyncio task
failed with an unexpected exception, this exception is silently caught
but never exposed to user or logged in the console. Add more error logs
to make errors visible during debugging.

# Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make
sure it goes smoothly:

- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/a2aproject/a2a-python/blob/main/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.
- [ ] Ensure the tests and linter pass (Run `nox -s format` from the
repository root to format)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
holtskinner added a commit that referenced this pull request Jun 30, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.2.10](v0.2.8...v0.2.10)
(2025-06-30)


### ⚠ BREAKING CHANGES

* Update to A2A Spec Version
[0.2.5](https://github.com/a2aproject/A2A/releases/tag/v0.2.5)
([#197](#197))

### Features

* Add `append` and `last_chunk` to `add_artifact` method on
`TaskUpdater`
([#186](#186))
([8c6560f](8c6560f))
* add a2a routes to existing app
([#188](#188))
([32fecc7](32fecc7))
* Add middleware to the client SDK
([#171](#171))
([efaabd3](efaabd3))
* Add more task state management methods to TaskUpdater
([#208](#208))
([2b3bf6d](2b3bf6d))
* raise error for tasks in terminal states
([#215](#215))
([a0bf13b](a0bf13b))

### Bug Fixes

* `consume_all` doesn't catch `asyncio.TimeoutError` in python 3.10
([#216](#216))
([39307f1](39307f1))
* Append metadata and context id when processing TaskStatusUpdateE…
([#238](#238))
([e106020](e106020))
* Fix reference to `grpc.aio.ServicerContext`
([#237](#237))
([0c1987b](0c1987b))
* Fixes Short Circuit clause for context ID
([#236](#236))
([a5509e6](a5509e6))
* Resolve `APIKeySecurityScheme` parsing failed
([#226](#226))
([aa63b98](aa63b98))
* send notifications on message not streaming
([#219](#219))
([91539d6](91539d6)),
closes [#218](#218)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Holt Skinner <holtskinner@google.com>
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