Repository navigation
\ feat: operator-configurable account rotation\ - #6763
Merged
diegosouzapw merged 8 commits intoJul 11, 2026
Merged
diegosouzapw merged 8 commits into
diegosouzapw merged 8 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes OmniRoute's account-fallback rotation operator-configurable at runtime, instead of the fully hardcoded
COOLDOWN_MS/BACKOFF_CONFIG/ERROR_RULESbehavior.This is useful when a supervising front-end/orchestrator (e.g. a desktop app) manages the same set of accounts and wants the backend to rotate according to the operator's own rules — per-HTTP-status enable, per-status error threshold/window, and the rate-limit cooldown — without forking the engine.
New module
open-sse/services/rotationConfig.tsreads the config from environment variables, with an optional per-connection override taken from a connection'sproviderSpecificData.rotationOverrides. All defaults preserve the current engine behavior, so this is a no-op unless an operator sets the env vars.Config surface (all optional)
OMNIROUTE_ROTATION_ENABLEDtrueOMNIROUTE_ROTATION_RATE_LIMIT_RESET_SECONDS0(engine default)Retry-AfterhintOMNIROUTE_ROTATE_ON_429/_500/_502/_400true/true/true/falseOMNIROUTE_ROTATE_{status}_THRESHOLD1(immediate)OMNIROUTE_ROTATE_{status}_WINDOW_SECONDS120Per-connection overrides (same keys, camelCase:
rotateOn429,error429Threshold,error429WindowSeconds,rateLimitResetSeconds, …) can be supplied viaproviderSpecificData.rotationOverrides.Wiring (
checkFallbackError)1⇒ rotate immediately, unchanged).Retry-Afterhint; 5xx/capacity keep their scaled exponential backoff.Everything is pure functions + a small in-memory counter — no DB/IO on the hot path.
Tests
tests/unit/rotation-config-omniroute.test.ts— 12 cases (env parse, per-connection override merge, restrictive/additive gate semantics, sliding-window threshold, andcheckFallbackErrorintegration incl. the #4976 regression). Existing account-fallback suites stay green.