GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): Antigravity limits prefer the CLI's sign-in over a stale ACP token by MohamedSayed0573 · Pull Request #40737 · pingdotgg/t3code

fix(server): Antigravity limits prefer the CLI's sign-in over a stale ACP token #40737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MohamedSayed0573 wants to merge 1 commit into pingdotgg:main from MohamedSayed0573:fix/antigravity-usage-limits-stale-token
+50 −15
Closed

fix(server): Antigravity limits prefer the CLI's sign-in over a stale ACP token #40737

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
8fdcaae
fix(server): Antigravity limits prefer the CLI's sign-in over a stale…
MohamedSayed0573 Nov 22, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
fix(server): Antigravity limits prefer the CLI's sign-in over a stale…
… ACP token
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@MohamedSayed0573
MohamedSayed0573 committed Nov 22, 2026
commit 8fdcaae970e62bb020ec43329040e46d10fe553c

There are no files selected for viewing

35 changes: 34 additions & 1 deletion 35 apps/server/src/provider/antigravityUsageLimits.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* (
keyringSecret?: string;
/** Reads the OS keyring instead of `keyringSecret`. */
nativeKeyring?: boolean;
/** The CLI sign-in supplies no project, so quota requests carry an empty body. */
cliSignIn?: boolean;
} = {},
) {
const fs = yield* FileSystem.FileSystem;
Expand Down Expand Up @@ -119,7 +121,9 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* (
: Response.json({}, { status: 403 }),
);
}
expect(JSON.parse(body)).toEqual(options.missingToken ? {} : { project: "project-id" });
expect(JSON.parse(body)).toEqual(
options.missingToken || options.cliSignIn ? {} : { project: "project-id" },
);
expect(request.headers["user-agent"]).toMatch(/^antigravity\/hub\/2\.24\.0 /);
return HttpClientResponse.fromWeb(
request,
Expand Down Expand Up @@ -691,6 +695,35 @@ describe("Antigravity subscription limits", () => {
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
);

it.effect("prefers the native CLI's sign-in over a leftover acp_token.json", () =>
Effect.gen(function* () {
yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-09T12:00:00Z")));
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const writeCliToken = (tokenPath: string, expiry: string) =>
fs.writeFileString(
path.join(path.dirname(tokenPath), "antigravity-oauth-token"),
JSON.stringify({
token: { access_token: "access-token", refresh_token: "refresh-a", expiry },
}),
);

const signedIn = yield* fixture({ userId: "google-user-1", cliSignIn: true });
yield* writeCliToken(signedIn.tokenPath, "2026-10-09T14:00:00Z");
const limits = yield* signedIn.probe;
expect(limits.unavailable).toBeUndefined();
expect(limits.windows).toHaveLength(4);
expect(signedIn.requests.some((request) => request.url.endsWith("/token"))).toBe(false);

const expired = yield* fixture();
yield* writeCliToken(expired.tokenPath, "2026-10-09T12:00:30Z");
const expiredLimits = yield* expired.probe;
expect(expiredLimits.unavailable?.reason).toBe("probeFailed");
expect(expiredLimits.unavailable?.message).toContain("expired");
expect(expired.requests).toEqual([]);
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
);

it.effect("reads a Gemini Enterprise keyring sign-in and reports when it has expired", () =>
Effect.gen(function* () {
yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-09T12:00:00Z")));
Expand Down
30 changes: 16 additions & 14 deletions 30 apps/server/src/provider/antigravityUsageLimits.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,16 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(
let accessToken: string;
let account: string;
let projectId: string | undefined;
if (!(yield* fs.exists(tokenPath))) {
// The agent runs with the CLI's own sign-in. A leftover acp_token.json from an older
// integration can hold a different account, so only fall back to it when the CLI has none.
// Google account instances bypass the keyring, whose one entry every profile shares.
const stored = (yield* fs.exists(cliTokenPath))
? yield* fs.readFileString(cliTokenPath)
: input.authMethod === "oauth-business"
? yield* readKeyringSecret.pipe(Effect.orElseSucceed(() => undefined))
: undefined;
if (stored !== undefined && stored.length > 0) {
cached = undefined;
// Google account instances bypass the keyring, whose one entry every profile shares.
const stored = (yield* fs.exists(cliTokenPath))
? yield* fs.readFileString(cliTokenPath)
: input.authMethod === "oauth-business"
? yield* readKeyringSecret
: undefined;
if (stored === undefined) {
return makeUnavailableUsageLimits({
checkedAt,
reason: "unsupported",
message: "Sign in with Google to see Antigravity limits.",
});
}
const { token } = yield* decodeCliToken(stored);
if (!(Date.parse(token.expiry ?? "") > now + 60_000)) {
return makeUnavailableUsageLimits({
Expand All @@ -390,6 +385,13 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(
Effect.flatMap(antigravityAccountFingerprint),
Effect.catch(() => sha256(`antigravity-cli\0${token.refresh_token || accessToken}`)),
);
} else if (!(yield* fs.exists(tokenPath))) {
cached = undefined;
return makeUnavailableUsageLimits({
checkedAt,
reason: "unsupported",
message: "Sign in with Google to see Antigravity limits.",
});
} else {
const token = yield* fs.readFileString(tokenPath).pipe(Effect.flatMap(decodeTokenFile));
projectId = token.project_id;
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.