Repository navigation
fix(proxy): support Pro Lite account routing - #558
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5419de7772
ℹ️ 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".
| normalized = normalize_account_plan_type(value) | ||
| if normalized is None: | ||
| return False |
There was a problem hiding this comment.
Preserve direct matching for unknown account plans
account_plan_matches_allowed now rejects any plan string that is not in ACCOUNT_PLAN_TYPES because normalize_account_plan_type returns None, so accounts with a new upstream plan (for example, any future plan value) will never pass model gating even when the model registry explicitly allows that same plan. This is a regression from the previous _filter_accounts_for_model behavior (a.plan_type in allowed_plans) and can cause modeled requests to fail with NO_PLAN_SUPPORT_FOR_MODEL until code is updated for each new plan string; keep a fallback direct membership check before applying equivalence mapping.
Useful? React with 👍 / 👎.
|
Thanks @aruis -- the prolite plumbing looks right and P1 --
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5419de7772
ℹ️ 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".
| if normalized is None: | ||
| return False |
There was a problem hiding this comment.
Allow unknown plans when explicitly listed
account_plan_matches_allowed now returns False whenever normalize_account_plan_type cannot resolve the account plan, which regresses the previous behavior of _filter_accounts_for_model (direct string membership). If the model registry starts emitting a new slug (for example a future plan type) and available_in_plans includes that same slug, those accounts will still be filtered out and selection can fail with no_accounts until code is updated. This should fall back to comparing the cleaned raw plan string against allowed_plans when normalization returns None so explicitly-allowed unknown plans continue to work.
Useful? React with 👍 / 👎.
|
Addressed the P1 regression in
Local validation:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ 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". |
|
Thanks @aruis -- the P1 fix and the raw-fallback for unknown plans both look correct, codex review is clean across the latest commit, and the local docker repro you mentioned is a strong signal. Before merging I'd like to fold one capacity nuance @sharenla raised in #557 so we don't ship Pro Lite with an over-provisioned weight. What I'd like changed# app/core/usage/__init__.py
PRIMARY_CAPACITY = {
...,
"pro": 1500.0,
- "prolite": 1500.0,
+ "prolite": 1125.0, # plus x5 long-term level
"enterprise": 1500.0,
}
SECONDARY_CAPACITY = {
...,
"pro": 50400.0,
- "prolite": 50400.0,
+ "prolite": 37800.0, # plus x5 long-term level
"enterprise": 50400.0,
}WhyPer @sharenla's #557 follow-up, Pro Lite Codex usage is product-documented as roughly Plus x5 long-term:
There is also a Pro Lite / Pro mid-tier promo running through May 31 with Codex usage closer to Plus x10, but as @sharenla notes, baking the temporary promo into the long-term default is product-maintenance debt -- the conservative default is the permanent Plus x5 baseline. Operators who want to track the promo can override the constants out-of-band; defaulting to Pro (1500 / 50400) is x6.7 over the long-term Pro Lite ceiling and x10+ over what Plus customers would expect parity with. This only affects derived credit totals / remaining-credit donuts and capacity-weighted routing weights -- upstream TestsThe two existing tests that exercise capacity will need their expected numbers updated to the new values:
The plan-matching / model-gating tests stay the same -- those don't depend on the capacity numbers, only on After this pushI'll re-run |
|
To use Codex here, create an environment for this repo. |
|
Updated the PR to fold in the Pro Lite capacity nuance from #557:
Local validation: uv run pytest -q tests/unit/test_auth.py tests/unit/test_usage.py tests/unit/test_plan_types.py tests/unit/test_proxy_load_balancer_refresh.py tests/integration/test_dashboard_overview.py
uv run ruff check app/core/usage/__init__.py tests/unit/test_auth.py tests/unit/test_usage.py tests/unit/test_plan_types.py tests/unit/test_proxy_load_balancer_refresh.py tests/integration/test_dashboard_overview.py
uv run ty check app/core/usage/__init__.py tests/unit/test_auth.py tests/unit/test_usage.py tests/unit/test_plan_types.py tests/unit/test_proxy_load_balancer_refresh.py tests/integration/test_dashboard_overview.pyAll passed locally. |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ 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". |
|
@all-contributors please add @aruis for code, test, bug |
|
I've put up a pull request to add @aruis! 🎉 |
Release 1.18.0 — v1.17.0 → main, 27 PR. ## Pre-merge verification (release-gate e2e) - ✅ CI 18/18 (mergeStateStatus CLEAN) - ✅ baseline release-gate-smoke: 10/10 (`v1.models`, chat non-stream/stream/tool_call, responses non-stream/stream, unknown-msg-key drop, transient codes, dashboard 72-byte, alembic index) - ✅ per-PR e2e extra: 14/14 (#658 strict tool × chat valid/invalid/type-omitted + responses invalid, #650-652 trim replay markers, #516 prev-resp miss mask, #558 prolite plan, #600 token_expired, #635 device poll, #647 frontend 72B, #594 account selection, #640 alembic head, #653/#654 conv archive, #655/#656 weekly pace) - ✅ pytest 562 passed / 3 PG-only skip (unit + integration suite) - ✅ SDK e2e 20/20 (`tests/e2e/test_openai_sdk_compat.py` + `tests/e2e/test_v1_responses_openai_sdk.py`) - ✅ `scripts/verify_v1_responses_openai_sdk.py` 5/5 against live container with real account - ✅ ruff check + ruff format --check + uv run ty check — All clean - ✅ prod parity probe: #637 (unknown-key drop) + #658 (strict tool 400) both confirmed fixed vs prod 1.17.0 ## Behavior change to note in announcements - **#658**: `strict: true` function tool schemas missing `additionalProperties: false` (or other strict-mode requirements) now return a local **400 `invalid_function_parameters`** with `param=tools[N].function.parameters` (chat) / `tools[N].parameters` (responses). Pre-1.18.0 these were silently forwarded upstream; 1.18.0 enforces OpenAI's documented strict-mode contract locally before forwarding. OpenSpec changes shipped in this release (to be archived after tag publish): - deactivate-on-token-expired (#600) - drop-unknown-message-fields (#637) - mask-single-http-previous-response-miss (#516) - normalize-v1-responses-openai-sdk-stream (#639) - start-device-oauth-polling (#635) - support-prolite-plan-capacity (#558) - treat-upstream-overloaded-as-retryable (#601) - validate-password-length (#598) - validate-strict-function-tool-schema (#658)
Archive changes shipped in v1.18.0 and v1.18.1 per AGENTS.md "release 이후 archive" workflow. All 12 changes verified shipped in production at 10.0.0.113 (image 1.18.1, sha256:0431a474432d). 1.18.0 (9 changes): - deactivate-on-token-expired (#600) - drop-unknown-message-fields (#637) - mask-single-http-previous-response-miss (#516) - normalize-v1-responses-openai-sdk-stream (#639) - start-device-oauth-polling (#635) [delta header fixed: MODIFIED -> ADDED] - support-prolite-plan-capacity (#558) [delta header fixed: MODIFIED -> ADDED] - treat-upstream-overloaded-as-retryable (#601) - validate-password-length (#598) - validate-strict-function-tool-schema (#658) 1.18.1 (3 changes): - harden-long-codex-websocket-turns (#586) - suppress-duplicate-side-effect-tool-calls (#586) - hotfix-db-pool-pre-ping-and-firewall-cache-ttl (#679) Specs updated: 9 capabilities (admin-auth, api-firewall, chat-completions-compat, chat-completions-extensions, database-backends, frontend-architecture, responses-api-compat, usage-refresh-policy). openspec validate --specs: 19/19 passed. Co-authored-by: Hermes Agent <[email protected]>
* fix(proxy): support Pro Lite account routing * fix(proxy): preserve explicit unknown plan matching * test(proxy): refine plan matching coverage * fix(usage): calibrate Pro Lite capacity
Release 1.18.0 — v1.17.0 → main, 27 PR. ## Pre-merge verification (release-gate e2e) - ✅ CI 18/18 (mergeStateStatus CLEAN) - ✅ baseline release-gate-smoke: 10/10 (`v1.models`, chat non-stream/stream/tool_call, responses non-stream/stream, unknown-msg-key drop, transient codes, dashboard 72-byte, alembic index) - ✅ per-PR e2e extra: 14/14 (Soju06#658 strict tool × chat valid/invalid/type-omitted + responses invalid, Soju06#650-652 trim replay markers, Soju06#516 prev-resp miss mask, Soju06#558 prolite plan, Soju06#600 token_expired, Soju06#635 device poll, Soju06#647 frontend 72B, Soju06#594 account selection, Soju06#640 alembic head, Soju06#653/Soju06#654 conv archive, Soju06#655/Soju06#656 weekly pace) - ✅ pytest 562 passed / 3 PG-only skip (unit + integration suite) - ✅ SDK e2e 20/20 (`tests/e2e/test_openai_sdk_compat.py` + `tests/e2e/test_v1_responses_openai_sdk.py`) - ✅ `scripts/verify_v1_responses_openai_sdk.py` 5/5 against live container with real account - ✅ ruff check + ruff format --check + uv run ty check — All clean - ✅ prod parity probe: Soju06#637 (unknown-key drop) + Soju06#658 (strict tool 400) both confirmed fixed vs prod 1.17.0 ## Behavior change to note in announcements - **Soju06#658**: `strict: true` function tool schemas missing `additionalProperties: false` (or other strict-mode requirements) now return a local **400 `invalid_function_parameters`** with `param=tools[N].function.parameters` (chat) / `tools[N].parameters` (responses). Pre-1.18.0 these were silently forwarded upstream; 1.18.0 enforces OpenAI's documented strict-mode contract locally before forwarding. OpenSpec changes shipped in this release (to be archived after tag publish): - deactivate-on-token-expired (Soju06#600) - drop-unknown-message-fields (Soju06#637) - mask-single-http-previous-response-miss (Soju06#516) - normalize-v1-responses-openai-sdk-stream (Soju06#639) - start-device-oauth-polling (Soju06#635) - support-prolite-plan-capacity (Soju06#558) - treat-upstream-overloaded-as-retryable (Soju06#601) - validate-password-length (Soju06#598) - validate-strict-function-tool-schema (Soju06#658)
…u06#682) Archive changes shipped in v1.18.0 and v1.18.1 per AGENTS.md "release 이후 archive" workflow. All 12 changes verified shipped in production at 10.0.0.113 (image 1.18.1, sha256:0431a474432d). 1.18.0 (9 changes): - deactivate-on-token-expired (Soju06#600) - drop-unknown-message-fields (Soju06#637) - mask-single-http-previous-response-miss (Soju06#516) - normalize-v1-responses-openai-sdk-stream (Soju06#639) - start-device-oauth-polling (Soju06#635) [delta header fixed: MODIFIED -> ADDED] - support-prolite-plan-capacity (Soju06#558) [delta header fixed: MODIFIED -> ADDED] - treat-upstream-overloaded-as-retryable (Soju06#601) - validate-password-length (Soju06#598) - validate-strict-function-tool-schema (Soju06#658) 1.18.1 (3 changes): - harden-long-codex-websocket-turns (Soju06#586) - suppress-duplicate-side-effect-tool-calls (Soju06#586) - hotfix-db-pool-pre-ping-and-firewall-cache-ttl (Soju06#679) Specs updated: 9 capabilities (admin-auth, api-firewall, chat-completions-compat, chat-completions-extensions, database-backends, frontend-architecture, responses-api-compat, usage-refresh-policy). openspec validate --specs: 19/19 passed. Co-authored-by: Hermes Agent <[email protected]>
Summary
proliteaccount plan values without rewriting stored account rows.pro, so Pro-gated models can select Pro Lite accounts.Fixes #557
Validation
uv run pytest -q tests/unit/test_auth.py tests/unit/test_usage.py tests/unit/test_proxy_load_balancer_refresh.py tests/integration/test_dashboard_overview.pyuv run ruff check app/core/plan_types.py app/core/usage/__init__.py app/modules/proxy/load_balancer.py tests/unit/test_auth.py tests/unit/test_usage.py tests/unit/test_proxy_load_balancer_refresh.py tests/integration/test_dashboard_overview.pyuv run ty check app/core/plan_types.py app/core/usage/__init__.py app/modules/proxy/load_balancer.py tests/unit/test_auth.py tests/unit/test_usage.py tests/unit/test_proxy_load_balancer_refresh.py tests/integration/test_dashboard_overview.pyNotes
uv run openspec validate --specscould not run locally because theopenspecexecutable is not installed in this environment.gpt-5.4request routing after proxy configuration was corrected.