Skip to content

Honor default service tier in Codex CLI#21909

Draft
shijie-oai wants to merge 6 commits into
mainfrom
shijie/default-codex-service-tier
Draft

Honor default service tier in Codex CLI#21909
shijie-oai wants to merge 6 commits into
mainfrom
shijie/default-codex-service-tier

Conversation

@shijie-oai
Copy link
Copy Markdown
Collaborator

@shijie-oai shijie-oai commented May 9, 2026

Why

Codex can now receive default_service_tier from the model catalog. The client should honor backend-owned model metadata for default priority routing instead of duplicating plan-specific rules locally. The client also needs a durable way to represent standard routing when a model has a catalog default, so turning Fast mode off does not get overwritten by that default on the next turn.

What Changed

  • Added default_service_tier to shared model metadata and model presets, including cache/test fixtures and the Bedrock catalog shape.
  • Exposed defaultServiceTier through app-server v2 model/list, regenerated the JSON/TypeScript schema fixtures, and preserved the field when the TUI bootstraps from app-server models.
  • Centralized service-tier selection with ModelInfo::effective_service_tier(...) for local/session state and ModelInfo::service_tier_for_request(...) for the Responses API request boundary.
  • Added the local service_tier = "unset" sentinel so config/TUI state can explicitly opt out of catalog defaults while inference requests still omit service_tier.
  • Kept catalog defaults behind Feature::FastMode; when FastMode is disabled, Codex does not apply a model default and only preserves explicit supported tiers or unset.
  • Updated TUI Fast-mode toggles and slash-command tests to persist/send unset when the user turns an active tier off.

Validation

  • cargo build -p codex-cli
  • cargo test -p codex-protocol service_tier --lib
  • cargo test -p codex-core get_service_tier --lib
  • cargo test -p codex-tui user_turn_sends_standard_override_after_fast_is_turned_off --lib
  • cargo test -p codex-app-server-protocol
  • cargo test -p codex-app-server model_list
  • cargo test -p codex-tui app_server_session --lib

Comment on lines +310 to +311
/// `priority` or `flex`; legacy `fast` also works). Use `unset` to opt
/// out of the model catalog default service tier.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Did not want to use "default" because that is a real service tier on the backend and the behavior we are introducing here is not consistent. If we see "unset", we would pass null for service tier which feel wrong if we do it with "default".

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Alternatively I was thinking about introducing a separate boolean to track user intentional for not using defualt service tier prodvided by the backend but that feel fragile and hard to reasoning if user config state is incorrect.

Comment on lines -595 to -597
let account_plan_type = auth_manager
.auth_cached()
.and_then(|auth| auth.account_plan_type());
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Default service tier is now backend driven.

@shijie-oai shijie-oai force-pushed the shijie/default-codex-service-tier branch from 8b0451b to 2a792e2 Compare May 11, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant