Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Usage menu: Gemini's own allowance only, and a hold shown as the engine's

laijsg14740c6f1e003
diff --git a/packages/phone-protocol/src/limit-reset.ts b/packages/phone-protocol/src/limit-reset.ts
index 0f30675e69..fb89d219ef 100644
--- a/packages/phone-protocol/src/limit-reset.ts
+++ b/packages/phone-protocol/src/limit-reset.ts
@@ -51,8 +51,9 @@ export interface EngineLimit {
/** Blocked only by a refusal's hold, which "Try again now" can end; absent when a window at its limit blocks it. */
held?: boolean;
/** Whose allowance the windows measure when it is not the whole engine's: "Gemini" on Antigravity, whose other models
- * draw on allowances of their own. Such windows are shown only: they never hold the engine or time its reset, so
- * `blocked`, `resetsAt` and the limit-reset automations do not follow them. Absent when the windows are the engine's. */
+ * draw on allowances of their own. Such a limit is shown only: it is never `blocked`, its `resetsAt` is that window's
+ * reset and not the engine's, and no limit-reset automation waits for it. Absent when the windows are the engine's; a
+ * hold on the whole engine is reported without it. */
meter?: string;
/** Every window the engine reported, in the engine's order. A server that predates it sends only the deciding window above. */
windows?: LimitWindowUsage[];
diff --git a/server/drivers/antigravity-usage-limits.test.ts b/server/drivers/antigravity-usage-limits.test.ts
index 68b0ccf658..b55a373072 100644
--- a/server/drivers/antigravity-usage-limits.test.ts
+++ b/server/drivers/antigravity-usage-limits.test.ts
@@ -300,6 +300,20 @@ describe("Antigravity subscription limits", () => {
expect(all.every((window) => window.kind === "other" && window.windowDurationMins === undefined)).toBe(true);
});
+ it("keeps Argon and Carbon apart from Gemini's own allowance in the model quotas", async () => {
+ const { windows } = fixture({
+ summaryStatus: 404,
+ models: { models: {
+ "gemini-a": { modelProvider: "MODEL_PROVIDER_GOOGLE", weeklyQuotaInfo: { remainingFraction: 0.75, resetTime: "2026-10-12T12:00:00Z" } },
+ "gemini-4-argon": { modelProvider: "MODEL_PROVIDER_GOOGLE", weeklyQuotaInfo: { remainingFraction: 0, resetTime: "2026-10-11T12:00:00Z" } },
+ "gemini-4-carbon": { modelProvider: "MODEL_PROVIDER_GOOGLE", weeklyQuotaInfo: { remainingFraction: 0.5, resetTime: "2026-10-13T12:00:00Z" } },
+ } },
+ });
+ const row = antigravityPlanWindows(await windows());
+ expect(row.weekly).toMatchObject({ usedPercent: 25, resetsAt: "2026-10-12T12:00:00.000Z" });
+ expect(row.models.map((model) => [model.name, model.windows.map((window) => window.usedPercent)])).toEqual([["Gemini Argon", [100]], ["Gemini Carbon", [50]]]);
+ });
+
it("skips disabled and missing fractions and clamps valid percentages", async () => {
const { windows } = fixture({
summary: { buckets: [
diff --git a/server/drivers/antigravity-usage-limits.ts b/server/drivers/antigravity-usage-limits.ts
index a75d97a2cb..88a730eb9f 100644
--- a/server/drivers/antigravity-usage-limits.ts
+++ b/server/drivers/antigravity-usage-limits.ts
@@ -15,6 +15,7 @@ import { readFile, stat } from "node:fs/promises";
import type { PlanExtra, PlanFetch, PlanModelUsage, PlanWindow, PlanWindows } from "../plan-usage.ts";
import { antigravityTokenPath } from "./antigravity-acp.ts";
import { refreshAntigravityAccess } from "./antigravity-account.ts";
+import { antigravityQuotaFamily } from "./antigravity-turn-outcome.ts";
/** Whether Antigravity accounts are asked for their limits at all. Off, they have no row in the usage report. */
export const ANTIGRAVITY_USAGE_LIMITS = true;
@@ -162,6 +163,8 @@ export function antigravitySummaryWindows(response: unknown, requestedAt: number
return [...windows.values()];
}
+const GEMINI_FAMILIES: Readonly<Record<string, string>> = { "gemini-argon": "Gemini Argon", "gemini-carbon": "Gemini Carbon" };
+
/** Older accounts expose model quotas without a window length. Do not invent a reset cadence. */
export function antigravityModelWindows(response: unknown): AntigravityUsageWindow[] {
const models = record(record(response)?.models);
@@ -171,7 +174,7 @@ export function antigravityModelWindows(response: unknown): AntigravityUsageWind
const model = record(value);
if (!model) continue;
const family = model.modelProvider === "MODEL_PROVIDER_GOOGLE" || modelId.startsWith("gemini-")
- ? "Gemini"
+ ? GEMINI_FAMILIES[antigravityQuotaFamily(modelId)] ?? "Gemini"
: model.modelProvider === "MODEL_PROVIDER_ANTHROPIC" || modelId.startsWith("claude-")
? "Claude"
: model.modelProvider === "MODEL_PROVIDER_OPENAI" || modelId.startsWith("gpt-")
@@ -181,7 +184,7 @@ export function antigravityModelWindows(response: unknown): AntigravityUsageWind
for (const [suffix, entry] of [["quota", quota(model.quotaInfo)], ["weekly", quota(model.weeklyQuotaInfo)]] as const) {
if (!entry) continue;
const window = quotaWindow(
- `${family.toLowerCase()}-${suffix}`,
+ `${family.toLowerCase().replaceAll(" ", "-")}-${suffix}`,
family,
suffix === "weekly" ? "Weekly" : "Reported quota",
entry,
diff --git a/server/limit-resets.test.ts b/server/limit-resets.test.ts
index b3f0c51a5c..6975fc856d 100644
--- a/server/limit-resets.test.ts
+++ b/server/limit-resets.test.ts
@@ -278,11 +278,15 @@ describe("an Antigravity account's usage", () => {
expect(instance.resetAt("antigravity")).toBeNull();
});
- it("never ends a hold on the engine by Gemini's windows", () => {
+ it("never ends a hold on the engine by Gemini's windows, and shows the hold as the whole engine's", () => {
const instance = new LimitResetClock({ accounts: () => accounts, now: () => NOW });
instance.noteRefusal("antigravity", NOW + 5 * HOUR);
instance.noteUsage(report(antigravity([10, NOW + 2 * HOUR], [20, NOW + 60 * HOUR])));
expect(instance.blockedUntil("antigravity")).toBe(NOW + 5 * HOUR);
+ const held = instance.limit("antigravity")!;
+ expect(held).toMatchObject({ engine: "antigravity", name: "Antigravity", driver: "antigravity", blocked: true, held: true, resetsAt: NOW + 5 * HOUR });
+ expect(held.meter).toBeUndefined();
+ expect(held.windows).toBeUndefined();
});
it("has no row when Google gave nothing usable, or only allowances other than Gemini's", () => {
diff --git a/server/limit-resets.ts b/server/limit-resets.ts
index bf3002ba9b..c2b7eec634 100644
--- a/server/limit-resets.ts
+++ b/server/limit-resets.ts
@@ -168,8 +168,9 @@ export class LimitResetClock {
const engines = new Map([...this.usage].filter(([engine]) => this.reading(engine)));
for (const engine of this.refusals.keys()) {
const until = this.blockedUntil(engine);
- const known = engines.get(engine);
+ const reading = engines.get(engine);
if (until === null) continue;
+ const known = reading?.meter ? undefined : reading;
const limit: EngineLimit = { ...(known ?? this.unnamed(engine)), blocked: true, usedPercent: 100, resetsAt: this.guessed.has(engine) ? known?.resetsAt ?? null : until };
if (!known?.blocked) limit.held = true;
engines.set(engine, limit);