t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug] Antigravity sessions start their prompt before profile MCP servers load, so the model never gets their tools

Open daviesayo opened this issue 1 week ago • 6 comments

Filed by Claude Opus 5.5 on behalf of Davies.

What happened

An Antigravity thread does not get the tools of a remote HTTP MCP server that is configured in the Antigravity provider profile. agy connects to the server, refreshes its OAuth token and writes its tool schemas, but the model has only t3-code tools.

T3 sends session/prompt about 0.16 s after session/new on a freshly started agy process. agy waits only for the servers in the session's mcpServers list before it serves the prompt. A config server that finishes loading after the prompt starts is missing from every model call in that turn.

Delegated threads hit this on every turn, because T3 stops a finished delegate's agy process and the next turn starts a new one.

Diagnosis

  1. agy preloads only the servers listed in the session. It logs Preloading 1 MCP servers of the session (just t3-code) and then serves session/prompt. Config servers load in the background. A prompt sent after they load gets their tools.
  2. T3 lists only t3-code in mcpServers (acpMcpContext, sessionMcpServers). agy 1.5.x advertises no mcpCapabilities, so T3 sends the stdio bridge form.
  3. T3 detaches a finished delegate's provider session (releaseFinishedDelegateSessions). agy gets SIGTERM about 150 ms after the turn ends, and the next turn resumes the session in a new process. Ordinary threads keep the process for the 30-minute idle timeout.

Possible fixes:

  • T3 waits for agy's config MCP servers before the first session/prompt on a new process.
  • T3 passes the profile's configured servers in mcpServers, so agy preloads them. This fits stdio servers only, because agy 1.5.x advertises stdio MCP alone.
  • agy waits for config servers on session/new and session/resume, or adds late servers between model calls.

Steps to reproduce

Direct ACP:

  1. Add one remote HTTP MCP server with stored OAuth tokens to the MCP config of a scratch GEMINI_HOME.
  2. Start agy acp --gemini-dir <home> --app-data-dir antigravity-acp.
  3. Send initialize, authenticate (oauth-personal), then session/new with mcpServers: [].
  4. Send session/prompt at once, asking the model to name every MCP server whose tools it has.
  5. Repeat with a 10 s wait between session/new and session/prompt.

In T3:

  1. Add the same server to the Antigravity provider profile's MCP config.
  2. Start a delegated Antigravity task that calls a tool on that server.
  3. Send a follow-up to the delegated thread.

Expected: the server's tools are available from the first model call of every turn.

Actual: the tools are missing whenever the server finishes loading after session/prompt. Both delegated turns ran with t3-code tools only.

Version

  • T3 Code (Nightly) 0.1.12-nightly.20261121.5024 (6357d17a). The code path is the same on main at d5f8a75.
  • agy 1.5.9 in the T3 turns, and 1.5.13 in the direct ACP runs.

Environment

macOS arm64, desktop app with a local server, Antigravity with oauth-personal sign-in.

Evidence

Direct ACP, agy 1.5.13. The answer is the model's report of which MCP servers it can see:

Delay from session/new to session/prompt Runs Model saw the config server
0 s 5 3 of 5
10 s 1 1 of 1

In one miss, the token refresh finished 0.11 s before session/new, and the prompt still lacked the tools. The window covers tool listing after connect as well as the OAuth refresh.

Delegated turn 2, agy 1.5.9, in a new process after the turn-1 detach. Times are seconds from the first line:

+0.000  connector.go:237] Connection with stored token failed for remote. Attempting refresh before removing...
+1.457  server.go:988]  ACP Request received: session/resume
+1.457  server.go:1568] Preloading 1 MCP servers of the session
+1.622  server.go:988]  ACP Request received: session/prompt
+1.943  connector.go:255] Successfully refreshed token for remote
...
+45.386 server.go:1323] Stream goroutine exited for <session>, sending completion signal
+45.529 server.go:4348] Got signal terminated, shutting down

Turn 1 shows the same order. In the server trace, each turn ends with Orchestrator.releaseFinishedDelegateSessions and then orchestrationV2.dispatch.providerSessionDetach.

Related issues

  • #13117: forward user MCP servers to ACP sessions. Its profile-config workaround hits this race.
  • #37423: the profile does not inherit the user's Antigravity MCP config. It was closed as a feature request, and this report covers servers already in the profile.
  • #36111: an OAuth-only remote server in the profile aborted every turn. Since the fix, the server connects and its tools arrive after the prompt.
  • #39886: Antigravity swarm workers are killed when a delegated turn ends, through the same teardown path.

Fix applied or workaround

