fix: ignore usage-only responses (except for BIDI mode)#1254
Open
r4inee wants to merge 1 commit into
Open
Conversation
r4inee
commented
Jun 9, 2026
| && !updatedResponse.interrupted().orElse(false) | ||
| && !updatedResponse.turnComplete().orElse(false) | ||
| && updatedResponse.usageMetadata().isEmpty() | ||
| && (context.runConfig().streamingMode() != StreamingMode.BIDI |
Contributor
Author
There was a problem hiding this comment.
adk-python seems to fork the logic in LIVE/BIDI mode - mainly kept in consistent with the logic below for now to avoid a larger change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
In ADK Java code execution flows, if the model response that contains executable code also has usageMetadata, ADK emits an extra contentless usage-only event after the codeExecutionResult event. That extra event is considered final=true, so BaseLlmFlow stops the loop and does not call the LLM again with the code execution result.
Solution:
Skipping metadata only events unless its in BIDI mode - aligns with adk-python behaviour.
Testing Plan
Unit Tests:
Please include a summary of passed java test results.
Manual End-to-End (E2E) Tests:
Testing using example mentioned in #1245
Checklist