Skip to content

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

Closed
wuchao05 wants to merge 10 commits into
Soju06:mainfrom
wuchao05:feat/routing-reset-window-preference
Closed

feat(routing): choose quota window for earlier reset#644
wuchao05 wants to merge 10 commits into
Soju06:mainfrom
wuchao05:feat/routing-reset-window-preference

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. The default remains the weekly quota window to preserve existing behavior.

Why

The previous implementation always prioritized the secondary reset window. This keeps that default behavior while allowing operators to opt into the primary 5-hour window when that 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 default weekly behavior and explicit 5h 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
  • Temporary fresh SQLite DB: python -m app.db.migrate --db-url <tmp sqlite> upgrade && python -m app.db.migrate --db-url <tmp sqlite> check

@wuchao05 wuchao05 marked this pull request as ready for review May 15, 2026 10:29
@Komzpa
Copy link
Copy Markdown
Collaborator

Komzpa commented May 16, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8193eed39e

ℹ️ 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".

Comment thread app/core/balancer/logic.py Outdated
@Komzpa Komzpa added 🤖 codex: needs work [@codex review] raised an issue 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: needs work [@codex review] raised an issue 🤖 codex: ok [@codex review] says no issues found. labels May 16, 2026
@wuchao05
Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa
Copy link
Copy Markdown
Collaborator

Komzpa commented May 21, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 461c5e9a2e

ℹ️ 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".

Comment thread app/modules/proxy/service.py Outdated
@Soju06 Soju06 added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels May 21, 2026
@Komzpa Komzpa added the db migration PR changes Alembic database migrations; maintainer must coordinate merge order label May 21, 2026
@Komzpa Komzpa force-pushed the feat/routing-reset-window-preference branch from e6485d6 to 746b1a5 Compare May 22, 2026 16:02
@Komzpa
Copy link
Copy Markdown
Collaborator

Komzpa commented May 22, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e4e503419

ℹ️ 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".

Comment thread app/core/balancer/logic.py Outdated
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 22, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label May 22, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 22, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f759e6451

ℹ️ 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".

Comment thread app/core/balancer/logic.py Outdated
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label May 22, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label May 22, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 22, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ 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".

@Soju06 Soju06 added 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: ok [@codex review] says no issues found. labels May 22, 2026
@Komzpa
Copy link
Copy Markdown
Collaborator

Komzpa commented May 27, 2026

Closing this as superseded by #795, which rebases and repairs this reset-window routing preference work on current main while preserving credit for the original implementation.

#795 is clean/mergeable and has the current CI/Codex evidence; keeping this old conflicted branch open would duplicate the same feature surface.

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.

3 participants