Skip to content

[WRONG BRANCH] fix(routing): avoid unbound Codex quota evidence - #21

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-codex-quota-check-vulnerability
Draft

[WRONG BRANCH] fix(routing): avoid unbound Codex quota evidence#21
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-codex-quota-check-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent policy routing from using an invented process-active Codex pool account as quota evidence for OpenAI/Codex candidates when the eventual request account may be different.

Description

  • Stop attaching the process-active Codex account into candidate quota evidence in src/router.ts so candidates without an explicit account keep unknown quota evidence until an account-qualified selector binds one.
  • Apply the same boundary to management dry-run/determine logic in src/server/management/routing-profile-routes.ts so evaluate/dry-run results mirror real routing behavior.
  • Update the quota-focused test in tests/quota-scoring.test.ts to assert that policy dry-run/route decisions do not invent Codex pool quota evidence for account-unbound candidates.
  • Remove now-unused imports and keep explicit account-scoped evidence behavior unchanged for anthropic/explicit account refs.

Testing

  • Ran ./node_modules/.bin/bun test tests/quota-scoring.test.ts and the quota tests passed (9 tests across the file passed).
  • Ran ./node_modules/.bin/bun test tests/route-explainability.test.ts and those tests passed (10 tests passed).
  • Ran bun run typecheck which succeeded.
  • Ran ./node_modules/.bin/bun scripts/privacy-scan.ts which reported "Privacy scan passed.".
  • Attempted the full suite via ./node_modules/.bin/bun scripts/test.ts; this run surfaced unrelated environment/baseline failures in API-key attribution and combo-management tests and HTTP 403s when fetching GUI dependencies, so the full-suite run was not used to block this focused fix.
  • Note: an initial bun test using the system Bun (v1.2.14) errored due to a missing node:zlib export; using the repository-installed Bun (v1.3.14) produced the passing results above.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@luvs01, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 65dd9b95-c561-41ea-b460-414431f51800

📥 Commits

Reviewing files that changed from the base of the PR and between 2468502 and 42d7cb0.

📒 Files selected for processing (3)
  • src/router.ts
  • src/server/management/routing-profile-routes.ts
  • tests/quota-scoring.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev. UI screenshot required.

What to do

  • Retarget this PR to dev — all contributions go to dev.
  • Add a screenshot of the UI change to the PR description.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions github-actions Bot changed the title fix(routing): avoid unbound Codex quota evidence [WRONG BRANCH] fix(routing): avoid unbound Codex quota evidence Aug 7, 2026
@github-actions
github-actions Bot marked this pull request as draft August 7, 2026 05:45
@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

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

Copy link
Copy Markdown

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: 42d7cb065b

ℹ️ 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 src/router.ts
Comment on lines 515 to 517
accountRef: candidate.provider === "anthropic"
? getAccountSet("anthropic")?.activeAccountId
: undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the quota-routing documentation

For Pool-mode OpenAI profiles, this now deliberately leaves runtime quota evidence unknown unless an account-qualified dry-run supplies codexAccountId, but docs-site/src/content/docs/reference/configuration/routing.md:155-164 still states that runtime routing reads quota for the selected Pool account. Users configuring optimize.quota or require.minQuotaHeadroom will therefore expect account-aware decisions that no longer occur; update the English documentation and applicable translations to describe the new account-unbound behavior.

AGENTS.md reference: src/AGENTS.md:L28-L28

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant