Skip to content

feat(routing): choose quota window for earlier reset#643

Closed
wuchao05 wants to merge 2 commits into
Soju06:mainfrom
wuchao05:codex/prefer-earlier-reset-window
Closed

feat(routing): choose quota window for earlier reset#643
wuchao05 wants to merge 2 commits into
Soju06:mainfrom
wuchao05:codex/prefer-earlier-reset-window

Conversation

@wuchao05
Copy link
Copy Markdown

Summary

Adds a configurable reset window for the existing "Prefer earlier reset" routing behavior. Operators can now choose whether earlier-reset routing is driven by the primary 5-hour quota window or the secondary weekly quota window.

Why

The previous implementation always prioritized the secondary reset window. That made the setting less useful for traffic shaping when the primary 5-hour quota is the tighter operational constraint.

Changes

  • Store prefer_earlier_reset_window in dashboard settings with a migration and API/schema support.
  • Thread the selected window through account selection and proxy routing.
  • Track primary reset timestamps in balancer account state.
  • Add a dashboard select for 5h quota vs Weekly quota and update the status bar label.
  • Add backend, integration, and frontend tests for the new behavior.

Validation

  • .venv/bin/pytest tests/unit/test_load_balancer.py tests/integration/test_settings_api.py -q
  • PATH="/opt/homebrew/bin:$PATH" ./node_modules/.bin/vitest run src/features/settings/schemas.test.ts src/features/settings/components/routing-settings.test.tsx src/features/settings/hooks/use-settings.test.ts src/features/settings/components/totp-settings.test.tsx src/features/settings/components/session-settings.test.tsx
  • PATH="/opt/homebrew/bin:$PATH" ./node_modules/.bin/tsc -b
  • .venv/bin/python -m app.db.migrate check

@wuchao05 wuchao05 changed the title [codex] Add reset window preference for earlier reset routing feat(routing): choose quota window for earlier reset May 15, 2026
Copy link
Copy Markdown
Author

Superseded by #644 so the source branch follows the repository's feat/... branch naming convention.

@wuchao05 wuchao05 closed this May 15, 2026
@wuchao05 wuchao05 deleted the codex/prefer-earlier-reset-window branch May 15, 2026 10:27
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.

1 participant