v3.9.1: Fix Gemini stream hang when model returns only function calls

This commit is contained in:
2026-05-24 19:38:28 +00:00
Unverified
parent c69a62d4e4
commit 97b9b111d8

View File

@@ -4496,8 +4496,8 @@ class Handler(http.server.BaseHTTPRequestHandler):
current_tool_calls[call_id] = fc
output_items.append({"tool": True})
last_finish = candidates[0].get("finishReason", "")
if OAUTH_PROVIDER == "google-antigravity" and full_text and last_finish:
if last_finish == "MAX_TOKENS" and not current_tool_calls:
if last_finish:
if OAUTH_PROVIDER == "google-antigravity" and last_finish == "MAX_TOKENS" and full_text and not current_tool_calls:
print(f"[{self._session_id}] MAX_TOKENS hit ({len(full_text)} chars), auto-continuing...", file=sys.stderr)
break
stream_finished = True