Skip to content

v6.14.0

Choose a tag to compare

@ndycode ndycode released this 21 Aug 11:28
· 179 commits to main since this release

https://www.npmjs.com/package/oc-codex-multi-auth/v/6.14.0

npx oc-codex-multi-auth@6.14.0 install

Added

Trusted OpenAI-compatible gateways for ChatGPT OAuth inference (#232). OPENAI_BASE_URL is honored for ChatGPT OAuth requests behind an explicit CODEX_AUTH_ALLOW_OPENAI_BASE_URL=1 opt-in, so a pre-existing OPENAI_BASE_URL set for an unrelated tool cannot silently capture ChatGPT OAuth credentials.

The override is fail-closed. Remote gateways require HTTPS. Cleartext HTTP is accepted only for literal loopback addresses — anything in 127.0.0.0/8, ::1, and their IPv4-mapped spellings — and never for hostnames like localhost, since a resolver can point those at a remote peer. Embedded credentials, query strings and fragments are rejected. Redirects are not followed: a 3xx from the gateway returns a 502 naming the redirect origin instead of replaying your access token somewhere you never configured. A rejected value fails with a clear reason and a toast rather than silently falling back, and the value itself is never echoed back.

Fixed

Concurrent OpenCode sessions could burn each other's refresh tokens (#233). OpenAI refresh tokens are single-use. When two processes sharing one account file exchanged the same token, one got refresh_token_reused and that account was dead until you logged in again. The exchange is now serialized across processes on the same host, with an authoritative reload before it and a durable commit after it; a process that finds a rotation another one already committed adopts it rather than spending a second token.

The refresh lease is deliberately separate from the storage lease, so codex-note, codex-tag, account toggles, rotation stamps and TUI quota writes never queue behind a multi-second network call.

Four separate paths could write a consumed refresh token back over a newer one — the codex-health merge, startup email hydration, refresh-target resolution, and flagged-account cleanup — each costing a re-login. Credential writes are now gated on the rotation stamp, hydration is keyed by stable workspace identity so a sibling record in a different organization can no longer receive another workspace's access token, and flagged cleanup deletes only what it positively restored.

A live OAuth access token is no longer written to flagged-accounts.json, and a refresh lease that was lost mid-flight now aborts before the token is spent instead of racing another process.

Scope: the multiprocess guarantee is same-host and local-filesystem. Cross-host or network-filesystem setups still need an external coordinator, and a process killed between the provider accepting a token and the replacement landing on disk still requires reauthentication.


Both PRs by @nbige.