Skip to content

fix: preserve provider identity during model switching - #23

Closed
dzianisv wants to merge 2 commits into
mainfrom
issue-21-provider-identity-guardrails
Closed

dzianisv wants to merge 2 commits into
mainfrom
issue-21-provider-identity-guardrails

Conversation

@dzianisv

@dzianisv dzianisv commented Mar 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • resolve provider-backed model discovery through explicit provider aliases so name = "Azure OpenAI" still maps to the azure models.dev catalog entry even behind a proxy or localhost base URL
  • preserve active_profile during config rebuild so in-session Copilot /model switching keeps the selected provider and model instead of rebuilding against the wrong provider
  • harden the real TUI /model E2E mock servers to ignore partial accepted sockets so the PTY-driven model-switch flow stays stable under the real binary path
  • keep the guardrail documentation added for this issue so future changes must cover the same failure modes

Testing

  • cargo test -p codex-core models_dev_provider_match_accepts_azure_openai_alias -- --nocapture
  • cargo test -p codex-tui rebuild_config_for_cwd_preserves_active_profile -- --nocapture
  • cargo test -p codex-tui provider_model_presets_for_picker_fetches_copilot_models_for_inactive_provider -- --nocapture
  • cargo test -p codex-tui --test all copilot_model_switch_then_prompt_uses_responses_api_without_cli_provider_override -- --nocapture --test-threads=1
  • cargo test -p codex-tui --test all model_switching_e2e -- --nocapture --test-threads=1

Closes #21

@OpenCodeEngineer

Copy link
Copy Markdown

Pushed a725e6b1c with the actual code fix behind this PR.

Highlights:

  • Azure alias handling now maps name = "Azure OpenAI" to the azure models.dev provider, including localhost/proxy base URLs.
  • config rebuild preserves active_profile, which keeps Copilot model switches on the selected provider/model.
  • the real /model PTY E2E mock servers now ignore partial accepted sockets instead of failing the full test run.

Local validation:

  • cargo test -p codex-core models_dev_provider_match_accepts_azure_openai_alias -- --nocapture
  • cargo test -p codex-tui rebuild_config_for_cwd_preserves_active_profile -- --nocapture
  • cargo test -p codex-tui provider_model_presets_for_picker_fetches_copilot_models_for_inactive_provider -- --nocapture
  • cargo test -p codex-tui --test all copilot_model_switch_then_prompt_uses_responses_api_without_cli_provider_override -- --nocapture --test-threads=1
  • cargo test -p codex-tui --test all model_switching_e2e -- --nocapture --test-threads=1

@dzianisv dzianisv changed the title docs: harden model/provider switching guardrails fix: preserve provider identity during model switching Mar 16, 2026
@OpenCodeEngineer

Copy link
Copy Markdown

Remote CI on this PR is currently blocked by two separate issues outside the Rust patch itself:

Examples from the current head a725e6b1c:

  • Tests — ubuntu-24.04 - x86_64-unknown-linux-gnu: Required runner group 'codex-runners' not found
  • Lint/Build — macos-15-xlarge - aarch64-apple-darwin: The job was not started because recent account payments have failed or your spending limit needs to be increased
  • build-test: RuntimeError: Unable to find rust-release workflow for version 0.74.0.

The model/provider switching fix itself was validated locally with the targeted Rust and real /model E2E coverage listed above; the current red checks are blocked on #27 and #29 rather than a reproduced failure in the patch.

@dzianisv

Copy link
Copy Markdown
Owner Author

Superseded by #35, which now carries this branch's changes on the consolidated integration branch.

@dzianisv dzianisv closed this Mar 17, 2026
@dzianisv
dzianisv deleted the issue-21-provider-identity-guardrails branch March 17, 2026 17:06
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.

Harden model/provider switching against non-canonical provider identities

2 participants