The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
fix(server): each Antigravity Google sign-in stays in its own instance (#39485)
Julius Marminge committed
Nov 19, 2026 at 22:07 UTC
084ad5e1a0fe3f58570a4cf3fc1c4043a210c7bf
5 files changed
+40
-6
apps/server/src/provider/antigravityAuthSupport.test.ts
+8
@@ -99,6 +99,7 @@ describe("Antigravity process environment", () => {
99
HOME: "/home/developer",
100
PATH: "/usr/bin",
101
CUSTOM_SETTING: "keep-this",
102
+ SSH_CONNECTION: "127.0.0.1 0 127.0.0.1 0",
103
GEMINI_HOME: profile.geminiHome,
104
AGY_ACP_FORCE_FILE_STORAGE: "1",
105
AGY_CLI_DISABLE_AUTO_UPDATE: "1",
@@ -148,6 +149,13 @@ describe("Antigravity process environment", () => {
149
});
150
expect(business.GEMINI_API_KEY).toBeUndefined();
151
expect(business.GOOGLE_API_KEY).toBeUndefined();
152
+
153
+ // Only the Google account method has the `--login` sign-in that works without the keyring.
154
+ for (const env of [geminiKey, vertexKey, business]) expect(env.SSH_CONNECTION).toBeUndefined();
155
+ expect(
156
+ spawnFor({ authMethod: "oauth-personal", apiKey: "", gcpProject: "", gcpLocation: "" })
157
+ .SSH_CONNECTION,
158
+ ).toBe("127.0.0.1 0 127.0.0.1 0");
159
});
160
161
it("isolates TEMP and TMP to the profile directory on Windows", () => {
apps/server/src/provider/antigravityAuthSupport.ts
+5
@@ -227,6 +227,11 @@ function antigravityEnvironment(
227
baseEnv.SSL_CERT_DIR === undefined
228
? { SSL_CERT_FILE: profile.caBundlePath }
229
: {}),
230
+ // The 1.5 CLI ignores AGY_ACP_FORCE_FILE_STORAGE and keeps Google sign-ins in one OS keyring
231
+ // entry for every profile, unless it believes it runs over SSH. Sign-in then uses `--login`.
232
+ ...(auth.authMethod === "oauth-personal"
233
+ ? { SSH_CONNECTION: baseEnv.SSH_CONNECTION || "127.0.0.1 0 127.0.0.1 0" }
234
+ : {}),
235
GEMINI_HOME: profile.geminiHome,
236
AGY_ACP_FORCE_FILE_STORAGE: "1",
237
AGY_CLI_DISABLE_AUTO_UPDATE: "1",
apps/server/src/provider/antigravityUsageLimits.test.ts
+18
-2
@@ -691,12 +691,23 @@ describe("Antigravity subscription limits", () => {
691
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
692
);
693
694
- it.effect("reads the native CLI's keyring sign-in and reports when it has expired", () =>
694
+ it.effect("reads a Gemini Enterprise keyring sign-in and reports when it has expired", () =>
695
Effect.gen(function* () {
696
yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-09T12:00:00Z")));
697
const keyringSecret = (expiry: string) =>
698
JSON.stringify({ token: { access_token: "access-token", refresh_token: "r", expiry } });
699
+ // Google account instances keep their own sign-in; the shared entry belongs to another app.
700
+ const personal = yield* fixture({
701
+ missingToken: true,
702
+ keyringSecret: keyringSecret("2026-10-09T14:00:00Z"),
703
+ });
704
+ expect((yield* personal.probe).unavailable?.message).toBe(
705
+ "Sign in with Google to see Antigravity limits.",
706
+ );
707
+ expect(personal.requests).toEqual([]);
708
+
709
const signedIn = yield* fixture({
710
+ authMethod: "oauth-business",
711
missingToken: true,
712
userId: "google-user-1",
713
keyringSecret: keyringSecret("2026-10-09T14:00:00.123456789+01:00"),
@@ -707,6 +718,7 @@ describe("Antigravity subscription limits", () => {
718
expect(signedIn.requests.some((request) => request.url.endsWith("/token"))).toBe(false);
719
720
const expired = yield* fixture({
721
+ authMethod: "oauth-business",
722
missingToken: true,
723
keyringSecret: keyringSecret("2026-10-09T12:00:30Z"),
724
});
@@ -736,7 +748,11 @@ describe("Antigravity subscription limits", () => {
748
Effect.promise(() => target.setSecret(stored)),
749
() => Effect.promise(() => target.deleteCredential()),
750
);
739
- const { probe } = yield* fixture({ missingToken: true, nativeKeyring: true });
751
+ const { probe } = yield* fixture({
752
+ authMethod: "oauth-business",
753
+ missingToken: true,
754
+ nativeKeyring: true,
755
+ });
756
const limits = yield* probe;
757
expect(limits.unavailable).toBeUndefined();
758
expect(limits.windows).toHaveLength(4);
apps/server/src/provider/antigravityUsageLimits.ts
+5
-2
@@ -41,7 +41,7 @@ const TokenFile = Schema.Struct({
41
project_id: Schema.optional(Schema.String),
42
});
43
// The 1.5.x CLI never writes acp_token.json: it keeps its sign-in in the OS keyring, or in
44
-// antigravity-oauth-token without one. It stores no OAuth client, so T3 cannot refresh it.
44
+// antigravity-oauth-token without one or when T3 bypasses the keyring. It stores no OAuth client, so T3 cannot refresh it.
45
const CliToken = Schema.Struct({
46
token: Schema.Struct({
47
access_token: Schema.NonEmptyString,
@@ -359,9 +359,12 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(
359
let projectId: string | undefined;
360
if (!(yield* fs.exists(tokenPath))) {
361
cached = undefined;
362
+ // Google account instances bypass the keyring, whose one entry every profile shares.
363
const stored = (yield* fs.exists(cliTokenPath))
364
? yield* fs.readFileString(cliTokenPath)
364
- : yield* readKeyringSecret;
365
+ : input.authMethod === "oauth-business"
366
+ ? yield* readKeyringSecret
367
+ : undefined;
368
if (stored === undefined) {
369
return makeUnavailableUsageLimits({
370
checkedAt,
docs/internals/providers.md
+4
-2
@@ -37,8 +37,10 @@ session's cwd. Provider switches still use portable handoff summaries.
37
See the [adapter](../../packages/provider-pi/src/server/adapter.ts).
38
39
Antigravity separates account profiles per instance while sharing installed executables across the
40
-environment. It forces file-based credential storage because the native macOS keychain entry would
41
-otherwise be shared across instances. The launch environment removes ambient Google credentials,
40
+environment. The 1.5 CLI keeps every profile's sign-in in one OS keyring entry and ignores
41
+`AGY_ACP_FORCE_FILE_STORAGE`; only its SSH-session check stores the sign-in in the profile, so Google
42
+account instances launch with `SSH_CONNECTION` set and sign in with `--login`. Gemini Enterprise
43
+has no such sign-in and still shares the keyring entry. The launch environment removes ambient Google credentials,
44
so an instance cannot silently use another account or billing project. The agent also resolves
45
its user-global skill directories under that profile, so the profile links those two directories
46
back to the user's real `~/.gemini`; MCP servers, hooks, and rules there stay out of the profile.