In an ordinary (non-delegated) Antigravity thread, send a second message when the first turn lacks the tools. That thread keeps its agy process between turns, and a prompt sent after the server loads gets its tools.

Filed by

Claude Opus 5.5 (claude-opus-5-5) in Claude Code, following the T3 Code triage playbook.

daviesayo avatar Nov 21 '26 11:11 daviesayo

Still reproduces on 0.1.12-nightly.20261122.5071 (047fb5b). main at f9b19a7 has no commits touching packages/provider-acp, AntigravityDriver.ts or antigravityAuthSupport.ts since that tag.

Two additions to the report:

  1. Ordinary threads miss on their first turn too, not only delegates. A fresh Antigravity thread asked to call the configured server; its agy log shows the same order:

    15:36:02.586  ACP Request received: session/new
    15:36:02.586  Preloading 1 MCP servers of the session
    15:36:02.754  ACP Request received: session/prompt
    

    The model answered that only t3-code was loaded. Two delegated probes on the same build showed session/prompt 0.19 s after session/new, and their shutdown lines name the config server (Failed to close MCP instance "executor"), so it was running but never reached the model.

  2. A stdio server in the profile's mcp_config.json loses the race as well. The server here is npx -y [email protected] <remote-url>, which takes seconds to spawn, so it misses every first turn. Passing the profile's stdio servers in session/new mcpServers (the second proposed fix) would cover this case.

Workaround confirmed: in that same ordinary thread, a second message about five minutes later got the server's tools and its search call succeeded, because the agy process stayed alive between turns.

Added by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, following the T3 Code triage playbook.

daviesayo avatar Nov 22 '26 04:11 daviesayo

Still reproduces on 0.1.12-nightly.20261122.5085 with agy 1.5.14. Three additions:

1. A local HTTP server loses the race too. The server is figma-console-mcp on http://127.0.0.1:9300/mcp (Streamable HTTP, no auth), in the profile's config/mcp_config.json. Each run was a new delegated thread, so a new agy process:

Run Schemas written Cascade created Model got the tools
1 01:08:14.61 01:08:14.51 no (0.10 s late)
2 — 01:08:47.35 no
3 01:09:02.88 01:09:03.95 yes

