Skip to content

fix(codex): guard add-account when real home pins a custom provider (PR-D) - #9174

Closed
brennanb2025 wants to merge 2 commits into
brennanb2025/codex-home-consolidationfrom
brennanb2025/codex-ma-d-provider-guard
Closed

brennanb2025 wants to merge 2 commits into
brennanb2025/codex-home-consolidationfrom
brennanb2025/codex-ma-d-provider-guard

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

What / why

  • Detects a non-OpenAI top-level model_provider in the canonical Codex config before starting OAuth login.
  • Returns a deterministic, actionable error explaining that custom providers use the system-default account and that OpenAI OAuth accounts require removing the pin or setting it to openai.
  • Reuses the shared byte-preserving TOML scanner and string parser so profile/provider tables and multiline data do not look like root settings.

Test evidence

  • npx vitest run --config config/vitest.config.ts src/main/codex-accounts/service.test.ts — 24 passed.
  • npx vitest run --config config/vitest.config.ts src/main/codex-accounts/runtime-home-service.test.ts — 87 passed.
  • pnpm run typecheck:node — passed.
  • Targeted oxlint and max-lines ratchet — passed.

Guardrails

  • The guard runs only in add-account before login; the flag-OFF system-default custom-provider launch path remains unchanged and is covered without auth.json.
  • Missing model_provider and explicit model_provider = "openai" continue through normal multi-account OAuth login.
  • The canonical ~/.codex/config.toml is read only and is asserted byte-identical after both rejected add and system-default launch tests.

Matrix

  • Row 5: custom env-key provider (codex-lb), no auth.json — system-default launch succeeds; add OAuth account fails before spawning login with clear guidance; canonical config remains untouched.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing as superseded: #9501 (real-home routing + self-contained multi-account homes) explicitly lists this draft as superseded in its description, and that consolidation merged and shipped in v1.4.149 stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant