Skip to content

fix(accounts): carry failure kind on rotation — transient cools down, terminal evicts - #11008

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.50from
maxmad64bis:fix/account-rotation-eviction
Aug 21, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.50from
maxmad64bis:fix/account-rotation-eviction

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ release/v3.8.50 is red (#9985) — based on upstream/release/v3.8.50 at c130f2aa1.

Summary

When a multi-account provider fails, OmniRoute backs off one account and picks another. Right now a temporary quota on one account and a dead credential look the same — both just cool down and get retried forever. This PR teaches the rotation to tell them apart: temporary failures only cool down, repeated permanent failures retire that account from rotation until a success clears it.

No new table or setting — just an in-memory flag reset on success or on the next account sync. Single-account providers are unchanged.

Related Issues

Related to #11006

Changes

  • open-sse/executors/accountRotation.ts — markCooldown now takes kind transient (quota, network) vs terminal (permanent), defaulting to transient so every existing caller stays valid; after 3 consecutive terminals the account is evicted and skipped by pickAccount unless every account is evicted (always returns an account rather than hanging); markSuccess clears the eviction
  • open-sse/executors/opencode.ts — wrapper forwards the kind (no caller passes terminal yet — that mapping belongs to a follow-up, see Reviewer Notes)
  • tests/unit/account-rotation-lot-c.test.ts — 5 tests: transient never evicts, terminal evicts at 3 and is skipped, all-evicted fallback still returns an account, success clears

Testing

  • node --import tsx/esm --test tests/unit/account-rotation*.test.ts — 17/17
  • npm run lint / typecheck:core / check:cycles — 0 / 0 / OK

Checklist

  • Focused checks rerun after rebase (n/a — fresh worktree on c130f2aa1)
  • Reconciled with the current active release base; focused checks rerun afterward (base-red — will rebase when release/v3.8.50 turns green)
  • No AI attribution

Reviewer Notes

  • The threshold 3 is just a testable bound, not a rule — adjust it in review.
  • No caller passes terminal yet; wiring a real classification (e.g. account deactivated) is deliberately deferred to avoid coupling rotation to error taxonomy in this PR.
  • Eviction is in-memory only, cleared on success or on the next sync from config — a restart clears it too, which is fine for a cooldown-tier state (unlike a banned connection).

@maxmad64bis
maxmad64bis force-pushed the fix/account-rotation-eviction branch from 854a916 to 7c6308e Compare August 21, 2026 14:55
@diegosouzapw
diegosouzapw merged commit bc0a272 into cheaper-inference:release/v3.8.50 Aug 21, 2026
7 of 16 checks passed
Sa3id23 pushed a commit to Sa3id23/OmniRoute that referenced this pull request Aug 21, 2026
… terminal evicts (cheaper-inference#11008)

⭐5 — Rotação de conta não distinguia falha transitória (quota) de terminal (credencial morta) — ambas só esfriavam e eram retentadas para sempre. Agora markCooldown aceita kind transient/terminal; 3 terminais consecutivos evictam a conta (com fallback para não travar se todas evictadas). TDD, 17/17 testes, lint/typecheck/cycles OK.
@maxmad64bis
maxmad64bis deleted the fix/account-rotation-eviction branch September 24, 2026 21:12
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
… terminal evicts (cheaper-inference#11008)

⭐5 — Rotação de conta não distinguia falha transitória (quota) de terminal (credencial morta) — ambas só esfriavam e eram retentadas para sempre. Agora markCooldown aceita kind transient/terminal; 3 terminais consecutivos evictam a conta (com fallback para não travar se todas evictadas). TDD, 17/17 testes, lint/typecheck/cycles OK.
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.

2 participants