Over all runs with this entry alone, it reached the model in 2 of 5. "Schemas written" is the mtime of antigravity-acp/mcp/<server>/*.json. "Cascade created" is the Creating new cascade trajectory log line.

2. Antigravity hooks cannot work around it. The profile's config/hooks.json is read in ACP mode. I added a hook that waits until the server's schemas are written. Both events start after the turn's tools are fixed:

Event Cascade created Hook started
PreInvocation 01:24:27.860 01:24:27.950
SessionStart 01:25:49.548 01:25:49.630

The PreInvocation run did not get the tools, although the schemas were written at 01:24:27.983, before any model call. The SessionStart run got them only because the server loaded first (01:25:48.72).

3. Per-tool settings in the profile config work when the race is won. With enabledTools (19 tools), tools.<name>.eager (3 tools) and timeoutSeconds: 300, a winning run showed exactly the 3 eager tools as mcp_<server>_<tool>, and a direct call worked. session/new mcpServers entries cannot carry these settings. So the first proposed fix (T3 waits for the config servers before the first session/prompt) keeps them, and the second (pass the servers in mcpServers) would lose them.

Also: the workspace .agents/mcp_config.json is not read in ACP mode. The log shows workspaceDirs=[], and the same entry there never reached the model. The standalone CLI in the same folder loads it (workspaceDirs=[<repo>]).

Added by Claude Opus 5.5 (claude-opus-5-5) in Claude Code.

johanpaolorodriguez avatar Nov 22 '26 17:11 johanpaolorodriguez

[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of mralbertchen

On agy 1.5.16 the profile servers do not load late. They do not load at all, so the second-message workaround no longer helps. This happens with a plain stdio server too, and with the standalone CLI outside T3.

Setup: T3 Code 0.1.12-nightly.20261124.5178, managed agy 1.5.16 (release 3dee9f26…), Linux x86_64, oauth-personal sign-in. The profile's config/mcp_config.json has one remote Streamable HTTP server with OAuth and no stored token:

{ "mcpServers": { "remote": { "serverUrl": "https://<host>/mcp" } } }

What I saw:

  1. The ordinary-thread workaround fails. In a non-delegated Antigravity thread, a third message about 8 minutes after the first one, in the same agy process, still had only t3-code tools. The process log for all three turns has Preloading 1 MCP servers of the session and no line at all that names the config server. There is no connect, OAuth, sign-in or error line for it.

  2. The global config gives the same result. With the same entry in ~/.gemini/config/mcp_config.json as well, a new thread still had only t3-code.

  3. The standalone CLI loads nothing either. I added a stdio probe to the global config next to the remote server:

    { "mcpServers": {
        "probe-stdio": { "command": "/bin/false" },
        "remote": { "url": "https://<host>/mcp" } } }
    

    agy mcp list shows both as enabled. Then agy -p "Name every MCP server whose tools you have." answers that it has no MCP tools. cli.log has no line for either server, not even a failed spawn of /bin/false. The only MCP line, in every run, comes before sign-in finishes:

    rpcs_plugin_auth.go:110] Not reloading plugin MCP servers: cannot get the signed-in user: error getting token source: You are not logged into Antigravity.
    

The earlier reports on this issue used 1.5.9–1.5.14, and there the config server connected. On 1.5.16 here, agy seems to skip config MCP servers completely, perhaps because it reads the config before authentication and does not read it again. PR #40300 lists the profile servers in session/new, so it may avoid this path. I have not tested it.

mralbertchen avatar Nov 24 '26 07:11 mralbertchen

[!NOTE] 🤖 Gemini 4 Neon responding on behalf of Mr-Neutr0n

We are hitting this same Turn-1 race on T3 Code 0.1.11 + agy 1.5.16 (macOS arm64, oauth-personal), with one extra case that PR #40300 looks likely to miss: workspace plugin MCP servers (.agents/plugins/<name>/mcp_config.json).

Observed behavior on agy 1.5.16:

  • Unlike profile config/mcp_config.json in the comment above, a stdio workspace plugin (.agents/plugins/linear/mcp_config.json running npx -y mcp-remote https://mcp.linear.app/mcp) does still start and connect on agy 1.5.16.
  • However, session/new still logs Preloading 1 MCP servers of the session (t3-code only) and session/prompt fires ~130 ms later:
    • +0.000s: ACP Request received: session/new / Preloading 1 MCP servers of the session
    • +0.130s: ACP Request received: session/prompt
    • ~+1.0s: mcp-remote finishes connecting and writes antigravity-acp/mcp/linear_linear/*.json
  • Across all our Antigravity threads, 0% of Turn-1 runs on a fresh agy process received the plugin's tools. Turn 2+ in the same warm process gets all 71 tools reliably.

Looking forward to a fix. Since PR #40300 currently reads only config/mcp_config.json, forwarding or waiting on workspace plugin MCP configs as well (so project-scoped servers do not have to be configured globally) would cover this case too.

Mr-Neutr0n avatar Nov 24 '26 16:11 Mr-Neutr0n

🤖 Gemini 4 Hydrogen responding on behalf of Dodhon

+1 — reproducing this on Windows x64:

  • Version: T3 Code 0.1.12-nightly.20261124.5191, agy 1.5.13
  • Setup: Remote OAuth HTTP server (robinhood-trading, serverUrl: https://agent.robinhood.com/mcp/trading) configured in the isolated Antigravity profile config/mcp_config.json
  • Observed: session/new logs Preloading 1 MCP servers of the session (t3-code only), followed ~352 ms later by session/prompt (13:51:48.914 → 13:51:49.266). Only t3-code tools are exposed to the model; robinhood-trading is missing.

Tracking #40300 for the fix.

Dodhon avatar Nov 26 '26 19:11 Dodhon

Same race on workspace MCP config, which #40300 does not cover.

Setup: T3 Code 0.1.14-nightly.20261201.5564, managed agy 1.5.17, macOS arm64, gemini-api-key auth. The profile's config/mcp_config.json is empty. The only extra server is a remote Streamable HTTP server (no auth) in the workspace file <workspace>/.agents/mcp_config.json (Antigravity's documented workspace config):

{ "mcpServers": { "docs": { "url": "https://<host>/mcp" } } }

Observed: a delegated Antigravity thread whose cwd is that workspace. agy log and the tool schemas it writes under antigravity-acp/mcp/<server>/:

20:00:36.517  ACP Request received: session/new
20:00:36.517  Preloading 1 MCP servers of the session      (t3-code only)
20:00:36.678  ACP Request received: session/prompt
20:00:36.881  mcp/<server>/*.json written                  (workspace server connected, 0.2 s after the prompt)

The model lists only t3-code tools and cannot call the workspace server's tools. It reproduces on every delegated turn (three of three runs today), because each turn starts a new agy process.

So agy does read the workspace config and connects successfully, but too late. #40300 lists only servers from the profile's config/mcp_config.json in mcpServers, so workspace servers would still miss the first model call. Either T3 waits for agy's config servers before the first session/prompt (the first option in the report), or the list it sends should also include <cwd>/.agents/mcp_config.json.

ondraondra81 avatar Dec 01 '26 19:12 ondraondra81