Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ import { readCodexSetupMode } from "./CodexSetupSection.logic";
import {
getProviderVersionAdvisoryPresentation,
PROVIDER_STATUS_STYLES,
getProviderStatusKey,
getProviderSummary,
getProviderVersionLabel,
type ProviderStatusKey,
} from "./providerStatus";

const ENVIRONMENT_VARIABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
Expand Down Expand Up @@ -645,13 +645,12 @@ export function ProviderInstanceCard({
projectOverride,
}: ProviderInstanceCardProps) {
const enabled = projectOverride?.effectiveEnabled ?? resolveProviderInstanceEnabled(instance);
const effectiveProvider = liveProvider && { ...liveProvider, enabled };
const compatibility = enabled ? liveProvider?.compatibilityAdvisory : undefined;
const statusKey: ProviderStatusKey = enabled
? ((liveProvider?.status as ProviderStatusKey | undefined) ?? "warning")
: "disabled";
const statusKey = enabled ? getProviderStatusKey(effectiveProvider) : "disabled";
const statusStyle = PROVIDER_STATUS_STYLES[statusKey];
const summary = enabled
? getProviderSummary(liveProvider && { ...liveProvider, enabled: true })
? getProviderSummary(effectiveProvider)
: { headline: "Disabled", detail: null };
const authEmail = liveProvider?.auth.email?.trim();
const isAuthenticated = enabled && liveProvider?.auth.status === "authenticated";
Expand Down
86 changes: 85 additions & 1 deletion apps/web/src/components/settings/providerStatus.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { ProviderDriverKind, ProviderInstanceId, type ServerProvider } from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";

import { getProviderSummary, getProviderVersionAdvisoryPresentation } from "./providerStatus";
import {
getProviderSummary,
getProviderVersionAdvisoryPresentation,
getProviderStatusKey,
} from "./providerStatus";

const provider: ServerProvider = {
instanceId: ProviderInstanceId.make("codex"),
Expand Down Expand Up @@ -70,6 +74,86 @@ describe("getProviderSummary", () => {
});
});

describe("Antigravity with unchecked sign-in", () => {
const unchecked: ServerProvider = {
...provider,
instanceId: ProviderInstanceId.make("antigravity"),
driver: ProviderDriverKind.make("antigravity"),
status: "warning",
auth: { status: "unknown" },
message: "Antigravity is installed. Google account access is not checked yet.",
};

it("presents an unchecked Google sign-in neutrally without claiming authentication is required", () => {
for (const auth of [unchecked.auth, { status: "unknown", type: "oauth-personal" }] as const) {
const candidate = { ...unchecked, auth };
expect.soft(getProviderSummary(candidate)).toEqual({
headline: "Installed · Sign-in not checked",
detail: unchecked.message,
});
expect(getProviderStatusKey(candidate)).toBe("neutral");
}
});

it("preserves actionable warnings, failures and disabled states outside unchecked Google sign-in", () => {
const cases = [
{
name: "confirmed sign-out",
change: { auth: { status: "unauthenticated" } },
headline: "Not authenticated",
status: "warning",
},
{
name: "warning despite known authentication",
change: { auth: { status: "authenticated" } },
headline: "Needs attention",
status: "warning",
},
{
name: "probe failure",
change: { status: "error" },
headline: "Unavailable",
status: "error",
},
{
name: "missing CLI",
change: { installed: false },
headline: "Not found",
status: "warning",
},
{
name: "API key authentication",
change: { auth: { status: "unknown", type: "gemini-api-key" } },
headline: "Needs attention",
status: "warning",
},
{
name: "Agent Platform authentication",
change: { auth: { status: "unknown", type: "agent-platform" } },
headline: "Needs attention",
status: "warning",
},
{
name: "another provider",
change: { driver: provider.driver },
headline: "Needs attention",
status: "warning",
},
{
name: "disabled provider",
change: { enabled: false },
headline: "Disabled",
status: "disabled",
},
] as const;
for (const { name, change, headline, status } of cases) {
const candidate = { ...unchecked, ...change };
expect.soft(getProviderSummary(candidate).headline, name).toBe(headline);
expect.soft(getProviderStatusKey(candidate), name).toBe(status);
}
});
});

it("does not suggest copying a command that installs an incompatible latest version", () => {
const advisory = {
status: "behind_latest" as const,
Expand Down
29 changes: 29 additions & 0 deletions apps/web/src/components/settings/providerStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const PROVIDER_STATUS_STYLES = {
error: {
dot: "bg-destructive",
},
neutral: {
dot: "bg-muted-foreground",
},
ready: {
dot: "bg-success",
},
Expand All @@ -21,6 +24,26 @@ export const PROVIDER_STATUS_STYLES = {

export type ProviderStatusKey = keyof typeof PROVIDER_STATUS_STYLES;

// Antigravity's local health check verifies installation, not Google sign-in.
// API-key and Agent Platform warnings still need attention.
function isAntigravitySignInUnchecked(provider: ServerProvider): boolean {
return (
provider.driver === "antigravity" &&
provider.installed &&
provider.status === "warning" &&
provider.auth.status === "unknown" &&
(provider.auth.type === undefined ||
provider.auth.type === "oauth-personal" ||
provider.auth.type === "oauth-business")
);
}

export function getProviderStatusKey(provider: ServerProvider | undefined): ProviderStatusKey {
if (provider && !provider.enabled) return "disabled";
if (provider && isAntigravitySignInUnchecked(provider)) return "neutral";
return provider?.status ?? "warning";
}

export function getProviderSummary(provider: ServerProvider | undefined) {
if (!provider) {
return {
Expand Down Expand Up @@ -48,6 +71,12 @@ export function getProviderSummary(provider: ServerProvider | undefined) {
detail: provider.message ?? null,
};
}
if (isAntigravitySignInUnchecked(provider)) {
return {
headline: "Installed · Sign-in not checked",
detail: provider.message ?? null,
};
}
if (provider.status === "warning") {
return {
headline: "Needs attention",
Expand Down
Loading