Skip to content

Commit 596cd10

Browse files
committed
docs(codex): call the pin a ceiling, which is what the code implements
Three comments described the pin as a tier "floor". `selectPriorityTier` names the variable `ceiling` and skips every tier where `tier > ceiling`, so the pin suppresses higher-ordered accounts rather than guaranteeing the pinned one -- the opposite of what "floor" suggests. One of the three even said "floor" and "capping" in the same sentence. Matters beyond wording: this invariant is what the Go port has to reproduce, and "floor" would send a porter looking for a lower bound that does not exist.
1 parent 5aa9403 commit 596cd10

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/codex/account-priority.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ export function codexAccountPriorityLookup(config: OcxConfig): (accountId: strin
5858

5959
/**
6060
* The account an operator most recently selected by hand. While pinned, priority
61-
* never preempts upward: the pin is a tier floor for round-robin/fill-first and a
62-
* veto in the quota path, until the account crosses the auto-switch threshold.
61+
* never preempts upward: the pin is a tier *ceiling* for round-robin/fill-first --
62+
* `selectPriorityTier` skips every tier above the pinned account's, so higher-ordered
63+
* accounts are suppressed rather than the pinned one being guaranteed -- and a veto in
64+
* the quota path, until the account crosses the auto-switch threshold.
6365
*/
6466
export function pinnedCodexAccountId(config: OcxConfig): string | undefined {
6567
return config.activeCodexAccountPinned;

src/codex/auth-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ export async function handleCodexAuthAPI(
886886
// must release the pin rather than record one: pinning the `targetAccountId`
887887
// fallback would leave a pin that no effective active account matches, which
888888
// `isEffectiveCodexAccountPinned` reports as unpinned while the tier filter still
889-
// honours it as a floor — invisibly capping the pool at the main account's tier.
889+
// honours it as a ceiling — invisibly capping the pool at the main account's tier.
890890
if (body.accountId == null) clearCodexAccountPin(runtimeConfig);
891891
else setCodexAccountPin(runtimeConfig, targetAccountId);
892892
resetCodexRoutingForManualSelection(targetAccountId);

src/codex/routing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,8 @@ export function reconcileCodexActiveAfterExclusion(
10231023
config.activeCodexAccountId = undefined;
10241024
}
10251025
// Excluding an account revokes any manual pin on it even when it was not the
1026-
// effective active — otherwise a paused account keeps acting as a tier floor.
1026+
// effective active — otherwise a paused account keeps acting as a tier ceiling,
1027+
// suppressing every higher-ordered account while being unusable itself.
10271028
clearCodexAccountPin(config, excludedAccountId);
10281029
if (!wasEffective) return getEffectiveActiveCodexAccountId(config) ?? null;
10291030

0 commit comments

Comments
 (0)