Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): first cold Antigravity turn no longer falls back from Auto to Supervised #40200

OpenVanceHud(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/40200/headopened View on GitHub

Problem

When a thread starts with runtimeMode: "auto" on a cold Antigravity instance (for example, on a fresh install, after an upgrade before any session has persisted modes, or after a restart on main), the first turn falls back to Supervised (approval-required) instead of running in Auto.

ProviderTurnStartService currently resolves RuntimePolicyV2 only once before providerSessions.open. Because AntigravityProvider initializes with RUNTIME_MODES_WITHOUT_AUTO and only discovers native auto support inside onSessionStarted during openSession, the pre-open policy downgrades "auto" to "approval-required" and reuses that stale fallback for the entire first turn—even though the session that just opened advertised auto.

This also applies in the reverse direction (if a stale snapshot advertised a mode the newly opened session no longer offers), and closes the cold/first-session gap that #40154 intentionally leaves open.

Change

  • Extracted resolveTurnRuntimePolicy in apps/server/src/orchestration-v2/ProviderTurnStartService.ts and re-resolved RuntimePolicyV2 after providerSessions.open succeeds (re-checking isCurrentAttemptInStatus("starting") and preserving existing ceiling-error handling).
  • Passed the post-open resolvedRuntimePolicy to ensureThread, resumeThread, forkThread, and runExecution.startRootRun. When the post-open runtimeMode differs from the mode configured during openSession, AcpAdapterV2.startTurn already detects the configuredRuntimeMode change and re-runs configureSession before sending the prompt.

Scope

Small, focused bug fix for a single server-side regression gap from #39378 (when Antigravity's Auto mode became session-discovered). Deliberately excludes restart-persistence changes already covered by #40154.

Verification

  • Added a regression test in apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts (re-resolves runtime policy after opening a session that discovers Auto support):
    • Before fix (on main): failed because startRootRun received runtimeMode: "approval-required" even after open updated policy resolution to "auto".
    • After fix: passed (open received "approval-required", startRootRun received "auto").
  • Ran vp run check:changed on this branch:
    • format: pass (0.2s)
    • lint: pass (0 warnings, 0 errors)
    • knip 1/2 & 2/2: pass
    • graphql (apps/server): pass
    • typecheck (3 packages): pass
    • test (2 files): 95/95 passed (including all 93 tests in ProviderTurnStartService.test.ts)
  • Runtime check running makeAntigravityProvider + RuntimePolicy.layerFromProjectStore across onSessionStarted advertising availableModes: ["default", "auto"]:
    before openSession: {"supported":["approval-required","auto-accept-edits","full-access"],"resolvedRuntimeMode":"approval-required"}
    after openSession: {"supported":["approval-required","auto-accept-edits","auto","full-access"],"resolvedRuntimeMode":"auto"}
  • Not run: a live agy binary end-to-end turn; ACP reconfiguration on configuredRuntimeMode mismatch is handled by existing AcpAdapterV2.startTurn logic.

Built with Gemini 4 Neon via Antigravity in T3 Code.

    1. Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

    2. tanstack-source added labelsbug

    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Provider turn startup now resolves runtime policy before opening a provider session and again after the session opens. A test verifies that each stage receives the policy resolved at that point.

      Changes: Runtime policy resolution

      Layer / File(s)Summary
      Resolve policy at both startup stages
      apps/server/src/orchestration-v2/ProviderTurnStartService.ts, apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts
      The service resolves policy before session opening and again afterward. The test verifies that session opening receives approval-required and startRootRun receives auto when the mock changes its result.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Sequence Diagram(s)

      sequenceDiagram
        participant ProviderTurnStartService
        participant RuntimePolicy
        participant ProviderSession
        participant startRootRun
        ProviderTurnStartService->>RuntimePolicy: Resolve policy before session opening
        ProviderTurnStartService->>ProviderSession: Open session with initial policy
        ProviderTurnStartService->>RuntimePolicy: Resolve policy after session opening
        ProviderTurnStartService->>startRootRun: Start with second policy

      Suggested reviewers: juliusmarminge, macroscopeapp

      Merge Risk: Minimal · up to 3219d

      Threads configured for Auto mode on a cold Antigravity start should now begin in Auto instead of Supervised. The inspected code supports this behavior and no concrete defects remain. The change is low risk to merge.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the fix and the affected area: the first cold Antigravity turn no longer falls back from Auto to Supervised. The raw summary shows the change re-resolves the runtime policy after the p…
      Description checkPassedThe description follows the template sections (Problem, Change, Scope, Verification). The Problem section explains the cold-start Antigravity fallback and expected behavior. The Change section explain…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title names the fix and the affected area: the first cold Antigravity turn no longer falls back from Auto to Supervised. The raw summary shows the change re-resolves the runtime policy after the provider session opens in ProviderTurnStartService, which is the mechanism behind this behavior. The title is specific and matches the main change.

      Full details: Description check

      Explanation

      The description follows the template sections (Problem, Change, Scope, Verification). The Problem section explains the cold-start Antigravity fallback and expected behavior. The Change section explains the post-open policy re-resolution and how it reaches thread setup and run startup. The Scope section names the bug and links related work (#39378, #40154) but does not link an issue that shows the bug or say whether a maintainer requested the PR. The Verification section lists the regression test, before/after results, check runs, and a runtime check, and states what was not run. The missing issue link is a minor gap, so the description is mostly complete.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 367f9d3759e68999c086ec11e7acf5f94fe83cc5 and 3219d435fe999af0a7357a6da99ea32bbcd4ada2.

      Files selected for processing: 2

      • apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts
      • apps/server/src/orchestration-v2/ProviderTurnStartService.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

    4. This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

      See the conflict window.

Sign in to join this conversation.