Repository navigation
fix(codex): keep local account cooldowns from quarantining combo targets - #7887
Conversation
Carry process-local Response provenance for ordinary account cooldown refusals through combo failure reconstruction. Use capped local target backoff without changing client retry advice or account admission and policy state. Keep upstream retry directives and all policy subclasses unchanged; cover account recovery, wire-copy forgery, the 24-hour ceiling and hard-lock behavior.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Mark and preserve local cooldown provenance src/codex/account-cooldown-response.ts, src/server/responses/codex-auth-error.ts, src/server/responses/core-combo-failure.ts, src/server/responses/core-lifetime.ts, tests/server/server-combo-cooldown-recording.test.ts |
Exact CodexAccountCooldownError instances mark their responses. Combo failure reconstruction and lifetime wrappers carry the marker. Tests check that consumption and lease wrapping preserve it, copied response content does not, and cooldown subclasses remain unmarked. |
Record combo target cooldowns src/server/responses/core-combo.ts, tests/server/server-combo-cooldown-recording.test.ts, structure/providers/openai-accounts.md, structure/runtime.md, structure/transports/responses-failover.md |
Combo target recording omits retryAfter and resetAt for marked local cooldown responses. Tests verify local cooldown backoff, upstream retry limits, and recovery after account health is cleared. The documentation describes this handling and its exclusions. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related issues
- Issue 7587: The change prevents a local Codex cooldown from applying retry and reset values to a combo target. The broader Desktop compatibility and consent design remains outside this change.
- Issue 7850: The change alters combo cooldown handling for marked local Codex cooldowns, but does not implement the proposed compaction recovery user experience.
Suggested reviewers: luvs01
Merge Risk: 
Minimal · up to 49e58
-
Local cooldowns use capped target backoff without changing client retry advice. No merge-blocking issue was identified.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 6 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
✅ Deterministic PR hygiene checks passed. |
…r mapper Move the exact-class provenance mark from cooldownErrorResponse into mapCodexAuthContextErrorToResponse, the single mapping every combo child's local auth refusal goes through. This keeps src/codex/auth-context.ts at its 1999-line size, below the 2000-line file-size ratchet threshold, and the tests now mint the refusal through that mapper.
…wrappers Retained compaction v2 delivers each child response through finalizeAccountLease, which re-creates the Response and dropped the process-local cooldown mark, so a late local refusal could again record the account's long Retry-After against the combo target. Carry the mark in both core-lifetime wrappers and cover the lease boundary with a regression.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Refs #7850 (the compaction combo cooldown follow-up in this comment). The broader quota-safe compaction proposal in that issue stays open.
When a Codex pool account is cooling down, OpenCodex refuses the request locally with HTTP 429 and a
Retry-Afterequal to that account's remaining cooldown, often hours. Inside a combo, that refusal happens before any serving account is attributed. The combo therefore recorded it as an explicit upstream delay, up to 24 hours, against the whole target. After the account recovered, direct requests worked, but the combo (for example acompactionRoutingcombo) kept reportingNo available targetswith a cooldown like84692s.This PR marks the ordinary local account-cooldown response with process-local provenance (a
WeakSet<Response>; no header or body copy can mint it). The mark is minted inmapCodexAuthContextErrorToResponse, the mapping every combo child's local auth refusal goes through. The response-lifetime wrappers incore-lifetime.ts(including the account-lease wrapper retained compaction delivers through) and combo failure reconstruction carry it, and combo target-cooldown recording ignores the restatedRetry-Afterand reset for marked responses. Those targets fall back to the existing capped local backoff (60 s default, 10 min ceiling), the same treatment Anthropic pool-local refusals already get.Unchanged: the response and
Retry-Afterthe client receives, account cooldown/quota/probe state, and genuine upstreamRetry-After(still honored up to 24 h). Main hard-lock, credit-off, Reserve, recovery-withheld and any future subclasses are excluded by exact-class check and keep their current behavior. When every account is cooling, the next attempt after the local backoff is another local refusal with no upstream send.Verification
Focused files ran with
OCX_TEST_NO_QUEUE=1because the host's shared test queue was saturated by other lanes.tests/server/server-combo-cooldown-recording.test.tswithout the fixcore-lifetime.tscarryserver-combo-cooldown-recording,combo-cooldown-reprobe,reasoning-retention-v2,translator-budget-lifetime,request-log-nonstream,file-size-ratchetbun run typecheck,bun run structure:check,bun run privacy:scan,git diff --checkStructure docs updated:
structure/runtime.md,structure/providers/openai-accounts.md,structure/transports/responses-failover.md.Hosted PR CI on head
49e5822e5passed (27 checks, includinggatesandtest changed). The first head failed the file-size ratchet becausesrc/codex/auth-context.tsgrew past 2,000 lines; moving the mint to the mapper left that file byte-identical todev. That run also timed outtests/responses/ws-native-steering.test.tsat 5,012 ms; it passed locally in 1.5 s and on both later heads.Not run locally: full
bun run testandbun run test:changed(saturated host), and a live provider, pacing/Reserve or Desktop reproduction of the reporter's incident.Checklist
Summary by CodeRabbit