Skip to content

fix: work around ADK empty Part(text='') breaking A2A responses#96

Open
luis5tb wants to merge 1 commit intoRHEcosystemAppEng:mainfrom
luis5tb:adk-emptytext-protection
Open

fix: work around ADK empty Part(text='') breaking A2A responses#96
luis5tb wants to merge 1 commit intoRHEcosystemAppEng:mainfrom
luis5tb:adk-emptytext-protection

Conversation

@luis5tb
Copy link
Copy Markdown
Collaborator

@luis5tb luis5tb commented Apr 15, 2026

Add EmptyPartFilterPlugin to strip empty text parts from model responses before they reach the ADK A2A part converter, which incorrectly treats text='' as falsy and drops the part entirely. When all parts are empty the plugin returns a fallback message instead of leaving the client in a broken thinking state.

Upstream bug: google/adk-python#5341

Comment thread src/lightspeed_agent/api/a2a/empty_part_filter_plugin.py

# Check every other content field.
return (
part.function_call is None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this long list of conditions seems hard to maintain in case they add more fields.
isn't there a way to generate a summary (e.g. json-ize it) and just check it, instead?

Add EmptyPartFilterPlugin to strip empty text parts from model
responses before they reach the ADK A2A part converter, which
incorrectly treats text='' as falsy and drops the part entirely.
When all parts are empty the plugin returns a fallback message
instead of leaving the client in a broken thinking state.

Upstream bug: google/adk-python#5341

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@luis5tb luis5tb force-pushed the adk-emptytext-protection branch from 8ca1960 to ed2da02 Compare April 15, 2026 08:56
Copy link
Copy Markdown
Collaborator

@dmartinol dmartinol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM

UsageTrackingPlugin(),
MCPOutputSizeGuardPlugin(),
EmptyPartFilterPlugin(),
],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not cleanly revert. better to do in two separate commits

(I assume we'll want to revert this once the bug is fixed)

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.

4 participants