Skip to content

[Bug]: Antigravity runtime restart runs session/load instead of session/resume, drops model configOptions, and permanently wedges the thread with "did not accept the model" #39917

Open

Description

@SwitchOCE

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

  1. Run T3 Code 0.1.11 on Windows with the managed Antigravity CLI runtime (agy 1.5.13) and select gemini-4-neon (High).
  2. Run a thread normally (cold resume via session/resume works fine).
  3. 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 sets runtimeRestartRequired = true).
  4. Send a follow-up message on the same thread (which runs restartRuntimeAfterTeardownIfRequired -> session/new -> activateSession -> session/load).
  5. Send another follow-up message on the same thread.

Expected behavior

  1. Restarting an Antigravity ACP runtime on an existing thread should honor Antigravity's configured resumeMethod: "resume" (session/resume), just like cold startup does in AcpSessionRuntime.startOnce.
  2. Even when session/load is used, adoptSession should not wipe valid configOptions populated by session/new to [] if the session/load response omits configOptions.
  3. A failed configureSession / applyModelSelection after activateSession should not leave activeSessionId committed on a wedged runtime so every subsequent turn fails immediately.

Actual behavior

  1. On the first follow-up after the teardown (Run 8), T3 Code spawns a fresh agy acp process without resumeSessionId (session/new succeeds with fieldCount: 5), then calls activateSession -> session/load (fieldCount: 4), ignoring Antigravity's resumeMethod: "resume".
  2. Immediately after session/load -> AcpSessionRuntime.adoptSession, applyAntigravityAcpModelSelection rejects gemini-4-neon locally in 0.2 ms without contacting agy:
    • 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.
  3. 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, or session/resume) and immediately fails again in 0.2–0.6 ms with the exact same error.
  4. Opening a brand-new thread 30 seconds later with the same Google account and gemini-4-neon succeeds immediately (session/new without session/load).

Root cause analysis (verified against v0.1.11 @ 59651c1761 and main @ a1b9e1cc87)

Three things combine to permanently wedge the thread:

  1. AcpAdapterV2.activateSession ignores resumeMethod: "resume" (packages/provider-acp/src/server/adapter.ts:7976-7979):

    • makeAntigravityAcpRuntime sets resumeMethod: "resume" (apps/server/src/provider/acp/AntigravityAcpSupport.ts:240).
    • Cold session start (AcpSessionRuntime.startOnce, packages/provider-acp/src/server/AcpSessionRuntime.ts:2421-2444) respects options.resumeMethod !== "resume" and calls session/resume — in the same thread, an earlier cold resume (Run 4) called session/resume and succeeded.
    • However, activateSession (used after restartRuntimeAfterTeardownIfRequired, which spawns a replacement runtime without resumeSessionId) hardcodes canLoadSession ? runtime.loadSession(...) : canResumeSession ? runtime.resumeSession(...) : ..., forcing session/new followed by session/load.
  2. AcpSessionRuntime.adoptSession wipes configOptionsRef when a real session/load omits configOptions (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/load returns a non-synthetic response without configOptions (or with an incomplete model list), adoptSession overwrites configOptionsRef (which session/new had just populated ~120 ms earlier) with []. applyAntigravityAcpModelSelection (apps/server/src/provider/acp/AntigravityAcpSupport.ts:546-561) then checks antigravityModelOptions(configOptions) and fails locally with AcpRequestError.invalidParams.

  3. Failed configureSession leaves the wedged runtime active (packages/provider-acp/src/server/adapter.ts:9211-9217):
    startTurnUnlocked sets activeSessionId and activeSessionSetup before calling configureSession. When configureSession fails with AcpModelSelectionError, activeSessionId remains equal to requestedSessionId and runtimeRestartRequired remains false, so every subsequent turn skips activateSession and immediately hits the same empty/stale configOptionsRef in < 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions