Repository navigation
feat(agents): name the exception and LiteLLM deployment when the Gemini proxy's upstream call fails - #686
Open
andrewpark-scaleai wants to merge 3 commits into
Open
feat(agents): name the exception and LiteLLM deployment when the Gemini proxy's upstream call fails#686andrewpark-scaleai wants to merge 3 commits into
andrewpark-scaleai wants to merge 3 commits into
Conversation
…ni proxy's upstream call fails
andrewpark-scaleai
marked this pull request as ready for review
November 15, 2026 05:36
This branch has not been deployed
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.
Why
The goal is that every failure of an agent run leaves enough in the logs to debug it. The Gemini agent's in-sandbox LiteLLM proxy falls short. When its call to LiteLLM fails at the transport layer, it returns
502 {"detail": "gemini upstream request failed: "}with an empty reason, becausestr()of many httpx exceptions (ReadTimeout,RemoteProtocolError,ReadError) is empty. A reader cannot tell a slow upstream from an unreachable one. The proxy also does not log non-2xx LiteLLM responses on the passthrough path, and none of its logs say which deployment answered.What
ConnectError: ..., orrepr(e)when the message is empty). They also log a warning withevent=litellm_upstream_transport_error,proxyanderror_type.event=litellm_upstream_error_response,proxy,upstream_status, and whichever ofx-litellm-model-id,x-litellm-model-api-baseandx-litellm-model-groupthe response carries. Absent headers are left out. The response relayed to the CLI is unchanged.The only change a caller sees is the longer 502 detail text.
Test
uv run --extra dev pytest tst/unit/agents/gemini/ -qgives 156 passed. The new and updated tests intest_litellm_proxy.pyuse a fake httpx transport, check the log record fields withcaplog, and fail without the change (6 failures againstorigin/mainsource).

Confidence Score: 5/5
The PR appears safe to merge; the previous finding is fixed and no new actionable issues remain.Summary
The PR makes Gemini proxy failures easier to debug.
No new actionable issues were found. Tests were not rerun.
Reviews (3) · Last reviewed commit: "Gemini proxy: name the upstream error bo..." · Reviewed by Greptile