Skip to content

feat: let model providers own model discovery#18950

Merged
celia-oai merged 6 commits intomainfrom
dev/cc/amazon-model-listing
Apr 24, 2026
Merged

feat: let model providers own model discovery#18950
celia-oai merged 6 commits intomainfrom
dev/cc/amazon-model-listing

Conversation

@celia-oai
Copy link
Copy Markdown
Collaborator

@celia-oai celia-oai commented Apr 22, 2026

Why

codex-models-manager had grown to own provider-specific concerns: constructing OpenAI-compatible /models requests, resolving provider auth, emitting request telemetry, and deciding how provider catalogs should be sourced. That made the manager harder to reuse for providers whose model catalog is not fetched from the OpenAI /models endpoint, such as Amazon Bedrock.

This change moves provider-specific model discovery behind provider-owned implementations, so the models manager can focus on refresh policy, cache behavior, picker ordering, and model metadata merging.

What Changed

  • Introduced a ModelsManager trait with separate OpenAiModelsManager and StaticModelsManager implementations.
  • Added ModelsEndpointClient so OpenAI-compatible HTTP fetching lives outside codex-models-manager.
  • Moved /models request construction, provider auth resolution, timeout handling, and request telemetry into codex-model-provider via OpenAiModelsEndpoint.
  • Added provider-owned models_manager(...) construction so configured OpenAI-compatible providers use OpenAiModelsManager, while static/catalog-backed providers can return StaticModelsManager.
  • Added an Amazon Bedrock static model catalog for the GPT OSS Bedrock model IDs.
  • Updated core/session/thread manager code and tests to depend on Arc<dyn ModelsManager>.
  • Moved offline model test helpers into codex_models_manager::test_support.

Metadata References

The Bedrock catalog metadata is based on the official Amazon Bedrock OpenAI model documentation:

  • Amazon Bedrock OpenAI models lists the Bedrock model IDs, text input/output modalities, and 128,000 token context window for gpt-oss-20b and gpt-oss-120b.
  • Amazon Bedrock gpt-oss-120b model card lists the bedrock-runtime model ID openai.gpt-oss-120b-1:0, the bedrock-mantle model ID openai.gpt-oss-120b, text-only modalities, and 128K context window.
  • OpenAI gpt-oss-120b model docs document configurable reasoning effort with low, medium, and high, plus text input/output modality.

The display names, default reasoning effort, and priority ordering are Codex-local catalog choices.

Test Plan

  • Manually verified app-server model listing with an AWS profile:
CODEX_HOME="$(mktemp -d)" cargo run -p codex-app-server-test-client -- \
  --codex-bin ./target/debug/codex \
  -c 'model_provider="amazon-bedrock"' \
  -c 'model_providers.amazon-bedrock.aws.profile="codex-bedrock"' \
  -c 'model_providers.amazon-bedrock.aws.region="us-west-2"' \
  model-list

The response returned the Bedrock catalog with openai.gpt-oss-120b-1:0 as the default model and openai.gpt-oss-20b-1:0 as the second listed model, both text-only and supporting low/medium/high reasoning effort.

@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch from 87f6914 to 3666f94 Compare April 22, 2026 05:03
@celia-oai celia-oai changed the title changes feat: use active provider model catalogs for Bedrock model listing Apr 22, 2026
@celia-oai celia-oai marked this pull request as ready for review April 22, 2026 06:17
@celia-oai celia-oai requested a review from a team as a code owner April 22, 2026 06:17
@celia-oai celia-oai requested a review from pakrym-oai April 22, 2026 06:18
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch 18 times, most recently from 52559ff to a7c6a56 Compare April 23, 2026 00:25
@celia-oai celia-oai changed the title feat: use active provider model catalogs for Bedrock model listing feat: let model providers own model discovery Apr 23, 2026
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch 3 times, most recently from a2f9688 to c93a7b6 Compare April 23, 2026 00:51
@celia-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c93a7b66bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/model-provider/src/provider.rs Outdated
Comment thread codex-rs/model-provider/src/models_endpoint.rs Outdated
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch from f9906b5 to c93a7b6 Compare April 23, 2026 01:15
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch 9 times, most recently from f83056d to 5e0e3f4 Compare April 24, 2026 00:30
@celia-oai celia-oai requested a review from pakrym-oai April 24, 2026 00:30
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch from cf74eea to 4712f34 Compare April 24, 2026 02:01
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch 3 times, most recently from 270a84e to b862812 Compare April 24, 2026 03:50
@celia-oai celia-oai force-pushed the dev/cc/amazon-model-listing branch from b862812 to 16af6f0 Compare April 24, 2026 04:01
@celia-oai celia-oai enabled auto-merge (squash) April 24, 2026 04:14
@celia-oai celia-oai merged commit e8d8080 into main Apr 24, 2026
25 checks passed
@celia-oai celia-oai deleted the dev/cc/amazon-model-listing branch April 24, 2026 04:28
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants