reset.restoresPercent > 0);
+ const m = useMessages();
+ const gt = useGT();
+ const nextReset = pool.resets[0];
return (
@@ -617,18 +625,27 @@ function PoolWindowCard({
- left
+ {pool.members.length > 1 ? (
+ average left
+ ) : (
+ left
+ )}
{pool.pace ? : null}
- {nextRefill && pool.columns.length > 1 ? (
+ {pool.members.length > 1 ? (
+
+ {gt("Across {count} accounts", { count: pool.members.length })}
+
+ ) : null}
+ {nextReset && providerAccountCount > 1 ? (
- ↻ +{nextRefill.restoresPercent}%
+ {formatResetsIn(nextReset.member.window, now, m, "account")}
) : null}
-
+
{description ? (
{description}
) : null}
@@ -660,6 +677,7 @@ function PoolSection({ pool, now }: { readonly pool: LimitPool; readonly now: nu
{
});
});
- it("preserves gaps without counting missing windows toward pooled quota", () => {
+ it("fills each row with only accounts reporting that window", () => {
const [pool] = collectLimitPools(
[
account("a", [window]),
@@ -1353,18 +1353,49 @@ describe("pooled account columns", () => {
{ ...weekly, usedPercent: 80 },
]),
account("c", [weekly]),
+ {
+ ...account("capped", []),
+ limits: { checkedAt: "2026-09-03T11:00:00.000Z", windows: [], zeroSpendCap: true },
+ },
+ account("monthly", [{ ...window, kind: "monthly" }]),
],
now,
);
expect(keys(pool!)).toEqual([
- ["a", "b", null],
- [null, "b", "c"],
+ ["a", "b"],
+ ["b", "c"],
+ [null, "monthly"],
+ ]);
+ expect(pool!.windows[2]!.columns.map(({ account }) => account.key)).toEqual([
+ "capped",
+ "monthly",
]);
expect(pool!.windows[1]!.members.map((member) => member.account.key)).toEqual(["b", "c"]);
expect(pool!.windows[1]!.remainingPercent).toBe(40);
expect(pool!.windows[1]!.resets.map((reset) => reset.restoresPercent)).toEqual([40, 20]);
});
+ it("gives two Codex session accounts equal slots and a monthly-only account its own full row", () => {
+ const codex = (key: string, windows: LimitAccount["limits"]["windows"]) => ({
+ ...account(key, windows),
+ driver: ProviderDriverKind.make("codex"),
+ });
+ const [pool] = collectLimitPools(
+ [
+ codex("a", [window, { ...weekly, usedPercent: 90 }]),
+ codex("b", [window, { ...weekly, usedPercent: 100 }]),
+ codex("monthly", [{ ...window, kind: "monthly", usedPercent: 2 }]),
+ ],
+ now,
+ );
+ expect(keys(pool!)).toEqual([["a", "b"], ["a", "b"], ["monthly"]]);
+ expect(pool!.windows[1]!.remainingPercent).toBe(5);
+ expect(pool!.windows[1]!.members.map((member) => 100 - member.window.usedPercent)).toEqual([
+ 10, 0,
+ ]);
+ expect(pool!.windows[2]!.remainingPercent).toBe(98);
+ });
+
it("falls back to weekly resets when no account reports a session", () => {
const [pool] = collectLimitPools(
[
diff --git a/packages/shared/src/usageLimits.ts b/packages/shared/src/usageLimits.ts
index 711f3637d0a9f..f2e8867f94104 100644
--- a/packages/shared/src/usageLimits.ts
+++ b/packages/shared/src/usageLimits.ts
@@ -728,9 +728,14 @@ function poolWindows(accounts: readonly LimitAccount[], now: number): readonly L
kind: first.kind,
label: first.label,
members,
- columns: accounts.map(
- (account) => memberByAccount.get(account.key) ?? { account, window: null },
- ),
+ columns: accounts.flatMap((account) => {
+ const member = memberByAccount.get(account.key);
+ return member
+ ? [member]
+ : first.kind === "monthly" && account.limits.zeroSpendCap
+ ? [{ account, window: null }]
+ : [];
+ }),
usedPercent: Math.round(usedPercent),
remainingPercent: Math.round(100 - usedPercent),
pace: meanElapsed === null ? null : paceOfShares(timedUsed, meanElapsed),
diff --git a/packages/shared/src/usageLimitsCopy.ts b/packages/shared/src/usageLimitsCopy.ts
index 85f78e0f11f28..abe3f530d1ab7 100644
--- a/packages/shared/src/usageLimitsCopy.ts
+++ b/packages/shared/src/usageLimitsCopy.ts
@@ -214,10 +214,17 @@ export function formatResetsIn(
window: ServerProviderUsageWindow,
now: number,
resolve: MFunctionType = mFallback,
- style: "full" | "in" | "refill" = "full",
+ style: "full" | "in" | "refill" | "account" = "full",
): string | null {
const countdown = resetCountdown(window, now);
if (countdown === null) return null;
+ if (style === "account") {
+ if (countdown.kind === "now") return resolve(msg("Next account reset now"));
+ if (countdown.kind === "momentarily") return resolve(msg("Next account reset momentarily"));
+ return resolve(
+ msg("Next account reset in {duration}", { duration: formatDuration(countdown.ms, resolve) }),
+ );
+ }
if (countdown.kind === "now") return resolve(msg("resets now"));
if (countdown.kind === "momentarily") return resolve(msg("Resets momentarily"));
const duration = formatDuration(countdown.ms, resolve);