Add Codex config profile setting#2756
Conversation
📝 WalkthroughWalkthroughThis PR adds optional Codex profile name configuration to the provider. The new ChangesCodex profile configuration support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
ApprovabilityVerdict: Needs human review This PR introduces a new Codex profile configuration feature that modifies authentication flow behavior - when a profile is set, OpenAI auth requirements are bypassed. These runtime behavior changes around authentication warrant human review. You can customize Macroscope's approvability policy. Learn more. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/provider/Layers/CodexProvider.ts`:
- Around line 495-499: The code incorrectly forces account.requiresOpenaiAuth to
false whenever snapshot.models.length > 0, which can flip auth-required for
custom models that were added via the unauthenticated early-return/settings
path; instead only clear requiresOpenaiAuth when those models were discovered
during an authenticated probe. Update the logic around account construction (the
account variable and its use by accountProbeStatus) to only set
requiresOpenaiAuth = false when snapshot.models.length > 0 AND the snapshot
indicates an authenticated probe (e.g., check snapshot.authenticated or another
flag that distinguishes provider-discovered models from settings-provided
models); otherwise preserve snapshot.account.requiresOpenaiAuth. Ensure you
reference and update the same symbols: snapshot.models,
snapshot.account.requiresOpenaiAuth, and accountProbeStatus(account).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e7130f37-a535-4ca9-ba1e-e8c4f8470f2a
📒 Files selected for processing (13)
apps/server/src/provider/Layers/CodexAdapter.test.tsapps/server/src/provider/Layers/CodexAdapter.tsapps/server/src/provider/Layers/CodexProvider.tsapps/server/src/provider/Layers/CodexSessionRuntime.test.tsapps/server/src/provider/Layers/CodexSessionRuntime.tsapps/server/src/provider/Layers/ProviderInstanceRegistryLive.test.tsapps/server/src/provider/Layers/ProviderRegistry.test.tsapps/server/src/serverSettings.test.tsapps/server/src/textGeneration/CodexTextGeneration.test.tsapps/server/src/textGeneration/CodexTextGeneration.tsapps/web/src/components/KeybindingsToast.browser.tsxapps/web/src/components/settings/ProviderSettingsForm.test.tspackages/contracts/src/settings.ts
d8beb90 to
e2275ac
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
e2275ac to
03a7261
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03a7261. Configure here.
| profileName: TrimmedString.pipe( | ||
| Schema.withDecodingDefault(Effect.succeed("")), | ||
| Schema.annotateKey({ title: "Config profile" }), | ||
| ), |
There was a problem hiding this comment.
profileName missing from form field order array
Low Severity
The profileName field is not included in the order array for CodexSettings, which only lists ["binaryPath", "homePath", "shadowHomePath"]. Every other provider settings schema (Claude, Cursor, OpenCode) explicitly lists all visible fields in its order array. The profileName field's position in the settings form relies on the implicit ordering behavior of deriveProviderSettingsFields for unordered fields, making it fragile if that function's behavior changes.
Reviewed by Cursor Bugbot for commit 03a7261. Configure here.


What Changed
Adds a minimal Codex
Config profileprovider setting and threads it through Codex launch paths:-p <profile>to Codex app-server status probes, app-server sessions, andcodex exectext generation.model_providerfrom Codex config and passes it into app-serverthread/start/thread/resumestartup.Why
This lets T3 Code use Codex config profiles backed by non-default providers, such as a custom provider profile.
The explicit config lookup exists because of an upstream Codex app-server bug/limitation:
codex -p <profile> app-serverdoes not apply the profile'smodel_providertothread/startby default, even thoughcodex -p <profile> exec ...does. Without passingmodelProviderexplicitly, app-server starts threads withmodelProvider: "openai"and can hit OpenAI 401s for custom-provider profiles.Upstream issue: openai/codex#23417
UI Changes
Adds a small

Config profiletext field to the existing Codex provider settings form.Before:
After:

Checklist
Verification:
bun fmtbun lint(passes with existing warnings)bun typecheckcd apps/server && bun run test src/provider/Layers/CodexProvider.test.ts src/provider/Layers/CodexSessionRuntime.test.ts src/textGeneration/CodexTextGeneration.test.ts src/serverSettings.test.tsNote
Medium Risk
Changes Codex provider launch/probe behavior and thread-start parameters (including auth-status determination), which can affect whether Codex sessions start and how they authenticate, but scope is limited to the Codex integration and is covered by new tests.
Overview
Adds a new Codex provider setting,
profileName, surfaced in the settings schema/UI and supported in settings patches.When set, Codex commands now run with
-p <profileName>for app-server probes, app-server session spawn, andcodex exectext generation; session startup also reads Codex config (config/read) to extractmodel_provider(profile-specific first) and forwards it viamodelProviderinthread/start/thread/resume.Provider status probing is adjusted so profiled providers don’t treat
requiresOpenaiAuthas blocking when non-custom models are present; tests are updated/added to validate profile propagation,modelProviderforwarding, and the auth/model readiness behavior.Reviewed by Cursor Bugbot for commit 03a7261. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
profileNameconfig profile setting to Codex providerprofileNametoCodexSettingsin settings.ts, wiring it through the provider status check, session runtime, and text generation layers.-p {profileName}to app-server andcodex execcommand args, and reads profile-specific model config for thread start/resume requests.requiresOpenaiAuthas non-blocking when models are available, allowing the provider to reportreadywithout OpenAI auth.Macroscope summarized 03a7261.
Summary by CodeRabbit
New Features
Tests