mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
Restrict legacy incremental tools to Amazon Bedrock providers (#60040)
## What changed Gate `incremental_tools_legacy` on the `amazon-bedrock` and `amazon-bedrock-runtime` provider IDs instead of the OpenAI provider for regular Responses requests. Responses Lite continues to use `incremental_tools`. ## Testing Expand the tool catalog update scenarios to cover both Bedrock provider IDs with legacy incremental tools enabled and disabled. Update the regular Responses tool removal scenario to use the Bedrock provider. GitOrigin-RevId: ad0ff31975166a2a7fdcee6fefc272ecc79dd448
This commit is contained in:
@@ -14,7 +14,8 @@ use codex_extension_api::ExtensionData;
|
||||
use codex_features::Feature;
|
||||
use codex_file_system::EnvironmentAccess;
|
||||
use codex_mcp::McpBinding;
|
||||
use codex_model_provider_info::OPENAI_PROVIDER_ID;
|
||||
use codex_model_provider_info::AMAZON_BEDROCK_PROVIDER_ID;
|
||||
use codex_model_provider_info::AMAZON_BEDROCK_RUNTIME_PROVIDER_ID;
|
||||
use codex_otel::SessionTelemetry;
|
||||
use codex_plugin::ExecutorPluginHookSource;
|
||||
use codex_protocol::items::ModelInvocationContext;
|
||||
@@ -60,8 +61,11 @@ impl StepContext {
|
||||
if self.settings.model_info.use_responses_lite {
|
||||
Some(Feature::IncrementalTools)
|
||||
} else {
|
||||
(self.turn.config.model_provider_id == OPENAI_PROVIDER_ID)
|
||||
.then_some(Feature::IncrementalToolsLegacy)
|
||||
matches!(
|
||||
self.turn.config.model_provider_id.as_str(),
|
||||
AMAZON_BEDROCK_PROVIDER_ID | AMAZON_BEDROCK_RUNTIME_PROVIDER_ID
|
||||
)
|
||||
.then_some(Feature::IncrementalToolsLegacy)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ use codex_core::ForkSnapshot;
|
||||
use codex_core::McpServersDisabled;
|
||||
use codex_core::compact::AutoCompactionDisabled;
|
||||
use codex_features::Feature;
|
||||
use codex_model_provider_info::AMAZON_BEDROCK_PROVIDER_ID;
|
||||
use codex_model_provider_info::AMAZON_BEDROCK_RUNTIME_PROVIDER_ID;
|
||||
use codex_model_provider_info::OPENAI_PROVIDER_ID;
|
||||
use codex_otel::MetricsClient;
|
||||
use codex_otel::MetricsConfig;
|
||||
use codex_otel::TOOL_INCREMENTAL_UPDATES_METRIC;
|
||||
@@ -148,15 +151,19 @@ async fn prediction_fork_keeps_inherited_tools() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case(true, None, true; "responses_lite")]
|
||||
#[test_case(true, Some(true), true; "announcements_suppressed")]
|
||||
#[test_case(false, None, false; "responses_api")]
|
||||
#[test_case(false, None, true; "responses_api_incremental")]
|
||||
#[test_case(true, None, true, OPENAI_PROVIDER_ID; "responses_lite")]
|
||||
#[test_case(true, Some(true), true, OPENAI_PROVIDER_ID; "announcements_suppressed")]
|
||||
#[test_case(false, None, false, OPENAI_PROVIDER_ID; "responses_api")]
|
||||
#[test_case(false, None, false, AMAZON_BEDROCK_PROVIDER_ID; "mantle_provider_id")]
|
||||
#[test_case(false, None, true, AMAZON_BEDROCK_PROVIDER_ID; "mantle_provider_id_incremental")]
|
||||
#[test_case(false, None, false, AMAZON_BEDROCK_RUNTIME_PROVIDER_ID; "runtime_provider_id")]
|
||||
#[test_case(false, None, true, AMAZON_BEDROCK_RUNTIME_PROVIDER_ID; "runtime_provider_id_incremental")]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn incremental_tools_append_changed_catalog_without_rewriting_history(
|
||||
use_responses_lite: bool,
|
||||
suppress_model_change_announcements: Option<bool>,
|
||||
incremental_tools: bool,
|
||||
provider_id: &'static str,
|
||||
) -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
let server = responses::start_mock_server().await;
|
||||
@@ -203,6 +210,7 @@ async fn incremental_tools_append_changed_catalog_without_rewriting_history(
|
||||
}
|
||||
})
|
||||
.with_config(move |config| {
|
||||
config.model_provider_id = provider_id.to_string();
|
||||
if !use_responses_lite && incremental_tools {
|
||||
config
|
||||
.features
|
||||
@@ -504,6 +512,9 @@ async fn tool_removal_appends_a_standalone_notice_without_rewriting_history(
|
||||
}
|
||||
})
|
||||
.with_config(move |config| {
|
||||
if !use_responses_lite {
|
||||
config.model_provider_id = AMAZON_BEDROCK_PROVIDER_ID.to_string();
|
||||
}
|
||||
config
|
||||
.features
|
||||
.enable(if use_responses_lite {
|
||||
|
||||
@@ -308,7 +308,7 @@ pub enum Feature {
|
||||
CommandSessionsWorldState,
|
||||
/// Track top-level tool definitions in world state and emit incremental context updates.
|
||||
IncrementalTools,
|
||||
/// Publish incremental tool declarations on regular OpenAI Responses.
|
||||
/// Publish incremental tool declarations on regular Amazon Bedrock Responses.
|
||||
IncrementalToolsLegacy,
|
||||
/// Suppress the model ID announcement in incremental context after a model switch.
|
||||
SuppressModelChangeAnnouncements,
|
||||
|
||||
Reference in New Issue
Block a user