Commit 20f7177
committed
fix: preserve empty-string text parts in A2A converter
Part(text='') is valid — it is produced by code_execution_utils.py when
code execution returns None, and by interactions_utils.py when the
Interactions API returns None text. Gemini 2.5 Flash thinking mode also
emits empty text parts.
The truthiness check `if part.text:` treats '' as falsy, causing the
converter to skip the part entirely. When all parts in a response are
empty the A2A message ends up with zero parts and the client sees
"broken thinking" with no content.
Change the check to `if part.text is not None:` so that empty strings
are correctly wrapped as TextPart while None is still skipped.
Add a regression test for the empty-string case.
Fixes #53411 parent e967f28 commit 20f7177
2 files changed
Lines changed: 18 additions & 1 deletion
File tree
- src/google/adk/a2a/converters
- tests/unittests/a2a/converters
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
300 | 317 | | |
301 | 318 | | |
302 | 319 | | |
| |||
0 commit comments