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): Codex seat workspaces with a zero credit cap are no long… · pingdotgg/t3code@69a5396

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/provider
    • codexUsageLimits.test.ts
    • codexUsageLimits.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/provider/codexUsageLimits.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/codexUsageLimits.test.ts
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ describe("codexRateLimitsToLimits", () => {
3939
expect(codexRateLimitsToUpdate(snapshot)).toEqual({ windows });
4040
});
4141

42+
it("leaves out a zero credit cap on seat-based workspaces", () => {
43+
const snapshot = {
44+
limitId: "codex",
45+
planType: "team",
46+
primary: { usedPercent: 0, windowDurationMins: 300 },
47+
secondary: { usedPercent: 14, windowDurationMins: 10080 },
48+
individualLimit: { limit: "0", remainingPercent: 0, resetsAt: 1_796_083_200 },
49+
};
50+
51+
expect(codexRateLimitsToLimits({ checkedAt, snapshot }).windows.map((w) => w.id)).toEqual([
52+
"primary",
53+
"secondary",
54+
]);
55+
expect(codexUsageLimitResetAt(snapshot)).toBeNull();
56+
});
57+
4258
it("maps primary and secondary onto the session and weekly windows", () => {
4359
expect(
4460
codexRateLimitsToLimits({
Collapse file

‎apps/server/src/provider/codexUsageLimits.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/codexUsageLimits.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface CodexRateLimitSnapshot {
2323
readonly primary?: CodexRateLimitWindow | null;
2424
readonly secondary?: CodexRateLimitWindow | null;
2525
readonly individualLimit?: {
26+
readonly limit?: string;
2627
readonly remainingPercent: number;
2728
readonly resetsAt: number;
2829
} | null;
@@ -84,7 +85,12 @@ function codexRateLimitsToWindows(
8485
});
8586
}
8687
const individualLimit = snapshot.individualLimit;
87-
if (individualLimit && Number.isFinite(individualLimit.remainingPercent)) {
88+
// Seat-based workspaces report a 0 credit cap that only applies once the seat allowance runs out.
89+
if (
90+
individualLimit &&
91+
Number.isFinite(individualLimit.remainingPercent) &&
92+
Number(individualLimit.limit) !== 0
93+
) {
8894
const resetsAt = isoFromEpochSeconds(individualLimit.resetsAt);
8995
windows.push({
9096
id: "individual",

0 commit comments

Comments
0 (0)
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.