Skip to content

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
mainfrom
andrew-park/rel-a2a-proxy-upstream-detail
Open

andrewpark-scaleai wants to merge 3 commits into
mainfrom
andrew-park/rel-a2a-proxy-upstream-detail

Conversation

@andrewpark-scaleai

@andrewpark-scaleai andrewpark-scaleai commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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, because str() 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

  • Transport errors on the passthrough and the vertex bridge now include the exception class in the 502 detail (ConnectError: ..., or repr(e) when the message is empty). They also log a warning with event=litellm_upstream_transport_error, proxy and error_type.
  • Non-2xx LiteLLM responses are logged on both paths with event=litellm_upstream_error_response, proxy, upstream_status, and whichever of x-litellm-model-id, x-litellm-model-api-base and x-litellm-model-group the 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/ -q gives 156 passed. The new and updated tests in test_litellm_proxy.py use a fake httpx transport, check the log record fields with caplog, and fail without the change (6 failures against origin/main source).

RetriggerView in GreptileConfidence 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.

  • Gemini proxy failures now name the exception and deployment in logs.

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

@andrewpark-scaleai
andrewpark-scaleai marked this pull request as ready for review November 15, 2026 05:36
@andrewpark-scaleai
andrewpark-scaleai requested a review from a team as a code owner November 15, 2026 05:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant