[Bug]: Antigravity: concurrent agy acp processes share one app-data dir and resume each other's live conversations (expected tool step at index N) #48159
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
Summary#
T3 starts a separate agy acp process for each Antigravity session, and every one of them uses the same --gemini-dir / --app-data-dir. When a new process starts, it treats conversations that are still running in another process as "interrupted by server restart". It resumes them: it adds a system message and runs a new planner turn. If the original process has a tool call in flight at that moment, both processes write to the same step index. The original process then stops the turn:
agent executor error: expected tool step at index 2382, got CORTEX_STEP_TYPE_PLANNER_RESPONSE
In the UI this shows as "Provider error — Antigravity stopped this turn because of an error."
Steps to reproduce#
- Start a long-running Antigravity thread in T3 and let it make a slow tool call. A T3 MCP tool such as
delegate_taskthat takes 20–30 s works well. - While that call is in flight, start another Antigravity session on the same provider instance, for example a new thread or a delegated child on Antigravity.
- The first thread fails with
expected tool step at index N, got CORTEX_STEP_TYPE_PLANNER_RESPONSE. In one case the step wasCORTEX_STEP_TYPE_USER_INPUT.
The error happened 5 times in 6 days. Each time it lined up, to the second, with the start of a new acp-server-*.log.
Expected behavior#
Starting a new Antigravity session does not touch conversations that another agy acp process is still serving; the running turn completes normally.
Actual behavior#
The newly started process resumes the live conversation, its steps collide with the in-flight tool step, and the original turn is stopped with a provider error.
Impact#
Long-running Antigravity threads (orchestrators that delegate work) get their turn killed whenever another Antigravity session starts on the same provider instance. Background tasks of that conversation are reported as stopped.
Version or commit#
T3 Code Nightly 0.1.14-nightly.20261202.5624; Antigravity CLI (agy) 1.5.20
Environment#
macOS 27.3, Apple Silicon. Antigravity provider launched by T3 over ACP.
Logs or stack traces#
Process list. Both processes come from the same T3 server and use the same directories:
agy acp --gemini-dir <userdata>/providers/antigravity/<profile> --app-data-dir antigravity-acp
agy acp --gemini-dir <userdata>/providers/antigravity/<profile> --app-data-dir antigravity-acp
Log of the newly started process:
13:40:26 Starting ACP server (pid …, worker=false)
13:40:27 Resuming 2 conversation(s) interrupted by server restart
13:40:27 ACP Request received: session/new
Log of the original process, which owns the conversation:
13:41:03 Tool confirmation for conversation <A> step 2381 (Step_Generic approved=true)
13:41:03 agent executor error: expected tool step at index 2382, got CORTEX_STEP_TYPE_PLANNER_RESPONSE
Conversation <A> transcript (brain/<A>/.system_generated/logs/transcript_full.jsonl). The step indices are duplicated:
2380 PLANNER_RESPONSE 09:40:04 tool_calls: [mcp_t3-code_tool_call]
2381 SYSTEM_MESSAGE 09:40:27 "[Notice] All your background tasks have been stopped due to server restart. ..."
2381 GENERIC 09:40:37 (result of the 2380 tool call, completed 09:41:03)
2382 PLANNER_RESPONSE 09:40:27 (turn started by the other process)
The same pattern, a "server restart" notice injected while a tool is in flight followed by an index collision, appears in all 5 occurrences.
Root cause (as far as I can tell)#
buildAntigravityAcpSpawnInput always builds:
args: ["acp", "--gemini-dir", profile.geminiHome, "--app-data-dir", "antigravity-acp"]
One process per session, all on the same app-data dir. Each process assumes it is the only owner of that directory, so on startup it "recovers" conversations that are still being served by a sibling.
Possible fixes#
- Run one front
agy acpper provider profile with--process-per-session(agy acp --help: "Serve each session from an isolated worker process") and multiplex sessions viasession/new/session/loadinstead of starting a new process per session. I haven't checked whether this mode skips resuming conversations owned by other workers. - Or give each process its own
--app-data-dir, so sessions don't share conversation state.session/loadwould have to keep a thread on its own dir. - At minimum, serialize starts or take a lock on the app-data dir, so a second process doesn't resume conversations that are still live.
Workaround#
Run the long-lived thread on a separate Antigravity provider instance, so it gets its own profile dir, or on another provider.
🤖 Generated with Claude Code
tanstack-source added labelsbug
juliusmarminge closed this
Sign in to join this conversation.
This is the same problem as #43012, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.