Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
import { decodeRoutedModelId, encodeRoutedModelId } from "./providers/slug-codec";
import { getStaleCached } from "./codex/model-cache";
import { codexAccountNamespaceEntries } from "./codex/account-namespaces";
import { getEffectiveActiveCodexAccountId } from "./codex/routing";
import { getAccountSet } from "./oauth/store";
import {
buildRouteDecisionTrace,
Expand Down Expand Up @@ -513,21 +512,6 @@ function routeModelInternal(
quota: quotaEvidenceForCandidate({
provider: candidate.provider,
model: candidate.model,
...(candidate.provider === OPENAI_CODEX_PROVIDER_ID
&& providerCodexAccountMode(
OPENAI_CODEX_PROVIDER_ID,
config.providers[OPENAI_CODEX_PROVIDER_ID],
) === "pool"
? (() => {
const codexAccountId = getEffectiveActiveCodexAccountId(config);
return {
codexAccountId,
codexAccountPlan: codexAccountId
? config.codexAccounts?.find(account => account.id === codexAccountId)?.plan
: undefined,
};
})()
: {}),
accountRef: candidate.provider === "anthropic"
? getAccountSet("anthropic")?.activeAccountId
: undefined,
Comment on lines 515 to 517

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 👍 / 👎.

Expand Down
18 changes: 0 additions & 18 deletions src/server/management/routing-profile-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { candidateCapabilityEvidence } from "../../routing/capability";
import { policyCandidateHealthEvidence } from "../../routing/health";
import { quotaEvidenceForCandidate } from "../../routing/quota";
import { costEvidenceForCandidate } from "../../routing/cost";
import { providerCodexAccountMode } from "../../providers/registry";
import { getEffectiveActiveCodexAccountId } from "../../codex/routing";
import { getAccountSet } from "../../oauth/store";
import { OPENAI_CODEX_PROVIDER_ID } from "../../providers/openai-tiers";
import { isPlainRecord } from "./shared";
import { readManagementJsonBody, rethrowManagementBodyTooLarge } from "./body";
import { jsonResponse } from "../auth-cors";
Expand Down Expand Up @@ -104,21 +101,6 @@ function assembleCandidateEvidence(
quota: quotaEvidenceForCandidate({
provider: candidate.provider,
model: candidate.model,
...(candidate.provider === OPENAI_CODEX_PROVIDER_ID
&& providerCodexAccountMode(
OPENAI_CODEX_PROVIDER_ID,
config.providers[OPENAI_CODEX_PROVIDER_ID],
) === "pool"
? (() => {
const codexAccountId = getEffectiveActiveCodexAccountId(config);
return {
codexAccountId,
codexAccountPlan: codexAccountId
? config.codexAccounts?.find(account => account.id === codexAccountId)?.plan
: undefined,
};
})()
: {}),
accountRef: candidate.provider === "anthropic"
? getAccountSet("anthropic")?.activeAccountId
: undefined,
Expand Down
6 changes: 3 additions & 3 deletions tests/quota-scoring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe("quota-aware scoring (RI-07)", () => {
expect(penalized.candidates[0]!.score!.components.quota).toBe(QUOTA_UNKNOWN_PENALTY_SCORE);
});

test("execution path passes the active codex account into quota evidence", async () => {
test("execution path does not invent Codex quota evidence from the active pool account", async () => {
updateAccountQuota("pool-a", 30, 1_800_000_000_000, 20, 1_900_000_000_000);
const cfg = config({
codexAccounts: [{ id: "pool-a", email: "pool-a@example.test", isMain: false }],
Expand All @@ -205,8 +205,8 @@ describe("quota-aware scoring (RI-07)", () => {
},
});
const route = routeModel(cfg, "policy/quotaRoute");
expect(route.routeDecision!.candidates[0]!.quota?.known).toBe(true);
expect(route.routeDecision!.candidates[0]!.quota?.headroom).toBeCloseTo(0.7, 2);
expect(route.routeDecision!.candidates[0]!.quota?.known).toBe(false);
expect(route.routeDecision!.candidates[0]!.quota?.headroom).toBeUndefined();
});

test("exact account selectors and pool strategies remain authoritative", () => {
Expand Down
Loading