fix(server): first cold Antigravity turn no longer falls back from Auto to Supervised #40200
main fromrefs/pull/40200/head·opened View on GitHubProblem#
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
resolveTurnRuntimePolicyinapps/server/src/orchestration-v2/ProviderTurnStartService.tsand re-resolvedRuntimePolicyV2afterproviderSessions.opensucceeds (re-checkingisCurrentAttemptInStatus("starting")and preserving existing ceiling-error handling). - Passed the post-open
resolvedRuntimePolicytoensureThread,resumeThread,forkThread, andrunExecution.startRootRun. When the post-openruntimeModediffers from the mode configured duringopenSession,AcpAdapterV2.startTurnalready detects theconfiguredRuntimeModechange and re-runsconfigureSessionbefore 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 becausestartRootRunreceivedruntimeMode: "approval-required"even afteropenupdated policy resolution to"auto". - After fix: passed (
openreceived"approval-required",startRootRunreceived"auto").
- Before fix (on
- Ran
vp run check:changedon this branch:format: pass (0.2s)lint: pass (0 warnings, 0 errors)knip1/2 & 2/2: passgraphql (apps/server): passtypecheck (3 packages): passtest (2 files): 95/95 passed (including all 93 tests inProviderTurnStartService.test.ts)
- Runtime check running
makeAntigravityProvider+RuntimePolicy.layerFromProjectStoreacrossonSessionStartedadvertisingavailableModes: ["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
agybinary end-to-end turn; ACP reconfiguration onconfiguredRuntimeModemismatch is handled by existingAcpAdapterV2.startTurnlogic.
Built with Gemini 4 Neon via Antigravity in T3 Code.
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
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.tsThe service resolves policy before session opening and again afterward. The test verifies that session opening receives approval-requiredandstartRootRunreceivesautowhen 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 policySuggested reviewers:
juliusmarminge,macroscopeapp
Merge Risk:
Minimal · up to3219d-
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:
4-
Check name Status Explanation Title check 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 p… Description check 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 explain… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check 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-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 367f9d3
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0fba9087-c086-4762-a19f-18f5ac583d17
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.tsapps/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.
-
-
This PR conflicts with
main. Rebase it or mergemaininto it. If it still conflicts after 7 days with no activity, it will be closed automatically.See the conflict window.
github-actions[bot](GitHub profile, opens in a new tab) added labelsneeds-rebase
Sign in to join this conversation.
copilot-pull-request-reviewer[bot](GitHub profile, opens in a new tab) reviewed
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.