Skip to content

Commit c894d79

Browse files
authored
fix(providers): Antigravity API-key setup says Connect (#27759)
1 parent abcff3e commit c894d79

4 files changed

Lines changed: 82 additions & 32 deletions

File tree

‎apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ function ProviderAccount({
215215
!active && signedIn && (provider.auth.canLogout ?? provider.setup?.canAuthenticate);
216216
const showCallback =
217217
Boolean(url) && (interaction?.type === "browser" ? interaction.acceptsCallback : !interaction);
218+
const usesCredentials =
219+
provider.driver === "antigravity" &&
220+
(provider.auth.type === "gemini-api-key" || provider.auth.type === "agent-platform");
218221
const status =
219222
active || state?.phase === "failed" || state?.phase === "cancelled"
220223
? state.message
@@ -228,7 +231,9 @@ function ProviderAccount({
228231
? "No in-app sign-in advertised. Follow the provider's docs to finish setup."
229232
: !provider.installed
230233
? "Not installed"
231-
: "Not signed in";
234+
: usesCredentials
235+
? "Connect to load models"
236+
: "Not signed in";
232237
// A provider with several sign-in methods picks one from a menu on the same control.
233238
const methodActions: MenuAction[] = methods.map((method) => ({
234239
id: `method:${method.id}`,
@@ -339,8 +344,8 @@ function ProviderAccount({
339344
) : canSignIn && !signedIn ? (
340345
<ControlPill
341346
variant="primary"
342-
label="Sign in"
343-
accessibilityLabel={`Sign in to ${name}`}
347+
label={usesCredentials ? "Connect" : "Sign in"}
348+
accessibilityLabel={usesCredentials ? `Connect to ${name}` : `Sign in to ${name}`}
344349
disabled={signInDisabled}
345350
onPress={() => startSignIn()}
346351
/>

‎apps/server/src/provider/AntigravityProvider.test.ts‎

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type ProbeError = EffectAcpErrors.AcpError | ProviderSetupError;
129129

130130
const makeHarness = Effect.fn("makeAntigravityProviderHarness")(function* (
131131
options: {
132+
readonly auth?: { readonly type: string; readonly label: string };
132133
readonly enabled?: boolean;
133134
readonly safe?: boolean;
134135
readonly probeUsage?: Effect.Effect<ServerProviderUsageLimits>;
@@ -145,6 +146,7 @@ const makeHarness = Effect.fn("makeAntigravityProviderHarness")(function* (
145146
decodeSettings({ enabled: options.enabled ?? true, customModels: ["do-not-seed-me"] }),
146147
{
147148
stampIdentity: (snapshot) => Effect.succeed({ ...snapshot, instanceId, driver }),
149+
...(options.auth ? { auth: options.auth } : {}),
148150
...(options.probeUsage ? { probeUsage: options.probeUsage } : {}),
149151
probe: Ref.update(probeCalls, (count) => count + 1).pipe(
150152
Effect.andThen(Ref.get(probe)),
@@ -305,23 +307,35 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
305307
it.effect("treats initialize as installation proof, not account or model discovery", () =>
306308
Effect.scoped(
307309
Effect.gen(function* () {
308-
const harness = yield* makeHarness();
309-
expect(yield* harness.provider.snapshot.getSnapshot).toMatchObject({
310-
installed: false,
311-
status: "warning",
312-
auth: { status: "unknown" },
313-
models: [],
314-
});
315-
yield* harness.initialize;
316-
const snapshot = yield* harness.provider.snapshot.getSnapshot;
317-
expect(snapshot).toMatchObject({
318-
installed: true,
319-
status: "warning",
320-
version: "agy_acp_server_20260818_01_RC01",
321-
auth: { status: "unknown" },
322-
models: [],
323-
});
324-
expect(yield* Ref.get(harness.probeCalls)).toBe(1);
310+
for (const auth of [
311+
undefined,
312+
{ type: "oauth-personal", label: "Google account" },
313+
{ type: "oauth-business", label: "Gemini Enterprise" },
314+
{ type: "gemini-api-key", label: "Gemini API key" },
315+
{ type: "agent-platform", label: "Agent Platform" },
316+
]) {
317+
const harness = yield* makeHarness(auth ? { auth } : {});
318+
expect(yield* harness.provider.snapshot.getSnapshot).toMatchObject({
319+
installed: false,
320+
status: "warning",
321+
auth: { status: "unknown" },
322+
models: [],
323+
});
324+
yield* harness.initialize;
325+
const snapshot = yield* harness.provider.snapshot.getSnapshot;
326+
expect(snapshot).toMatchObject({
327+
installed: true,
328+
status: "warning",
329+
version: "agy_acp_server_20260818_01_RC01",
330+
auth: { status: "unknown", ...(auth ? { type: auth.type } : {}) },
331+
message:
332+
auth?.type === "gemini-api-key" || auth?.type === "agent-platform"
333+
? `Antigravity is installed. Connect with ${auth.label} to load models.`
334+
: "Antigravity is installed. Google account access is not checked yet.",
335+
models: [],
336+
});
337+
expect(yield* Ref.get(harness.probeCalls)).toBe(1);
338+
}
325339
}),
326340
),
327341
);
@@ -360,7 +374,8 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
360374
it.effect("clears all account metadata on sign-out and authentication failure", () =>
361375
Effect.scoped(
362376
Effect.gen(function* () {
363-
const harness = yield* makeHarness();
377+
const auth = { type: "gemini-api-key", label: "Gemini API key" };
378+
const harness = yield* makeHarness({ auth });
364379
yield* harness.initialize;
365380
for (const clear of [harness.provider.onSignedOut, harness.provider.onAuthRequired]) {
366381
yield* harness.provider.onSessionStarted(started, "/workspace");
@@ -369,7 +384,8 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
369384
expect(yield* harness.provider.snapshot.getSnapshot).toMatchObject({
370385
installed: true,
371386
status: "warning",
372-
auth: { status: "unauthenticated" },
387+
auth: { status: "unauthenticated", type: auth.type, label: auth.label },
388+
message: "Connect with Gemini API key to use Antigravity and load models.",
373389
models: [],
374390
slashCommands: [],
375391
skills: [],
@@ -382,7 +398,14 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
382398
expect((yield* harness.provider.snapshot.getSnapshot).models).toEqual([]);
383399
}
384400
const refreshed = yield* harness.provider.snapshot.refresh;
385-
expect(refreshed.auth.status).toBe("unauthenticated");
401+
expect(refreshed.auth).toEqual({
402+
status: "unauthenticated",
403+
type: auth.type,
404+
label: auth.label,
405+
});
406+
expect(refreshed.message).toBe(
407+
"Connect with Gemini API key to use Antigravity and load models.",
408+
);
386409
expect(refreshed.supportsTextGeneration).toBe(false);
387410
}),
388411
),

‎apps/server/src/provider/AntigravityProvider.ts‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
164164
settings: AntigravitySettings,
165165
options: AntigravityProviderOptions,
166166
) {
167+
const usesCredentials =
168+
options.auth?.type === "gemini-api-key" || options.auth?.type === "agent-platform";
169+
const signInMessage = usesCredentials
170+
? `Connect with ${options.auth.label} to use Antigravity and load models.`
171+
: SIGN_IN_MESSAGE;
172+
const authUncheckedMessage = usesCredentials
173+
? `Antigravity is installed. Connect with ${options.auth.label} to load models.`
174+
: AUTH_UNCHECKED_MESSAGE;
167175
const checkedAt = DateTime.formatIso(yield* DateTime.now);
168176
const initialDraft = {
169177
...buildServerProvider({
@@ -243,8 +251,8 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
243251
(authenticated
244252
? undefined
245253
: draft.auth.status === "unauthenticated"
246-
? SIGN_IN_MESSAGE
247-
: AUTH_UNCHECKED_MESSAGE);
254+
? signInMessage
255+
: authUncheckedMessage);
248256
return {
249257
...state,
250258
draft: {
@@ -420,9 +428,12 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
420428
authRevision: state.authRevision + 1,
421429
draft: {
422430
...state.draft,
423-
auth: { status: "unauthenticated" },
431+
auth: {
432+
status: "unauthenticated",
433+
...(usesCredentials ? options.auth : {}),
434+
},
424435
status: "warning",
425-
message: SIGN_IN_MESSAGE,
436+
message: signInMessage,
426437
checkedAt: updatedAt,
427438
models: [],
428439
slashCommands: [],

‎apps/web/src/components/settings/ProviderAuthenticationSection.tsx‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,16 @@ export function ProviderAuthenticationSection({
7373
!signedIn &&
7474
(provider.setup?.canAuthenticate === false ||
7575
(provider.driver === "acpRegistry" && auth?.methods?.length === 0));
76+
const usesCredentials =
77+
provider.driver === "antigravity" &&
78+
(provider.auth.type === "gemini-api-key" || provider.auth.type === "agent-platform");
7679
const accountDescription = active
7780
? auth?.phase === "starting"
78-
? (auth.message ?? "Starting sign-in…")
81+
? (auth.message ?? (usesCredentials ? "Connecting…" : "Starting sign-in…"))
7982
: auth?.phase === "verifying"
80-
? "Checking your account…"
83+
? usesCredentials
84+
? "Checking credentials and loading models…"
85+
: "Checking your account…"
8186
: interaction?.type === "terminal"
8287
? "Complete sign-in in the terminal below."
8388
: interaction?.type === "credentials"
@@ -89,7 +94,9 @@ export function ProviderAuthenticationSection({
8994
? "Discovering sign-in methods…"
9095
: needsExternalSetup
9196
? "No in-app sign-in advertised. Follow the provider's docs to finish setup."
92-
: `Sign in on ${environmentLabel}.`;
97+
: usesCredentials
98+
? `Connect on ${environmentLabel} to load models.`
99+
: `Sign in on ${environmentLabel}.`;
93100
const statusMessage = auth?.phase === "failed" ? auth.message : null;
94101
const disabled = readOnly || pending || query.error !== null || isDiscovering;
95102
const draftId = `${auth?.flowId ?? ""}:${interaction?.id ?? ""}`;
@@ -291,8 +298,12 @@ export function ProviderAuthenticationSection({
291298
{signedIn
292299
? "Change account"
293300
: auth?.phase === "failed" || auth?.phase === "cancelled"
294-
? "Retry sign-in"
295-
: "Sign in"}
301+
? usesCredentials
302+
? "Retry connection"
303+
: "Retry sign-in"
304+
: usesCredentials
305+
? "Connect"
306+
: "Sign in"}
296307
</Button>
297308
) : null}
298309
{!active && signedIn && (provider.auth.canLogout ?? provider.setup?.canAuthenticate) ? (

0 commit comments

Comments
 (0)