Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
(Related but distinct: #35693 / PR #36804 cover long-lived sessions rejecting a newly discovered model due to stale cached configOptions; PR #21438 touches activateSession honoring resumeMethod; #39864 covers the upstream 404 that triggered the restart; #39866 covers mid-turn runtimeMode switches not taking effect during an active turn. None cover activateSession + adoptSession wiping configOptionsRef on mid-session restart and permanently wedging subsequent turns.)
Area
apps/server
Steps to reproduce
- Run T3 Code
0.1.11on Windows with the managed Antigravity CLI runtime (agy1.5.13) and selectgemini-4-neon(High). - Run a thread normally (cold resume via
session/resumeworks fine). - Trigger a mid-session ACP runtime restart on that thread (e.g. a turn hits a provider error such as
NOT_FOUND (code 404)or another teardown condition that setsruntimeRestartRequired = true). - Send a follow-up message on the same thread (which runs
restartRuntimeAfterTeardownIfRequired->session/new->activateSession->session/load). - Send another follow-up message on the same thread.
Expected behavior
- Restarting an Antigravity ACP runtime on an existing thread should honor Antigravity's configured
resumeMethod: "resume"(session/resume), just like cold startup does inAcpSessionRuntime.startOnce. - Even when
session/loadis used,adoptSessionshould not wipe validconfigOptionspopulated bysession/newto[]if thesession/loadresponse omitsconfigOptions. - A failed
configureSession/applyModelSelectionafteractivateSessionshould not leaveactiveSessionIdcommitted on a wedged runtime so every subsequent turn fails immediately.
Actual behavior
- On the first follow-up after the teardown (Run 8), T3 Code spawns a fresh
agy acpprocess withoutresumeSessionId(session/newsucceeds withfieldCount: 5), then callsactivateSession->session/load(fieldCount: 4), ignoring Antigravity'sresumeMethod: "resume". - Immediately after
session/load->AcpSessionRuntime.adoptSession,applyAntigravityAcpModelSelectionrejectsgemini-4-neonlocally in 0.2 ms without contactingagy:- Server trace cause:
AcpRequestError (-32602): Antigravity model 'gemini-4-neon' is unavailable for this Google account. Select an available model. - UI error:
The agent did not accept the model "gemini-4-neon". Choose another model for this provider, then retry.
- Server trace cause:
- On subsequent messages on the same thread (Run 9, sent 3.5 minutes later), T3 Code reuses the same wedged ACP runtime (no new
session/new,session/load, orsession/resume) and immediately fails again in 0.2–0.6 ms with the exact same error. - Opening a brand-new thread 30 seconds later with the same Google account and
gemini-4-neonsucceeds immediately (session/newwithoutsession/load).
Root cause analysis (verified against v0.1.11 @ 59651c1761 and main @ a1b9e1cc87)
Three things combine to permanently wedge the thread:
-
AcpAdapterV2.activateSessionignoresresumeMethod: "resume"(packages/provider-acp/src/server/adapter.ts:7976-7979):makeAntigravityAcpRuntimesetsresumeMethod: "resume"(apps/server/src/provider/acp/AntigravityAcpSupport.ts:240).- Cold session start (
AcpSessionRuntime.startOnce,packages/provider-acp/src/server/AcpSessionRuntime.ts:2421-2444) respectsoptions.resumeMethod !== "resume"and callssession/resume— in the same thread, an earlier cold resume (Run 4) calledsession/resumeand succeeded. - However,
activateSession(used afterrestartRuntimeAfterTeardownIfRequired, which spawns a replacement runtime withoutresumeSessionId) hardcodescanLoadSession ? runtime.loadSession(...) : canResumeSession ? runtime.resumeSession(...) : ..., forcingsession/newfollowed bysession/load.
-
AcpSessionRuntime.adoptSessionwipesconfigOptionsRefwhen a realsession/loadomitsconfigOptions(packages/provider-acp/src/server/AcpSessionRuntime.ts:1985-1998):if ( sessionSetupResult.configOptions !== undefined && sessionSetupResult.configOptions !== null ) { yield* SubscriptionRef.set(configOptionsRef, sessionConfigOptionsFromSetup(sessionSetupResult)); } else if (!syntheticReplayIdle) { yield* SubscriptionRef.set(configOptionsRef, sessionConfigOptionsFromSetup(sessionSetupResult)); }
When
session/loadreturns a non-synthetic response withoutconfigOptions(or with an incomplete model list),adoptSessionoverwritesconfigOptionsRef(whichsession/newhad just populated ~120 ms earlier) with[].applyAntigravityAcpModelSelection(apps/server/src/provider/acp/AntigravityAcpSupport.ts:546-561) then checksantigravityModelOptions(configOptions)and fails locally withAcpRequestError.invalidParams. -
Failed
configureSessionleaves the wedged runtime active (packages/provider-acp/src/server/adapter.ts:9211-9217):
startTurnUnlockedsetsactiveSessionIdandactiveSessionSetupbefore callingconfigureSession. WhenconfigureSessionfails withAcpModelSelectionError,activeSessionIdremains equal torequestedSessionIdandruntimeRestartRequiredremainsfalse, so every subsequent turn skipsactivateSessionand immediately hits the same empty/staleconfigOptionsRefin < 1 ms.
Impact
Major degradation or frequent failure
Version or commit
0.1.11 (59651c1761); also present on main @ a1b9e1cc87
Environment
Windows x64, T3 Code Desktop 0.1.11, managed Antigravity CLI 1.5.13 (oauth-personal), model gemini-4-neon (High)
Logs or stack traces
Native ACP request sequence on the affected thread (events.<threadId>.log):
# Run 4 (cold open -> honors resumeMethod: "resume" -> SUCCEEDS)
21:17:26.903Z session/resume started (fieldCount: 4)
21:17:27.244Z session/resume succeeded (fieldCount: 4)
21:17:27.293Z session/prompt started -> succeeded (Runs 4, 5, 6 all succeed)
# Run 7 hits upstream NOT_FOUND (code 404) -> triggers runtime teardown/restart
21:23:04.425Z session/prompt started
21:23:05.858Z session/prompt succeeded (terminal failure: NOT_FOUND 404)
# Run 8 (mid-session restart -> session/new + session/load -> FAILS in 0.2ms)
21:23:18.994Z session/new started (fieldCount: 3)
21:23:19.281Z session/new succeeded (fieldCount: 5)
21:23:19.282Z session/load started (fieldCount: 4)
21:23:19.402Z session/load succeeded (fieldCount: 4)
# (no session/set_config_option or session/prompt ever sent)
Server trace spans (server.trace.ndjson, Run 8):
[119.3571ms] session/load -> Success
[0.1744ms] AcpSessionRuntime.adoptSession -> Success
[0.011ms] AcpSessionRuntime.followLateSessionLoad -> Success
[0.0082ms] AcpAdapterV2.validateModelSelection -> Success
[0.1974ms] applyAntigravityAcpModelSelection -> Failure
AcpRequestError: Antigravity model 'gemini-4-neon' is unavailable for this Google account. Select an available model.
[0.4678ms] AntigravityAdapterV2.applyModelSelection -> Failure
[1970.4091ms] AcpAdapterV2.startTurn -> Failure
ProviderAdapterTurnStartError -> [cause]: AcpModelSelectionError: The agent did not accept the model "gemini-4-neon". Choose another model for this provider, then retry.
Server trace spans (Run 9, 3.5 minutes later — reuses wedged runtime, fails in 0.6 ms):
[0.6333ms] AcpAdapterV2.startTurn -> Failure
ProviderAdapterTurnStartError ->
[cause]: AcpModelSelectionError: The agent did not accept the model "gemini-4-neon". Choose another model for this provider, then retry.
[cause]: AcpRequestError (-32602): Antigravity model 'gemini-4-neon' is unavailable for this Google account. Select an available model.
Workaround
Start a fresh thread (which opens with session/new without session/load and populates configOptions normally) or restart T3 Code so the existing thread cold-resumes via session/resume.
Activity