Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f9d00d6a5
ℹ️ 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".
4f9d00d to
414d16b
Compare
09a0580 to
22e62ff
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9d1dc2a1c
ℹ️ 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".
|
Thanks @Komzpa -- the policy/health-tier ordering, the OAuth re-auth heal path, and the P2 -- normalize legacy account.routing_policy in the mapper
_VALID_ROUTING_POLICIES = {"normal", "burn_first", "preserve"}
def _coerce_routing_policy(value: str | None) -> str:
if value not in _VALID_ROUTING_POLICIES:
return "normal"
return valueThen call P2 -- reject invalid additional_quota_routing_policies entriesThe override normalizer in The accounts mapper case is about tolerating historical bad data, but settings updates are new user input -- those should fail loud:
The existing settings update flow already handles def test_additional_quota_policy_rejects_unknown_slug()
def test_additional_quota_policy_rejects_unknown_policy_value()These should each assert a 422 (or whatever shape the existing settings update uses for client validation) and that the stored Not blockingThe OpenSpec change, the migrations, and the routing-policy pool wiring all look right. Only the two input-validation P2s above. Once those are in I'll re-run (Heads-up: #555 is still red in your stack -- one unit test on |
|
To use Codex here, create an environment for this repo. |
eb65480 to
27eba3b
Compare
b5e6c62 to
1b6a205
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3131a8f6bc
ℹ️ 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".
| latest_primary = additional_filter.latest_primary | ||
| latest_secondary = additional_filter.latest_secondary |
There was a problem hiding this comment.
Keep additional-quota windows out of persisted account status
When effective_limit_name is set, this path feeds additional_usage snapshots into latest_primary/latest_secondary, and those states are later persisted via _persist_selection_state() as canonical accounts.status/reset_at. That means an additional-quota request can overwrite standard quota state (e.g., flip a standard QUOTA_EXCEEDED account back to ACTIVE because the additional pool is under 100%), which then incorrectly re-enables regular Codex routing until another standard usage refresh runs. This regression is introduced here because pre-change persistence was based on standard usage_history, not the additional pool.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f498212dc
ℹ️ 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".
| @@ -136,6 +155,8 @@ async def load_selection_inputs() -> _SelectionInputs: | |||
| runtime_accounts=selection_inputs.runtime_accounts, | |||
There was a problem hiding this comment.
Carry persist flag when rebuilding selection inputs
When exclude_account_ids is set, this branch rebuilds _SelectionInputs but omits persist_standard_quota_status, so it silently falls back to the dataclass default (True). For additional-quota-gated routing, _load_selection_inputs intentionally sets this flag to False; dropping it here re-enables _persist_selection_state and can write standard account status changes during additional-quota selection retries (the path used with additional_limit_name plus exclusions in ProxyService._select_account_with_budget). This can corrupt normal quota/status state and should preserve the original flag.
Useful? React with 👍 / 👎.
87dad14 to
32a3103
Compare
32a3103 to
bcf8ff6
Compare
|
Maintainer cleanup: closing this as stale / no longer merge-ready against the current This PR has been open across substantial main-branch churn and is currently carrying at least one stale signal (conflicts/blocked or failing checks, outstanding If the change is still needed, please open a fresh, focused PR rebased on current |
|
Revived on a maintainer-owned branch as #761 because this PR head has maintainerCanModify=false and cannot be updated here. Keeping credit to the original implementation in the replacement PR. |
Summary
burn_first,normal, andpreserve.inherit,burn_first,normal, andpreserve.codex_sparkadditional quota limit toburn_first, so Spark quota can be burned independently while standard Codex calls keep using ordinary account routing.__copyNwhen import-without-overwrite is enabled.Relationship to #545 and #567
This is the narrow version of the account-priority/routing behavior discussed in #545. It intentionally avoids the reset-display, quota-appearance, Docker/dev-deploy, and broader dashboard sorting changes from that PR so the routing contract can be reviewed independently.
#567 builds on this PR for opportunistic worker admission and traffic classes. The Spark/additional-quota routing policy lives here so the policy UI and routing contract are reviewed together with manual account routing.
Re-auth behavior
importWithoutOverwritestill preserves active duplicate imports as separate__copyNaccounts. A re-authorized account with the same generated account id that is currentlydeactivatedis treated as healing that account: fresh tokens/status/plan are written to the existing row, while manual routing policy and account history stay attached to the original account.Validation
openspec validate add-manual-account-routing-policy --strict --no-interactive/home/kom/proj/codex-lb/.venv/bin/python -m ruff check app/core/balancer/logic.py app/db/models.py app/db/alembic/versions/20260509_010000_add_additional_quota_routing_policies.py app/modules/proxy/load_balancer.py app/modules/settings app/modules/accounts app/modules/usage/additional_quota_keys.py tests/unit/test_load_balancer.py tests/integration/test_load_balancer_integration.py tests/integration/test_settings_api.py tests/integration/test_additional_usage_flow.py/home/kom/proj/codex-lb/.venv/bin/python -m pytest tests/unit/test_load_balancer.py tests/integration/test_load_balancer_integration.py tests/integration/test_settings_api.py tests/integration/test_additional_usage_flow.py tests/integration/test_migrations.py -qcd frontend && bun run test -- src/features/settings/schemas.test.ts src/features/settings/components/routing-settings.test.tsx src/features/accounts/components/account-usage-panel.test.tsxcd frontend && bun run builduv run ty check/home/kom/proj/codex-lb/.venv/bin/python -m ruff format --check ... && git diff --checkbun run typecheck,bun run lint, and targeted OAuth/repository tests listed in earlier revisions of this PR.Note: full
openspec validate --specs --strict --no-interactivestill fails on currentmainfor pre-existing placeholder Purpose text; that is fixed separately in #552 and is not included here to keep this PR based directly onmain.Related issues