Pi gained openai-account, openai-quota and openai-routing in v0.8.0, but its request path does not read what they write. A user can set fallback-first, add a fallback account, and watch traffic keep going to the credential Pi itself supplies.
The README says so plainly now, so nobody is misled — but the controls are only half-built until this lands.
What is missing
streamOpenAI in packages/pi/src/index.ts forwards model, context and options to Pi's streamSimple unchanged. It never reads the account store, the routing mode, or the sticky map. The commands persist all three correctly; nothing consumes them.
Concretely, none of this happens on a Pi request:
- Account selection. No candidate list is built, so a fallback account is stored but never chosen.
- Routing modes.
main-first, fallback-first and sticky-balanced are recorded and reported, and none of them changes which credential is used.
- Session pins.
packages/pi/src/routing.ts has a working setter and getter keyed by sessionManager.getSessionId(). The production stream path never calls either — only tests do.
- Quota capture. Nothing reads
x-codex-* response headers or codex.rate_limits frames on the Pi side, so openai-quota can only ever show values another host wrote.
- Killswitch and admission. No reserve-floor check and no exhaustion filtering before a request is spent.
Why it is not simply ported
OpenCode gets all of this from a fetch override installed by the auth loader, which owns token refresh, candidate selection, admission and the quota push. Pi registers a provider through its own OAuth path and streams through streamSimple; there is no equivalent seam to hang the same logic on today.
So this is not a copy of index.ts — it needs a deliberate answer to where selection happens in Pi's request lifecycle, and how a chosen account's token gets into the request the extension does not currently build.
Worth settling first
- Does Pi have a main account at all? OpenCode's routing is main-plus-fallbacks. Pi's credential comes from Pi itself, so "main" may mean the host credential rather than one of ours — which changes what
main-first means and whether sticky-balanced has the right shape here.
- Is the store shared or per-host at that point? Vault custody will eventually offer a single source across hosts. Wiring Pi's routing against a per-host store now, then moving to a shared one, is two designs. It may be worth waiting for that decision rather than building against the interim shape.
Until then the commands are honest store management, and the README says exactly that.
Found during the v0.8.0 pre-release audit.
Pi gained
openai-account,openai-quotaandopenai-routingin v0.8.0, but its request path does not read what they write. A user can setfallback-first, add a fallback account, and watch traffic keep going to the credential Pi itself supplies.The README says so plainly now, so nobody is misled — but the controls are only half-built until this lands.
What is missing
streamOpenAIinpackages/pi/src/index.tsforwardsmodel,contextandoptionsto Pi'sstreamSimpleunchanged. It never reads the account store, the routing mode, or the sticky map. The commands persist all three correctly; nothing consumes them.Concretely, none of this happens on a Pi request:
main-first,fallback-firstandsticky-balancedare recorded and reported, and none of them changes which credential is used.packages/pi/src/routing.tshas a working setter and getter keyed bysessionManager.getSessionId(). The production stream path never calls either — only tests do.x-codex-*response headers orcodex.rate_limitsframes on the Pi side, soopenai-quotacan only ever show values another host wrote.Why it is not simply ported
OpenCode gets all of this from a
fetchoverride installed by the auth loader, which owns token refresh, candidate selection, admission and the quota push. Pi registers a provider through its own OAuth path and streams throughstreamSimple; there is no equivalent seam to hang the same logic on today.So this is not a copy of
index.ts— it needs a deliberate answer to where selection happens in Pi's request lifecycle, and how a chosen account's token gets into the request the extension does not currently build.Worth settling first
main-firstmeans and whethersticky-balancedhas the right shape here.Until then the commands are honest store management, and the README says exactly that.
Found during the v0.8.0 pre-release audit.