Skip to content

Commit 57b479b

Browse files
committed
Pin TUI copy for Codex short 429s and credential failure
1 parent 11bd2c2 commit 57b479b

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

src/agent/retry-policy.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,23 @@ describe("createCorbitsRetryPolicy", () => {
6969
raw: { error: { message: "Too Many Requests" } },
7070
},
7171
});
72-
// Remapped to retryable → default backoff, not abort on moderate Retry-After.
72+
// Remapped to retryable -> default backoff, not abort on moderate Retry-After.
73+
expect(decision).toEqual({ kind: "retry", delayMs: 500 });
74+
});
75+
76+
test("stamped Codex bare 429 retries as retryable, not long-quota abort", async () => {
77+
const policy = createCorbitsRetryPolicy({ providerId: "codex/abk-labs" });
78+
const decision = await policy({
79+
attempt: 1,
80+
elapsedMs: 0,
81+
error: {
82+
category: "quota_exhausted",
83+
message: "You have hit your ChatGPT usage limit",
84+
statusCode: 429,
85+
retryAfterMs: 45_000,
86+
raw: "You have hit your ChatGPT usage limit",
87+
},
88+
});
7389
expect(decision).toEqual({ kind: "retry", delayMs: 500 });
7490
});
7591

src/tui/stream-event-map.test.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe("inference.error text", () => {
314314

315315
test("a classified failure gets its written line, not the provider body", () => {
316316
expect(message({ category: "credential_failure", message: '{"error":{"code":401}}' })).toBe(
317-
"Session expiredre-authenticating…",
317+
"Authentication failedlog in again.",
318318
);
319319
expect(message({ category: "quota_exhausted", message: "429" })).toBe(
320320
"Quota exhausted — usage limit reached.",
@@ -371,6 +371,29 @@ describe("inference.error text", () => {
371371
expect(event.message).not.toContain("Quota exhausted");
372372
});
373373

374+
test("ctx.providerId Codex + ChatGPT usage-limit 429 shows rate-limit copy", () => {
375+
const ctx = createStreamMapContext({ providerId: "codex/abk-labs" });
376+
const [event] = mapProductionEvent(
377+
{
378+
type: "inference.error",
379+
data: {
380+
error: {
381+
category: "quota_exhausted",
382+
message: "You have hit your ChatGPT usage limit",
383+
statusCode: 429,
384+
raw: "You have hit your ChatGPT usage limit",
385+
},
386+
},
387+
},
388+
ctx,
389+
);
390+
expect(event?.type).toBe("error");
391+
if (event?.type !== "error") return;
392+
expect(event.message.toLowerCase()).toMatch(/rate limit/);
393+
expect(event.message).not.toContain("Quota exhausted");
394+
expect(event.message.toLowerCase()).not.toContain("usage limit reached");
395+
});
396+
374397
test("bare quota_exhausted 429 without ctx/provider still shows Quota exhausted", () => {
375398
expect(
376399
message({

0 commit comments

Comments
 (0)