mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Preserve configured Flex tiers without catalog or fast-mode support (#46230)
## Why An explicit `service_tier = "flex"` could be dropped when fast mode was disabled or the model catalog did not advertise Flex, even though Flex is an API request option. ## What changed - Preserve configured `flex` through core session settings, TUI tier resolution, and request construction regardless of fast-mode or catalog support. - Omit `service_tier` from Amazon Bedrock requests, including with custom catalogs, because Bedrock only supports the implicit default tier. ## Testing Add regression coverage for Flex configured at startup or through thread settings, connected thread startup, and TUI turn submission. Update review coverage to expect Flex with fast mode disabled, and verify that both Bedrock providers omit `service_tier`. GitOrigin-RevId: 98f2761bdd780603839ebfec75cb983a5d55e554
This commit is contained in:
@@ -932,7 +932,12 @@ impl ModelClient {
|
||||
prompt.output_schema_strict,
|
||||
);
|
||||
let prompt_cache_key = Some(self.prompt_cache_key(responses_metadata));
|
||||
let service_tier = model_info.service_tier_for_request(service_tier);
|
||||
let service_tier = if self.state.provider.info().is_amazon_bedrock() {
|
||||
// Bedrock only supports the implicit default tier, including with custom catalogs.
|
||||
None
|
||||
} else {
|
||||
model_info.service_tier_for_request(service_tier)
|
||||
};
|
||||
let request = ResponsesApiRequest {
|
||||
model: model_info.slug.clone(),
|
||||
instructions,
|
||||
|
||||
@@ -107,6 +107,7 @@ use codex_protocol::approvals::NetworkPolicyRuleAction;
|
||||
use codex_protocol::config_types::ApprovalsReviewer;
|
||||
use codex_protocol::config_types::AutoCompactTokenLimitScope;
|
||||
use codex_protocol::config_types::SERVICE_TIER_DEFAULT_REQUEST_VALUE;
|
||||
use codex_protocol::config_types::ServiceTier;
|
||||
use codex_protocol::config_types::WebSearchMode;
|
||||
use codex_protocol::dynamic_tools::DynamicToolResponse;
|
||||
use codex_protocol::dynamic_tools::DynamicToolSpec;
|
||||
@@ -1076,13 +1077,17 @@ fn get_service_tier(
|
||||
fast_mode_enabled: bool,
|
||||
model_info: &ModelInfo,
|
||||
) -> Option<String> {
|
||||
if !fast_mode_enabled {
|
||||
return None;
|
||||
let service_tier = configured_service_tier?;
|
||||
if service_tier == ServiceTier::Flex.request_value() {
|
||||
return Some(service_tier);
|
||||
}
|
||||
configured_service_tier.filter(|service_tier| {
|
||||
service_tier == SERVICE_TIER_DEFAULT_REQUEST_VALUE
|
||||
|| model_info.supports_service_tier(service_tier)
|
||||
})
|
||||
if fast_mode_enabled
|
||||
&& (service_tier == SERVICE_TIER_DEFAULT_REQUEST_VALUE
|
||||
|| model_info.supports_service_tier(&service_tier))
|
||||
{
|
||||
return Some(service_tier);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn unsupported_service_tier_warning(
|
||||
|
||||
@@ -4626,14 +4626,6 @@ fn get_service_tier_drops_unsupported_configured_tier_when_fast_mode_enabled() {
|
||||
),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
get_service_tier(
|
||||
Some(ServiceTier::Flex.request_value().to_string()),
|
||||
/*fast_mode_enabled*/ true,
|
||||
&model_info,
|
||||
),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
get_service_tier(
|
||||
Some(SERVICE_TIER_DEFAULT_REQUEST_VALUE.to_string()),
|
||||
@@ -4645,7 +4637,22 @@ fn get_service_tier_drops_unsupported_configured_tier_when_fast_mode_enabled() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_service_tier_ignores_configured_tier_when_fast_mode_disabled() {
|
||||
fn get_service_tier_preserves_flex_without_catalog_support_or_fast_mode() {
|
||||
let model_info = model_with_default_service_tier(/*default_service_tier*/ None);
|
||||
for fast_mode_enabled in [false, true] {
|
||||
assert_eq!(
|
||||
get_service_tier(
|
||||
Some(ServiceTier::Flex.request_value().to_string()),
|
||||
fast_mode_enabled,
|
||||
&model_info,
|
||||
),
|
||||
Some(ServiceTier::Flex.request_value().to_string())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_service_tier_ignores_non_flex_tiers_when_fast_mode_disabled() {
|
||||
let model_info = model_with_default_service_tier(Some(ServiceTier::Fast.request_value()));
|
||||
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user