Skip to content

refactor: Simplify ActiveTask._run_consumer()#1035

Open
bartek-w wants to merge 1 commit intomainfrom
bartekw-event-consumer
Open

refactor: Simplify ActiveTask._run_consumer()#1035
bartek-w wants to merge 1 commit intomainfrom
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
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

🧪 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

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 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
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

1 participant