feat(providers): Empty assistant response after tool_calls completion (104×, Gemini flash variants)
OmniRoute Version: 3.8.50
Installation Method: npm (global)
Operating System: Linux
OS Version: Ubuntu / Linux 6.17.0-1020-oracle (arm64)
Node.js Version: v24.16.0
Provider(s) Involved: OpenRouter, TokenRouter, BAI
Model(s) Involved: google/gemini-3.5-flash-lite (70×), google/gemini-3.6-flash (22×), google/gemini-3-flash-preview (8×), qwen3.8-27b (3×), z-ai/glm-5.3-free (1×)
Client Tool: Any client routed through OmniRoute
Description
After a model returns tool_calls and the client submits tool results, the streamed assistant response comes back empty: [STREAM] Empty assistant response after tool_calls completion — 104 warnings in ~41 h.
Concentration on Gemini-flash variants via OpenRouter/TokenRouter suggests either (a) OmniRoute mishandles the post-tool stream continuation for these models, or (b) the upstream legitimately returns empty content and OmniRoute should auto-retry/failover rather than passing an empty completion to the client.
Steps to Reproduce
- Run an agentic client through OmniRoute to
openrouter:google/gemini-3.5-flash-lite. - Let the model emit
tool_calls, then submit results. - Observe
[STREAM] Empty assistant response after tool_calls completion— the client receives an empty assistant turn.
Expected Behavior
Post-tool-call continuations return actual assistant content; if the upstream legitimately returns empty, OmniRoute should retry/failover to an alternate rather than forwarding an empty response.
Actual Behavior
Empty assistant responses reach the client (~104×/41h), degrading agentic flows — tools execute but the model never narrates/continues.
Test Impact
Needs a new integration test — tool_calls → tool_result → streamed continuation returns non-empty assistant content for the affected Gemini variants.
Error Logs / Output
[STREAM] Empty assistant response after tool_calls completion (openrouter:google/gemini-3.5-flash-lite) — sessionId=... # ×70
[STREAM] Empty assistant response after tool_calls completion (openrouter:google/gemini-3.6-flash) # ×22
[STREAM] Empty assistant response after tool_calls completion (tokenrouter:google/gemini-3-flash-preview) # ×8
Possible Solutions
- Detect empty post-tool continuations and retry once (or failover to the next route) before returning to the client.
- Verify the tool-result → Gemini
functionResponseconversion — a malformedfunctionResponsecan make Gemini return empty turns. - Track empty-response rate per model; auto-demote models above a threshold.
Validation Plan
- Replay a captured tool_calls→tool_result sequence against
openrouter:google/gemini-3.5-flash-lite→ non-empty continuation.
Additional Context
Related conversion issue filed separately for Bedrock toolResult pairing — likely the same code area.
Source: diegosouzapw/OmniRoute