Skip to content

fix(#1087): classify Codex usage-limit and throttle turn failures - #1121

Merged
admarble merged 2 commits into
mainfrom
feature/1087-bug-codex-usage-limit-turn-failures-classified-unk
Sep 20, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/1087-bug-codex-usage-limit-turn-failures-classified-unk

Conversation

@admarble

@admarble admarble commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Acceptance criteria

AC-1: usage-limit turn.failed gives BillingError with reset text in metadata (driver-conformance, codex.test.ts)
AC-2: throttle turn.failed gives retryable RateLimitError (driver-conformance, codex.test.ts)
AC-3: other turn.failed stays SequantError with code turn-failed (driver-conformance, unchanged and green)
AC-4: the real Codex-mapped BillingError stops the -Q loop; exec dispatched once, loop never (batch-executor.test.ts, new #1087 describe)
AC-5: the fixtures are the verbatim run-2 message; mutation records below

Judgement calls

  • OQ-1: a usage-limit reset within 7 days maps to RateLimitError (so --auto-wait can engage); beyond, past, or unparseable maps to BillingError (fail closed). The 7-day horizon is a driver-side constant because the driver cannot see autoWaitMinutes. Needs owner confirmation.
  • OQ-2: the top-level error event with no turn.failed is not widened; it stays generic.
  • OQ-3: rate_limits in the codex exec --json stream is unverified (not observed in the run-2 stdoutTail, which is only the last 50 lines); no live stream was scanned. The mapping does not depend on it.

Verification

Ran only the named files (runner rules): codex.test.ts, driver-conformance.test.ts, batch-executor.test.ts, plus src/lib/workflow/drivers: all green. npm run build and npm run lint clean. Full npm test left to the runner.

Mutation-verified: AC-1 — broke the usage-limit regex; driver-conformance usage-limit case failed; restored.
Mutation-verified: AC-4 — same mutation; the #1087 batch-executor case failed; restored.

Closes #1087

🤖 Generated with Claude Code

Runner verification (guard-2026-09 wave 2, 2026-09-20)

  • qa: AC_MET_BUT_NOT_A_PLUS. Runner ran codex.test.ts (45 passed), the conformance codex group (8 passed, the two former it.fails cases now plain and green) and the #1087 batch-executor case (1 passed); both markers classifier-valid; the batch-executor.test.ts change is one appended block.
  • Full npm test from a clean shell on 052fedc5: 329 files, 6627 passed, 1 expected fail, 3 skipped, 354 s. CI green.

@admarble
admarble merged commit 5917cf8 into main Sep 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(codex): usage-limit turn failures classified 'unknown' — quality loop re-runs into the same quota, --auto-wait can't engage

1 participant