Fix Gemini Live to handle bundled server_content fields#4147
Conversation
Gemini 3.x can bundle multiple fields (e.g. model_turn and output_transcription) on the same server_content message. The previous elif chain would only process the first matching field and silently drop the rest. Switch to independent if checks so every field is handled.
Codecov Report❌ Patch coverage is
... and 34 files with indirect coverage changes 🚀 New features to boost your workflow:
|
| self._check_and_reset_failure_counter() | ||
|
|
||
| if message.server_content and message.server_content.interrupted: | ||
| # server_content fields are NOT mutually exclusive — |
There was a problem hiding this comment.
Haven't dug too deep into this yet, but if this is broadly the case I'd be a bit surprised if the fix were as simple as just changing elif to if (in other words, I'd expect that there'd be some subtle implicit assumptions in our message handling logic about messages being mutually exclusive).
Do we know which server_content fields are allowed together? If it's only model_turn and output_transcription maybe we can be a bit more targeted in our change.
There was a problem hiding this comment.
I'd expect that there'd be some subtle implicit assumptions in our message handling logic about messages being mutually exclusive)
Indeed: #4148
…es-addon Fix bundled Gemini Live transcription ordering
There was a problem hiding this comment.
these tests feel a little too "reach-into-internals-y". pretty much any internal refactoring or name changes will break these.
There was a problem hiding this comment.
I agree. I told @chadbailey59 that I thought we should just cherry-pick the actual fix and not include the test. (I just let Codex write the test it wanted to write, and then committed that change. But I shouldn't have committed the test.) But I think I told Chad that in a DM so it got lost in the shuffle. Apologies.
|
Waiting to test/validate this once we can (once our usage of |
kompfner
left a comment
There was a problem hiding this comment.
Waiting to test/validate this once we can (once our usage of history_config is unblocked)
Gemini 3.1 Flash Live is working for basic conversation-and-tool-call usage (26, 26b, 26e, 26g). We'll continue to iron out the kinks in the others.
Summary
model_turnandoutput_transcription) on the sameserver_contentmessageelifchain only processed the first matching field, silently dropping the restifchecks so every field on a message is handledTest plan
🤖 Generated with Claude Code