fix(server): disabled providers stop checking for CLI updates (#16772)

Signed-off-by: Yordis Prieto <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Yordis PrietoandJulius Marminge authored and GitHub committed 2026-10-10 20:06:03 -07:00
1 parent 0eef5d0c76
commit 4baba3b503
5 files changed
+48 -23

No files matched your search

@@ -257,31 +257,23 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
),
);
it.effect("records explicit sign-in while disabled without starting a health probe", () =>
it.effect("ignores account updates while disabled", () =>
Effect.scoped(
Effect.gen(function* () {
const harness = yield* makeHarness({ enabled: false });
const signedIn = yield* Stream.toPull(
harness.provider.snapshot.streamChanges.pipe(
Stream.filter(
(snapshot) =>
snapshot.auth.status === "authenticated" && snapshot.slashCommands.length > 0,
),
),
);
yield* harness.provider.onSessionStarted(started);
yield* harness.provider.onAvailableCommands(commands);
const [snapshot] = yield* signedIn;
yield* harness.provider.onSignedOut;
const snapshot = yield* harness.provider.snapshot.refresh;
expect(snapshot).toMatchObject({
enabled: false,
installed: true,
installed: false,
status: "disabled",
auth: { status: "authenticated", type: "oauth-personal" },
auth: { status: "unknown" },
models: [],
slashCommands: [],
workspaceSnapshots: [],
});
expect(snapshot.models).toEqual(buildAntigravityModelsFromSession(sessionSetupResult));
expect(snapshot.slashCommands).toEqual(expectedCommands);
expect((yield* harness.provider.snapshot.refresh).models).toEqual(snapshot.models);
expect(yield* Ref.get(harness.probeCalls)).toBe(0);
}),
),
@@ -132,7 +132,10 @@ interface AntigravityProviderOptions {
readonly auth?: { readonly type: string; readonly label: string };
}
/** Health uses initialize only. Session callbacks supply account-specific metadata. */
/**
* Health uses initialize only. Session callbacks supply account-specific
* metadata, which a disabled instance never shows.
*/
export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(function* (
settings: AntigravitySettings,
options: AntigravityProviderOptions,
@@ -271,6 +274,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
started: AcpSessionRuntime.AcpSessionRuntimeStartResult,
cwd?: string,
) {
if (!settings.enabled) return;
const before = yield* SubscriptionRef.get(metadata);
const supportsTextGeneration = yield* options.supportsTextGeneration;
const usageLimits =
@@ -293,7 +297,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
draft: {
...draft,
installed: true,
status: settings.enabled ? "ready" : "disabled",
status: "ready",
version: started.initializeResult.agentInfo?.version || draft.version,
auth: {
status: "authenticated",
@@ -339,6 +343,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
commands: ReadonlyArray<EffectAcpSchema.AvailableCommand>,
cwd?: string,
) {
if (!settings.enabled) return;
const slashCommands = nativeCommands(commands);
const updatedAt = DateTime.formatIso(yield* DateTime.now);
yield* SubscriptionRef.update(metadata, (state) => {
@@ -371,6 +376,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
const clearAccountMetadata = Effect.fn("AntigravityProvider.clearAccountMetadata")(function* () {
if (options.clearUsage) yield* options.clearUsage;
if (!settings.enabled) return;
const updatedAt = DateTime.formatIso(yield* DateTime.now);
yield* SubscriptionRef.update(
metadata,
@@ -380,7 +386,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
draft: {
...state.draft,
auth: { status: "unauthenticated" },
status: settings.enabled ? "warning" : "disabled",
status: "warning",
message: SIGN_IN_MESSAGE,
checkedAt: updatedAt,
models: [],
@@ -187,7 +187,7 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
const instance = yield* AntigravityDriver.create({
instanceId,
displayName: "Google test account",
enabled: options.enabled ?? false,
enabled: options.enabled ?? true,
config: { ...AntigravityDriver.defaultConfig(), ...options.config },
environment: [
{ name: "PATH", value: instancePath },
@@ -292,7 +292,7 @@ it.layer(layerTest)("AntigravityDriver", (it) => {
it.effect.skipIf(windowsHost)("does not launch a process for a disabled instance", () =>
Effect.gen(function* () {
const h = yield* makeHarness();
const h = yield* makeHarness({ enabled: false });
const snapshot = yield* h.instance.snapshot.refresh;
expect(snapshot.status).toBe("disabled");
expect(h.acquisitions).toEqual([]);
@@ -322,13 +322,13 @@ it.layer(layerTest)("AntigravityDriver", (it) => {
);
it.effect.skipIf(windowsHost)(
"refreshes a disabled instance through the selected executable and personal Google ACP",
"refreshes through the selected executable and personal Google ACP",
() =>
Effect.gen(function* () {
const h = yield* makeHarness();
yield* h.refresh();
const snapshot = yield* h.instance.snapshot.getSnapshot;
expect(snapshot.status).toBe("disabled");
expect(snapshot.status).toBe("ready");
expect(snapshot.auth.status).toBe("authenticated");
expect(snapshot.models.map((model) => model.slug)).toEqual([
"gemini-test-low",
@@ -183,6 +183,31 @@ describe("makeManagedServerProvider", () => {
).pipe(Effect.provide(layerAlwaysRunTest)),
);
it.effect("does not enrich a disabled provider's snapshot", () =>
Effect.scoped(
Effect.gen(function* () {
let enrichmentCalls = 0;
const provider = yield* makeManagedServerProvider<TestSettings>({
resolveMaintenance: () => Effect.succeed(maintenanceCapabilities),
getSettings: Effect.succeed({ enabled: false }),
streamSettings: Stream.empty,
haveSettingsChanged: (previous, next) => previous.enabled !== next.enabled,
refreshOnInterval: false,
initialSnapshot: () => Effect.succeed({ ...initialSnapshot, enabled: false }),
checkProvider: Effect.succeed({ ...refreshedSnapshot, enabled: false }),
enrichSnapshot: () => {
enrichmentCalls += 1;
return Effect.void;
},
});
yield* provider.refresh;
assert.strictEqual(enrichmentCalls, 0);
}),
).pipe(Effect.provide(layerAlwaysRunTest)),
);
it.effect("skips periodic provider refreshes without foreground provider-status demand", () =>
Effect.scoped(
Effect.gen(function* () {
@@ -106,7 +106,9 @@ export const makeManagedServerProvider = Effect.fn("makeManagedServerProvider")(
yield* Fiber.interrupt(previousFiber).pipe(Effect.ignore);
}
if (!input.enrichSnapshot) {
// Enrichment resolves binaries and package-manager state, which a disabled
// provider has no use for.
if (!input.enrichSnapshot || !snapshot.enabled) {
return;
}