Skip to content

fix: handle partial missing usage in platform fallback#7

Merged
kgskr merged 1 commit intomainfrom
codex/fix-partial-missing-platform-fallback
Apr 10, 2026
Merged

fix: handle partial missing usage in platform fallback#7
kgskr merged 1 commit intomainfrom
codex/fix-partial-missing-platform-fallback

Conversation

@kgskr
Copy link
Copy Markdown
Collaborator

@kgskr kgskr commented Apr 10, 2026

Summary

  • treat a ChatGPT candidate as healthy for Platform fallback suppression only when both required usage snapshots are present and healthy
  • prevent all-missing and partial-missing usage snapshots from keeping Platform fallback idle
  • sync OpenSpec wording and add regression coverage for public and backend fallback paths

Problem

The previous fallback logic still allowed a mixed pool case to block Platform fallback:

  • one ChatGPT account already drained
  • another compatible ChatGPT account missing one of the persisted usage windows

That partial-missing candidate could still keep the request on the ChatGPT path even though it was not positively healthy.

Changes

  • tighten app/modules/proxy/load_balancer.py fallback health evaluation to require both known windows
  • add unit coverage for:
    • all-missing usage
    • partial-missing usage
    • weekly-only usage
  • add integration coverage for:
    • public /v1/responses mixed-pool partial-missing fallback
    • backend Codex HTTP /backend-api/codex/responses mixed-pool partial-missing fallback
  • update OpenSpec to state that either missing window disqualifies a ChatGPT candidate from suppressing Platform fallback
  • update existing healthy-primary tests so they seed both windows and represent a truly healthy candidate

Validation

  • ruff check app/modules/proxy/load_balancer.py tests/unit/test_load_balancer.py tests/unit/test_public_route_selection.py tests/integration/test_openai_platform_proxy.py
  • pytest tests/unit/test_load_balancer.py -q
  • pytest tests/unit/test_public_route_selection.py -q
  • pytest tests/integration/test_openai_platform_proxy.py -q
  • openspec validate --specs

@kgskr
Copy link
Copy Markdown
Collaborator Author

kgskr commented Apr 10, 2026

@codex

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

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

@kgskr kgskr merged commit 50466b2 into main Apr 10, 2026
10 checks passed
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