Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Antigravity ACP threads invalidate each other's OAuth remote MCP sessions (Unauthorized: rejected by transport) #42581

Openmgilbertnz(GitHub profile, opens in a new tab) opened this issue 0 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/server

Steps to reproduce

  1. Configure an OAuth-authenticated remote HTTP MCP server for the Antigravity provider (e.g. Atlassian Cloud MCP in mcp_config.json: {"mcpServers":{"atlassian":{"url":"https://mcp.atlassian.com/v2/mcp"}}}).
  2. Ensure mcp_oauth_tokens.json is populated under ~/.t3/userdata/providers/antigravity/<id>/antigravity-acp/ (e.g. symlinked from ~/.gemini/antigravity-cli/mcp_oauth_tokens.json, since T3 spawns antigravity acp with an isolated --gemini-dir and --app-data-dir).
  3. Start Thread A (Antigravity) and invoke an Atlassian MCP tool — succeeds.
  4. While Thread A stays open, open or resume Thread B (and/or Thread C), which spawns additional antigravity acp processes sharing the same --gemini-dir / --app-data-dir and mcp_oauth_tokens.json.
  5. Wait ~10–15 minutes (past Atlassian's grace window for superseded tokens) and invoke an Atlassian MCP tool again in Thread A.

Expected behavior

  • Thread A continues to be able to call Atlassian MCP tools while a valid OAuth token exists (the token on disk has an 8-hour lifetime, expires_in: 28800).
  • Opening additional Antigravity threads does not rotate/invalidate OAuth MCP sessions for already-running threads.

Actual behavior

Active threads intermittently lose remote OAuth MCP access mid-session with:

calling "tools/call": sending "tools/call": Unauthorized: rejected by transport

Even though the symlink is intact and mcp_oauth_tokens.json on disk holds a valid, unexpired token (~7.5 hours remaining):

  1. Every new antigravity acp startup forces an OAuth refresh: connector.go:240 logs Connection with stored token failed for atlassian. Attempting refresh before removing... followed by connector.go:258] Successfully refreshed token for atlassian on every process launch (observed 10/10 times over ~4 hours, including launches only 1m43s apart).
  2. Token rotation breaks already-running threads: Each startup refresh rotates Atlassian's OAuth token pair and writes the new token to the shared mcp_oauth_tokens.json. Already-running antigravity acp processes keep the older access token in memory and never reload mcp_oauth_tokens.json from disk on a 401. Once Atlassian's brief grace window (~10–15 min) lapses, all subsequent MCP calls in older threads fail permanently until restarted.
  3. Secondary failure mode (concurrent startup race): If two threads start simultaneously and race on Atlassian's single-use refresh token, the losing process hits connector.go:240 ("Attempting refresh before removing...") and can remove the token from mcp_oauth_tokens.json, forcing a full re-login.

Root cause / split responsibility:

  • T3 Code side: Spawns one antigravity acp process per thread pointing at the same --app-data-dir, so multiple independent ACP processes concurrently read/write a shared mcp_oauth_tokens.json without coordination (and T3 does not yet proxy/centrally manage OAuth remote MCP connections across Antigravity threads).
  • Antigravity ACP side: connector.go forces a token refresh on every startup even when the stored token was refreshed moments earlier, and active sessions do not re-read mcp_oauth_tokens.json from disk (with locking) on 401.

Related issues: #36111, #40284, #38223 (similar stale in-memory vs. on-disk MCP OAuth state issue on Cursor).

Impact

Major degradation or frequent failure

Version or commit

0.1.11 (Desktop, Linux x64) / Antigravity ACP Server 1.5.16

Environment

Fedora Linux 44 (KDE Plasma Desktop Edition, kernel 7.2.13-200.fc44.x86_64), T3 Code Desktop 0.1.11, Antigravity ACP Server 1.5.16, Atlassian remote MCP (https://mcp.atlassian.com/v2/mcp)

Logs or stack traces

# Multiple antigravity acp processes running concurrently for the same --app-data-dir:
1193400 14:33:50 antigravity acp --gemini-dir ~/.t3/userdata/providers/antigravity/<id> --app-data-dir antigravity-acp  (Thread A)
1404116 15:21:06 antigravity acp --gemini-dir ~/.t3/userdata/providers/antigravity/<id> --app-data-dir antigravity-acp  (Thread B)
1408283 15:22:49 antigravity acp --gemini-dir ~/.t3/userdata/providers/antigravity/<id> --app-data-dir antigravity-acp  (Thread C)

# Every process startup forces a refresh (10/10 starts in ~4h):
acp-server-...-1193400.log:
I1125 14:33:51.248166  connector.go:240] Connection with stored token failed for atlassian. Attempting refresh before removing...
I1125 14:33:51.641132  connector.go:258] Successfully refreshed token for atlassian

acp-server-...-1404116.log:
I1125 15:21:07.519338  connector.go:240] Connection with stored token failed for atlassian. Attempting refresh before removing...
I1125 15:21:07.901712  connector.go:258] Successfully refreshed token for atlassian

acp-server-...-1408283.log:
I1125 15:22:50.498717  connector.go:240] Connection with stored token failed for atlassian. Attempting refresh before removing...
I1125 15:22:51.149491  connector.go:258] Successfully refreshed token for atlassian

# Thread A (PID 1193400) MCP tool calls after Thread C rotated the token at 15:22:51:
# 15:28:18 -> succeeded (within grace window)
# 15:37:58 -> failed:
calling "tools/call": sending "tools/call": Unauthorized: rejected by transport

# Meanwhile mcp_oauth_tokens.json on disk is intact and unexpired (mtime 15:22:51):
{
  "https://mcp.atlassian.com/v2/mcp": {
    "client_id": "https://antigravity.google/oauth/client-metadata.json",
    "token": {
      "access_token": "<REDACTED>",
      "token_type": "Bearer",
      "refresh_token": "<REDACTED>",
      "expiry": "2026-11-25T23:22:51.149067141+13:00",
      "expires_in": 28800
    },
    "auth_style": 1
  }
}

Screenshots, recordings, or supporting files

No response

Workaround

  • Avoid opening additional Antigravity threads (or launching agy CLI) while a thread is actively using an OAuth remote MCP server.
  • When an older thread hits Unauthorized: rejected by transport, starting a fresh thread/session picks up the valid token already on disk without needing to re-authenticate in the browser.

Sign in to join this conversation.