TypeScript
fix(web): resume Antigravity threads without repeated sign-in (#9647)
Theo Browned487dfbf46be
diff --git a/apps/web/src/components/ChatView.logic.test.ts b/apps/web/src/components/ChatView.logic.test.tsindex 8e9c80641f2..c8afd10d372 100644--- a/apps/web/src/components/ChatView.logic.test.ts+++ b/apps/web/src/components/ChatView.logic.test.ts@@ -1,4 +1,5 @@import {+ ANTIGRAVITY_DEFAULT_MODEL,CheckpointRef,EnvironmentId,MessageId,@@ -793,14 +794,20 @@ describe("resolveComposerProviderSelection", () => {);});- it("blocks sends until Antigravity confirms authentication", () => {+ it("lets Antigravity check saved credentials when resuming after a restart", () => {const provider = entry("antigravity", "google_work", {+ status: "warning",auth: { status: "unknown" },- models: catalogModels,+ models: [],}).snapshot;- expect(getAntigravitySendBlockReason(provider, "gemini-pro")).toBe(- "Sign in to Antigravity in provider settings before sending.",+ expect(getAntigravitySendBlockReason(provider, "gemini-pro")).toBeNull();+ expect(getAntigravitySendBlockReason(provider, ANTIGRAVITY_DEFAULT_MODEL)).toBeNull();+ expect(+ getAntigravitySendBlockReason({ ...provider, models: catalogModels }, "gemini-pro"),+ ).toBeNull();+ expect(getAntigravitySendBlockReason(provider, "")).toBe(+ "Choose an Antigravity model before sending.",);});diff --git a/apps/web/src/components/ChatView.logic.ts b/apps/web/src/components/ChatView.logic.tsindex 1a6b1b775f4..4a0b9f57610 100644--- a/apps/web/src/components/ChatView.logic.ts+++ b/apps/web/src/components/ChatView.logic.ts@@ -421,14 +421,17 @@ export function getAntigravitySendBlockReason(if (!provider.installed) {return "Install Antigravity in provider settings before sending.";}- if (provider.auth.status !== "authenticated") {+ if (provider.auth.status === "unauthenticated") {return "Sign in to Antigravity in provider settings before sending.";}+ const slug = model.trim();+ if (slug.length === 0) return "Choose an Antigravity model before sending.";+ // A restart clears the account status and catalog. Session startup checks+ // saved credentials and validates the model before sending the prompt.+ if (provider.auth.status === "unknown") return null;if (provider.models.length === 0) {return "Refresh Antigravity models in provider settings before sending.";}- const slug = model.trim();- if (slug.length === 0) return "Choose an Antigravity model before sending.";// A saved model that left the catalog is kept in the picker as unavailable// so the user sees what the thread used. The server rejects it at turn// start, so block here unless the provider is in an error state, where adiff --git a/apps/web/src/components/chat/ProviderStatusBanner.test.tsx b/apps/web/src/components/chat/ProviderStatusBanner.test.tsxindex f27cda19d95..e51383bc69f 100644--- a/apps/web/src/components/chat/ProviderStatusBanner.test.tsx+++ b/apps/web/src/components/chat/ProviderStatusBanner.test.tsx@@ -28,6 +28,42 @@ function warningProvider(): ServerProvider {}describe("ProviderStatusBanner", () => {+ it("waits for an Antigravity auth result before showing a sign-in warning", () => {+ const status: ServerProvider = {+ ...warningProvider(),+ instanceId: ProviderInstanceId.make("google_work"),+ driver: ProviderDriverKind.make("antigravity"),+ auth: { status: "unknown" },+ message: "Antigravity is installed. Google account access is not checked yet.",+ };++ expect(shouldShowProviderStatusBanner(status, null)).toBe(false);+ expect(+ shouldShowProviderStatusBanner(+ {+ ...status,+ auth: { status: "unauthenticated" },+ message: "Sign in with Google to use Antigravity.",+ },+ null,+ ),+ ).toBe(true);+ });++ it("shows Antigravity installation and startup failures before auth is checked", () => {+ const status: ServerProvider = {+ ...warningProvider(),+ driver: ProviderDriverKind.make("antigravity"),+ auth: { status: "unknown" },+ };++ expect(shouldShowProviderStatusBanner({ ...status, installed: false }, null)).toBe(true);+ expect(shouldShowProviderStatusBanner({ ...status, status: "error" }, null)).toBe(true);+ expect(+ shouldShowProviderStatusBanner({ ...status, driver: ProviderDriverKind.make("codex") }, null),+ ).toBe(true);+ });+it("stays hidden after its current warning is dismissed", () => {const status = warningProvider();diff --git a/apps/web/src/components/chat/ProviderStatusBanner.tsx b/apps/web/src/components/chat/ProviderStatusBanner.tsxindex 2ae4bc8b58d..12f9dc04f26 100644--- a/apps/web/src/components/chat/ProviderStatusBanner.tsx+++ b/apps/web/src/components/chat/ProviderStatusBanner.tsx@@ -7,9 +7,20 @@ import { formatProviderDriverKindLabel } from "../../providerModels";import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";export function getProviderStatusBannerKey(status: ServerProvider | null): string | null {- return !status || status.status === "ready" || status.status === "disabled"- ? null- : [status.instanceId, status.status, status.auth.status, status.message ?? ""].join("\u0000");+ if (!status || status.status === "ready" || status.status === "disabled") return null;+ // Antigravity checks saved credentials when a session starts. Its local+ // health check leaves auth unknown after a restart, which is not a failure.+ if (+ status.driver === "antigravity" &&+ status.installed &&+ status.status === "warning" &&+ status.auth.status === "unknown"+ ) {+ return null;+ }+ return [status.instanceId, status.status, status.auth.status, status.message ?? ""].join(+ "\u0000",+ );}export function shouldShowProviderStatusBanner(@@ -59,7 +70,7 @@ export const ProviderStatusBanner = memo(function ProviderStatusBanner({onOpenProviderSetup?: (instanceId: ProviderInstanceId) => void;status: ServerProvider | null;}) {- if (!status || status.status === "ready" || status.status === "disabled") {+ if (!status || getProviderStatusBannerKey(status) === null) {return null;}diff --git a/docs/user/providers-antigravity.md b/docs/user/providers-antigravity.mdindex bd84ced3a39..24fe8c05780 100644--- a/docs/user/providers-antigravity.md+++ b/docs/user/providers-antigravity.md@@ -179,10 +179,14 @@ paid-plan tier or remaining subscription quota. See Google's [Antigravity plans][personal Google sign-in guide][google-setup].After an environment restarts, Google sign-in can show as not checked until an authenticated-session succeeds. To check account access and reload models, use **Refresh provider status**-in web or desktop provider settings, or **Refresh models** in the mobile model picker. Refresh-uses saved Google sign-in and does not open a login page. If sign-in is required, use the-provider's setup controls. Automatic status checks verify the installation only.+session succeeds. You can continue an existing thread. Antigravity checks saved Google sign-in+when the session starts. An unchecked status does not require signing in again.++To check account access and reload models on web or desktop, open **Settings** > **Providers**+and select the circular arrow beside **Checked** at the top of the page. Its tooltip says+**Refresh provider status**. On mobile, use **Refresh models** in the model picker.+Refresh uses saved Google sign-in and does not open a login page. If sign-in is required,+use the provider's setup controls. Automatic status checks verify the installation only.The packaged runtime can be slow to start, especially on Windows. Health checks, model refresh,and sign-out each allow up to 90 seconds before reporting a timeout.