Skip to content

Add routing drain and single-account modes#863

Draft
Rtx09x wants to merge 2 commits into
Soju06:mainfrom
Rtx09x:boobie/routing-drain-single-account
Draft

Add routing drain and single-account modes#863
Rtx09x wants to merge 2 commits into
Soju06:mainfrom
Rtx09x:boobie/routing-drain-single-account

Conversation

@Rtx09x
Copy link
Copy Markdown

@Rtx09x Rtx09x commented May 31, 2026

Summary

Adds dashboard-selectable routing modes for quota control:

  • sequential_drain: drains lower-capacity accounts first until exhausted.
  • reset_drain: drains accounts whose weekly quota reset is nearest first, while still skipping exhausted primary/weekly windows.
  • single_account: routes eligible proxy traffic through one selected account configured from dashboard settings.

Also adds a nullable dashboard_settings.single_account_id field, a settings dropdown that appears when single-account routing is selected, and status/settings labels for the new modes.

Behavior

Single-account mode scopes normal proxy account selection to the configured account using the existing account selection path, so account status, quota exhaustion, API-key account scope, sticky behavior, and failover error handling remain centralized.

Validation

  • uv run pytest tests/unit/test_load_balancer.py tests/integration/test_settings_api.py -q
  • uv run pytest tests/integration/test_migrations.py::test_run_startup_migrations_drops_accounts_email_unique_with_non_cascade_fks -q
  • uv run pytest tests/integration/test_settings_api.py -q
  • uv run python -m compileall app
  • npm run test -- --run src/features/settings/schemas.test.ts src/features/settings/components/routing-settings.test.tsx src/utils/constants.test.ts --pool=threads --maxWorkers=1
  • npm run build
  • git diff --check

@github-actions github-actions Bot added the db migration PR changes Alembic database migrations; maintainer must coordinate merge order label May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

db migration PR changes Alembic database migrations; maintainer must coordinate merge order

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant