Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Antigravity turns crash on transient network drops (502 Bad Gateway / model unreachable) instead of retrying #16010

Closednathnael-desta(GitHub profile, opens in a new tab) opened this issue 3 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. Open T3 Code and start a task using Google Antigravity (Gemini 3.8 Flash).
  2. The agent starts running through a multi-step turn (reading files, executing commands, etc.).
  3. During the turn, a momentary network blip occurs (e.g. Wi-Fi reconnect, brief DNS resolution hiccup, or upstream connection reset from Google's API).
  4. Instead of retrying or waiting for the connection to recover, the agent turn immediately crashes with a raw error message: Agent execution error: model unreachable: Error 502, Message: Bad Gateway: Failed to connect to backend API...
  5. If you send "continue" right after, the agent immediately resumes and works normally, showing the outage was only temporary.

Expected behavior

  • Automatic retry on transient network drops: A brief network disconnection (HTTP 502, connection reset, or SSL EOF) between the local Antigravity ACP proxy and Google's backend should be treated as a retryable transient error with exponential backoff.
  • Resilient turns: The agent turn shouldn't terminate prematurely while running tools just because an API call blipped for a few seconds.
  • Clean user feedback: If retries are exhausted, show a clear, friendly error banner or a "Retry turn" button rather than dumping raw Python/Go proxy error strings directly into the chat thread as an assistant message.

Actual behavior

When the local Antigravity process encounters a momentary disconnect to Google's backend:

  1. Active tool calls fail: The in-flight tool steps fail with: Encountered retryable error from model provider: Agent execution terminated due to error ("request failed (code 502): Bad Gateway: Failed to connect to backend API")
  2. Turn immediately halts: The local ACP process surfaces the raw exception as an assistant message:
    Agent execution error: model unreachable: Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []
    request failed (code 502): Bad Gateway: Failed to connect to backend API: Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []
    request failed (code 502): Bad Gateway: Failed to connect to backend API
  3. No automatic recovery: The orchestration engine accepts this text as a completed turn, leaving the session stopped until the user manually types another prompt.

Impact

Blocks work completely

Version or commit

v0.0.46 / main (latest nightlies)

Environment

Linux x86_64, T3 Code Desktop, Provider: Google Antigravity (ACP) / Gemini 3.8 Flash

Logs or stack traces

### Summary for maintainers & agents

The Antigravity ACP daemon (`agy_acp_server.par`) runs a local proxy that connects to Google's Cloud Code Partner API (CCPA). When the upstream connection resets, `proxy_server.py` returns HTTP 502, which bubbles up as `AntigravityExecutionError`. In T3 Code's `AcpAdapterV2.ts`, this is currently received as a completed turn with text content instead of a retryable transport failure.

<details>
<summary>Click to view daemon stack trace (~/.t3/userdata/antigravity-tmp/.../agy_acp_server.par.*.log.ERROR)</summary>


E1005 12:00:43.980732 proxy_server.py:222] Proxy failed to connect to CCPA API: Network connection failed to CCPA API: [Errno 104] Connection reset by peer
Traceback (most recent call last):
  ...
  File "/<embedded stdlib>/ssl.py", line 1232, in send
    return self._sslobj.write(data)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:
...
urllib.error.URLError: <urlopen error [Errno 104] Connection reset by peer>
...
CCPAConnectionError: Network connection failed to CCPA API: [Errno 104] Connection reset by peer

E1005 12:01:44.397322 proxy_server.py:222] Proxy failed to connect to CCPA API: Network connection failed to CCPA API: EOF occurred in violation of protocol (_ssl.c:1104)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1104)

E1005 12:01:57.796780 proxy_server.py:222] Proxy failed to connect to CCPA API: Network connection failed to CCPA API: [Errno -3] Temporary failure in name resolution
socket.gaierror: [Errno -3] Temporary failure in name resolution

E1005 12:01:57.827874 server.py:4459] Antigravity SDK error processing prompt for session d39a6ecf-6f97-4857-a87e-9b977367edad
google.antigravity.types.AntigravityExecutionError: model unreachable: Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []
request failed (code 502): Bad Gateway: Failed to connect to backend API: Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []
request failed (code 502): Bad Gateway: Failed to connect to backend API


</details>

<details>
<summary>Click to view orchestration turn items (statev2.sqlite)</summary>

* **Ordinals `1000229`, `1000230`, `1000234` (`dynamic_tool`, status: `failed`)**:
  `"output": "Encountered retryable error from model provider: Agent execution terminated due to error. (\"request failed (code 502): Bad Gateway: Failed to connect to backend API\")"`
* **Ordinal `1000235` (`assistant_message`, status: `completed`)**:
  `"text": "Agent execution error: model unreachable: Error 502, Message: Bad Gateway: Failed to connect to backend API..."`

</details>

### Relevant files in repo
- `apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.ts`
- `apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts`
- `apps/server/src/provider/acp/AntigravityAcpSupport.ts`

Screenshots, recordings, or supporting files

No response

Workaround

Send a new message in the composer (such as "continue"). Once the brief network blip passes, the session continues fine without needing to restart the app or server.

  1. nathnael-desta(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. zadtem(GitHub profile, opens in a new tab)commented

    I am experiencing this too, a lot. macos 27

  3. juliusmarminge added labelsneeds more info

  4. juliusmarminge removed labelsneeds more info

  5. the issue is still happening

    Live Reproduction & Trace Evidence

    Following up on the triage request with verified runtime versions and live reproduction trace data from Linux x86_64:

    1. Versions & Environment

    • T3 Code Version: 0.1.2-nightly.20261021.3457 (Linux x86_64 AppImage)
    • Managed Antigravity ACP Version: agy_acp_server_1.1.1 (Build ID: 61dd43a0-bfda-45ac-ac73-c3c35923da9f, embedded Python 3.14.5)
    • Active Model: gemini-3.8-flash-medium

    2. Live Reproduction Trace

    During active tool execution, the local ACP proxy server intermittently encounters upstream connection resets to Google's CCPA API:

    E1022 11:27:01.314080 301328 proxy_server.py:222] Proxy failed to connect to CCPA API: Network connection failed to CCPA API: [Errno 104] Connection reset by peer
    Traceback (most recent call last):
      File "/<embedded stdlib>/ssl.py", line 1232, in send
        return self._sslobj.write(data)
    ConnectionResetError: [Errno 104] Connection reset by peer
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "agy_acp_server.par/.../ccpa_connection/ccpa_client.py", line 173, in stream_generate_content
        res = urllib.request.urlopen(req, timeout=_DEFAULT_TIMEOUT_SECONDS)
      ...
      File "agy_acp_server.par/.../ccpa_connection/proxy_server.py", line 120, in do_POST
        status, resp_headers, body_iter = ccpa_client.stream_generate_content(...)
    google3.cloud.developer_experience.antigravity_extensions.acp_server.ccpa_connection.ccpa_client.CCPAConnectionError: Network connection failed to CCPA API: [Errno 104] Connection reset by peer
    
  6. #33596, now on main: The reported HTTP 502 error-step format now produces a retryable provider failure carrying the real gateway message, including when a silent prompt reaches the inactivity watchdog.

    Not done: The issue still requests automatic recovery with exponential backoff and resilient turns; this merge still fails the turn and requires a new message to continue.

    Closing; open a new issue if what is left still matters to you.

  7. juliusmarminge closed this

Sign in to join this conversation.