Flowchart · @henryqw/pi-multi-codex
Codex startup ranking and HTTP 429 failover
Codex startup ranking and HTTP 429 failover
At startup, only authenticated, registered, scope-allowed slots with fresh quota snapshots and no known active five-hour block are ranked; the slot with the highest seven-day remaining quota is chosen, or the current slot stays active when none qualify. Success keeps the active slot. Non-429 failures and HTTP 429 with autoSwitchOn429 disabled do not retry. With switching enabled, HTTP 429 marks the failed slot tried, then failover allows authenticated, registered, scope-allowed, untried slots with stale or missing quota, excludes known active five-hour blocks, ranks fresh known quota first and then unranked slots by slot number, and retries without returning to startup ranking.
429 + SWITCH ON
MARK FAILED SLOT TRIED
Startup ranking pool
AUTHENTICATED · REGISTERED · SCOPE-ALLOWED
FRESH USAGE SNAPSHOT REQUIRED
KNOWN 7-DAY REMAINING · NO ACTIVE 5H BLOCK
Choose startup route
HIGHEST 7-DAY REMAINING
NONE → KEEP CURRENT SLOT
Send request
ACTIVE SLOT · MODEL ID KEPT
Result
Keep active slot
SUCCESS
Stop without another slot
NON-429 FAILURE
429 + autoSwitchOn429=false
HTTP 429 failover pool
AUTHENTICATED · REGISTERED · SCOPE-ALLOWED
UNTRIED · STALE OR MISSING QUOTA ALLOWED
EXCLUDE: KNOWN ACTIVE 5H BLOCK
FRESH KNOWN: HIGHEST 7-DAY REMAINING FIRST
THEN UNRANKED: SLOT NUMBER ASCENDING
Failover
candidate?
Switch slot and retry
SAME REQUEST · MODEL ID KEPT
Stop failover
NO ELIGIBLE UNTRIED SLOT
RETRY
Retries re-enter at Send request. Startup freshness is not checked again.