[codex] Fix Codex custom provider env handling#2058
[codex] Fix Codex custom provider env handling#2058kitakitsune0x wants to merge 2 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 82e7ab9. Configure here.
ApprovabilityVerdict: Approved This is a well-scoped bug fix that adds early detection for missing environment variables when using custom Codex providers. The changes involve TOML parsing enhancements and a defensive check that improves error messages. Comprehensive tests cover the new functionality, and the turbo config changes are minor development tooling adjustments. You can customize Macroscope's approvability policy. Learn more. |

Summary
env_keyrequirements earlier so missing secrets fail with a clear provider errorCODEX_LB_API_KEYreach thet3server taskRoot cause
Turbo was launching the runtime tasks in strict environment mode, which filtered out provider secrets from the backend process even when they were present in the parent shell. That made custom Codex providers like
codex-lbfail at runtime with a missing environment variable.Validation
bun fmtbun lintbun typecheck./node_modules/.bin/vitest run scripts/dev-runner.test.tsNote
Fix Codex custom provider env variable handling in
checkCodexProviderStatusreadCodexConfigProviderSelectionto parseconfig.tomlonce and return both the selectedmodel_providerand a map ofenv_keyvalues per provider section.readCodexConfigModelProviderEnvKeyto expose theenv_keyfor the active custom provider.checkCodexProviderStatusto return an error status with an explicit message when a custom non-OpenAI provider'senv_keyis defined in config but the corresponding environment variable is not set; returns ready (skipping OpenAI auth) when the env var is present.--env-mode=looseto allturboinvocations in dev and start scripts so environment variables are passed through correctly.Macroscope summarized 34fa4a2.
Note
Medium Risk
Changes provider health-check logic and how
turbotasks inherit environment variables, which can affect runtime startup behavior for Codex and dev/start workflows.Overview
Codex custom model provider detection now parses
config.tomlsections to capture both the activemodel_providerand any per-providerenv_key, andcheckCodexProviderStatusfails early with a clear error if the required env var for the selected custom provider is missing (skipping the OpenAI login probe only when properly configured).Dev/start task execution is updated to run Turbo in
--env-mode=loose(bothpackage.jsonstartscripts andscripts/dev-runner.tsMODE_ARGS), with new/updated tests covering TOMLenv_keyparsing, scoped env var handling, and the presence of the loose env mode flags.Reviewed by Cursor Bugbot for commit 34fa4a2. Bugbot is set up for automated code reviews on this repo. Configure here.