Repository navigation
fix(combos): fail over provider-scoped quota caps - #3298
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe change classifies quota failures as provider-scoped, returns ChangesCombo failover cooldown scope
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change keeps quota-triggered failover bounded to configured candidates while preserving terminal handling for generic invalid requests. No actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Upstream
participant handleComboResponses
participant comboFailureCooldownScope
participant advanceComboAfterFailure
participant ComboTargets
Upstream->>handleComboResponses: return failure status, message, and code
handleComboResponses->>comboFailureCooldownScope: classify failure
comboFailureCooldownScope-->>handleComboResponses: provider or target scope
handleComboResponses->>advanceComboAfterFailure: advance with cooldown scope
advanceComboAfterFailure->>ComboTargets: cool matching targets
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Title checkExplanation The title clearly and concisely describes the main change: combo failover for provider-scoped quota caps. It matches the changes in the failover logic, cooldown behavior, exports, server handling, and tests.
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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 |
리뷰 · 우선순위 60 / 80이 PR는 콤보(여러 모델/프로바이더를 순서대로 시도하는 기능)가 프로바이더 단위로 막힌 무료/월간 할당량을 만났을 때 행동을 고칩니다. 지금 이번 변경은 세 겹입니다. (1) 다만 게이트 상태가 아직 머지 대기열이 아닙니다. 제목에 라인 단위로 보면 이런 점이 남습니다.
메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3b9dde62d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const cooldownTargets = options.cooldownScope === "provider" && combo | ||
| ? combo.targets.filter(target => target.provider === pick.target.provider) | ||
| : [pick.target]; |
There was a problem hiding this comment.
Document provider-scoped combo cooldowns
When this branch classifies a failure as provider-scoped, it now cools every sibling target for that provider, but docs-site/src/content/docs/guides/combos.md:198-208 still states that only the failed target is cooled. Users may therefore configure same-provider fallbacks expecting them to remain eligible when free-tier or monthly caps now skip them; update the English guide and translated copies to describe these provider-wide cases.
AGENTS.md reference: src/AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
# Conflicts: # src/combos/resolve.ts # tests/combos.test.ts
f3b9dde to
58e4e75
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58e4e75bff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (const target of cooldownTargets) { | ||
| coolComboTarget(pick.comboId, target, { | ||
| ...options, | ||
| writerGeneration: pick.writerGeneration, |
There was a problem hiding this comment.
Preserve longer cooldowns when cooling provider siblings
When another target from this provider is already cooling for longer—for example, a previous failure supplied a 10-minute Retry-After—a provider-scoped failure on the current target calls coolComboTarget for that sibling too, and coolComboTarget unconditionally overwrites its entry. A headerless monthly/free-tier failure therefore shortens the sibling's cooldown to the 60-second default and makes it eligible while its original cooldown is still active. Skip siblings already in cooldown or retain the maximum existing cooldownUntil when applying the provider-wide cooldown.
Useful? React with 👍 / 👎.
# Conflicts: # src/combos/resolve.ts # tests/combos.test.ts
# Conflicts: # src/combos/resolve.ts # tests/combos.test.ts
Treat provider-specific free-tier prompt caps (HTTP 400 + free_rate_limited) as combo-local failover instead of terminal invalid requests. When an upstream signals provider/account-wide exhaustion such as OpenCode Go monthly quota, cool sibling models from the same provider together so the combo moves directly to another provider. Generic invalid_request_error remains terminal.\n\nTests: bun test tests/combos.test.ts (46/46); bun run typecheck.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
New Features
Bug Fixes