Skip to content
Merged
16 changes: 16 additions & 0 deletions apps/server/src/usage/cliproxyUsageLimits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ describe("cliproxyStatusToAccounts", () => {
},
]);
});

it("names a Codex five-hour window `primary`, as the Codex driver does", () => {
const accounts = cliproxyStatusToAccounts(
{
accounts: {
"codex-abc-someone@example.com-pro.json": {
provider: "codex",
plan: "pro",
five_hour: { hard_limited: false, known: true, used_percent: 40 },
},
},
},
checkedAt,
);
expect(accounts[0]?.usageLimits.windows.map((window) => window.id)).toEqual(["primary"]);
});
});

describe("accountEmailFromAuthFile", () => {
Expand Down
4 changes: 3 additions & 1 deletion apps/server/src/usage/cliproxyUsageLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ export function cliproxyAccountToUsageLimits(
if (!window || window.known === false) continue;
const resetsAt = isoFromHub(window.reset_at);
windows.push({
id: spec.id,
// Codex names its five-hour window by position, so a hub row and a
// native row for the same account pool together.
id: spec.key === "five_hour" && account.provider === "codex" ? "primary" : spec.id,
kind: spec.kind,
label: spec.label,
windowDurationMins: spec.windowDurationMins,
Expand Down
Loading
Loading