Skip to content

refactor: Simplify ActiveTask._run_consumer()#1035

Merged
bartek-w merged 1 commit into
mainfrom
bartekw-event-consumer
May 5, 2026
Merged

refactor: Simplify ActiveTask._run_consumer()#1035
bartek-w merged 1 commit into
mainfrom
bartekw-event-consumer

Conversation

@bartek-w

Copy link
Copy Markdown
Collaborator

Improve readability of ActiveTask._run_consumer(), by creating new EventConsumer class. Additionally EventConsumer methods have much easier to read types of Event on each stage of processing.

Fixes #1032 🦕

@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/agent_execution/active_task.py 96.48% 96.29% 🔴 -0.19%
Total 93.01% 93.01% 🔴 -0.01%

Generated by coverage-comment.yml

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 refactors the ActiveTask consumer logic by extracting it into a dedicated EventConsumer class, which improves maintainability and readability. The review feedback identifies several opportunities for improvement, including correcting type hints to include PushNotificationEvent, removing redundant conditional checks, optimizing the copying of Protobuf messages to avoid unnecessary overhead, and enhancing type safety by replacing Any with specific types in cast operations.

Comment thread src/a2a/server/agent_execution/active_task.py Outdated
Comment thread src/a2a/server/agent_execution/active_task.py Outdated
Comment thread src/a2a/server/agent_execution/active_task.py Outdated
Comment thread src/a2a/server/agent_execution/active_task.py Outdated
Comment thread src/a2a/server/agent_execution/active_task.py
@bartek-w bartek-w force-pushed the bartekw-event-consumer branch from 037d78a to c875f85 Compare April 30, 2026 12:35
@bartek-w bartek-w requested a review from ishymko April 30, 2026 12:43
@bartek-w bartek-w marked this pull request as ready for review April 30, 2026 12:43
@bartek-w bartek-w requested a review from a team as a code owner April 30, 2026 12:43
@bartek-w bartek-w force-pushed the bartekw-event-consumer branch from c875f85 to 8bbde31 Compare May 5, 2026 09:48
@bartek-w bartek-w force-pushed the bartekw-event-consumer branch from 8bbde31 to dbd88e6 Compare May 5, 2026 10:12
@bartek-w bartek-w merged commit e65e758 into main May 5, 2026
38 checks passed
@bartek-w bartek-w deleted the bartekw-event-consumer branch May 5, 2026 10:17
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.

Cleanup and document new concurrency architecture

2 participants