Skip to content

fix(cli): fall back to a Codex model for Codex runtime - #661

Closed
stablegenius49 wants to merge 1 commit into
NousResearch:mainfrom
stablegenius49:pr-factory/issue-651-codex-model-fallback
Closed

fix(cli): fall back to a Codex model for Codex runtime#661
stablegenius49 wants to merge 1 commit into
NousResearch:mainfrom
stablegenius49:pr-factory/issue-651-codex-model-fallback

Conversation

@stablegenius49

Copy link
Copy Markdown
Contributor

Summary\n- normalize incompatible CLI model selections when the runtime provider resolves to OpenAI Codex\n- strip provider prefixes from explicit Codex model ids before initializing the agent\n- add regression coverage for both fallback and prefix-stripping cases\n\nFixes #651\n\n## Testing\n- pytest -q tests/test_codex_models.py tests/test_cli_provider_resolution.py\n

teknium1 added a commit that referenced this pull request Mar 8, 2026
When _ensure_runtime_credentials() resolves the provider to openai-codex,
check if the active model is Codex-compatible.  If not (e.g. the default
anthropic/claude-opus-4.6), swap it for the best available Codex model.
Also strips provider prefixes the Codex API rejects (openai/gpt-5.3-codex
→ gpt-5.3-codex).

Adds _model_is_default flag so warnings are only shown when the user
explicitly chose an incompatible model (not when it's the config default).

Fixes #651.

Co-inspired-by: stablegenius49 (PR #661)
Co-inspired-by: teyrebaz33 (PR #696)
@teknium1

teknium1 commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix @stablegenius49! The _normalize_model_for_provider() method was a clean approach and we used it as the basis for the final implementation.

Unfortunately this PR couldn't be merged directly because the branch is 36 commits behind main and the diff includes unrelated regressions — it removes the /title command (session naming from PR #720), /provider command, reverts image preprocessing (commit cf810c2), and simplifies /model and /history in ways that lose features.

We implemented the fix in commit 95b1130, taking the best ideas from this PR (clean method extraction) and #696 (_model_is_default flag). Credit noted in the commit message. Closing this PR — thanks for the contribution!

@teknium1 teknium1 closed this Mar 8, 2026
@teknium1 teknium1 mentioned this pull request Mar 8, 2026
1 task
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
When _ensure_runtime_credentials() resolves the provider to openai-codex,
check if the active model is Codex-compatible.  If not (e.g. the default
anthropic/claude-opus-4.6), swap it for the best available Codex model.
Also strips provider prefixes the Codex API rejects (openai/gpt-5.3-codex
→ gpt-5.3-codex).

Adds _model_is_default flag so warnings are only shown when the user
explicitly chose an incompatible model (not when it's the config default).

Fixes NousResearch#651.

Co-inspired-by: stablegenius49 (PR NousResearch#661)
Co-inspired-by: teyrebaz33 (PR NousResearch#696)
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
When _ensure_runtime_credentials() resolves the provider to openai-codex,
check if the active model is Codex-compatible.  If not (e.g. the default
anthropic/claude-opus-4.6), swap it for the best available Codex model.
Also strips provider prefixes the Codex API rejects (openai/gpt-5.3-codex
→ gpt-5.3-codex).

Adds _model_is_default flag so warnings are only shown when the user
explicitly chose an incompatible model (not when it's the config default).

Fixes NousResearch#651.

Co-inspired-by: stablegenius49 (PR NousResearch#661)
Co-inspired-by: teyrebaz33 (PR NousResearch#696)
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
When _ensure_runtime_credentials() resolves the provider to openai-codex,
check if the active model is Codex-compatible.  If not (e.g. the default
anthropic/claude-opus-4.6), swap it for the best available Codex model.
Also strips provider prefixes the Codex API rejects (openai/gpt-5.3-codex
→ gpt-5.3-codex).

Adds _model_is_default flag so warnings are only shown when the user
explicitly chose an incompatible model (not when it's the config default).

Fixes NousResearch#651.

Co-inspired-by: stablegenius49 (PR NousResearch#661)
Co-inspired-by: teyrebaz33 (PR NousResearch#696)
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.

3 participants