More renaming

This commit is contained in:
Andrey Mishchenko
2026-03-29 17:19:36 -10:00
parent 3d4c524ee2
commit b8f8ebb995
4 changed files with 22 additions and 22 deletions
+6 -6
View File
@@ -118,7 +118,7 @@ impl CodeModeTurnHost for CoreTurnHost {
input: Option<JsonValue>,
cancellation_token: CancellationToken,
) -> Result<JsonValue, String> {
call_nested_tool(
call_code_mode_function(
self.exec.clone(),
self.tool_runtime.clone(),
tool_name,
@@ -284,7 +284,7 @@ fn enabled_tool_from_spec(spec: ToolSpec) -> Option<codex_code_mode::ToolDefinit
}
async fn build_nested_router(exec: &ExecContext) -> ToolRouter {
let nested_tools_config = exec.turn.tools_config.for_code_mode_nested_tools();
let code_mode_functions_config = exec.turn.tools_config.for_code_mode_nested_tools();
let mcp_tools = exec
.session
.services
@@ -298,7 +298,7 @@ async fn build_nested_router(exec: &ExecContext) -> ToolRouter {
.collect();
ToolRouter::from_config(
&nested_tools_config,
&code_mode_functions_config,
ToolRouterParams {
mcp_tools: Some(mcp_tools),
app_tools: None,
@@ -308,7 +308,7 @@ async fn build_nested_router(exec: &ExecContext) -> ToolRouter {
)
}
async fn call_nested_tool(
async fn call_code_mode_function(
exec: ExecContext,
tool_runtime: ToolCallRuntime,
tool_name: String,
@@ -332,7 +332,7 @@ async fn call_nested_tool(
Err(error) => return Err(FunctionCallError::RespondToModel(error)),
}
} else {
match build_nested_tool_payload(tool_runtime.find_spec(&tool_name), &tool_name, input) {
match build_code_mode_function_call_payload(tool_runtime.find_spec(&tool_name), &tool_name, input) {
Ok(payload) => payload,
Err(error) => return Err(FunctionCallError::RespondToModel(error)),
}
@@ -367,7 +367,7 @@ fn tool_kind_for_name(
.ok_or_else(|| format!("tool `{tool_name}` is not enabled in {PUBLIC_TOOL_NAME}"))
}
fn build_nested_tool_payload(
fn build_code_mode_function_call_payload(
spec: Option<ToolSpec>,
tool_name: &str,
input: Option<JsonValue>,
+2 -2
View File
@@ -546,7 +546,7 @@ impl ToolsConfig {
self
}
pub fn for_code_mode_nested_tools(&self) -> Self {
pub fn for_code_mode_functions(&self) -> Self {
let mut nested = self.clone();
nested.code_mode_enabled = false;
nested.code_mode_only_enabled = false;
@@ -2460,7 +2460,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
let exec_permission_approvals_enabled = config.exec_permission_approvals_enabled;
if config.code_mode_enabled {
let nested_config = config.for_code_mode_nested_tools();
let nested_config = config.for_code_mode_functions();
let (nested_specs, _) = build_specs_with_discoverable_tools(
&nested_config,
mcp_tools.clone(),
+3 -3
View File
@@ -3038,7 +3038,7 @@ fn code_mode_only_restricts_model_tools_to_exec_tools() {
}
#[test]
fn code_mode_only_exec_description_includes_full_nested_tool_details() {
fn code_mode_only_exec_description_includes_full_details_for_code_mode_functions() {
let config = test_config();
let model_info = ModelsManager::construct_model_info_offline_for_tests("gpt-5-codex", &config);
let mut features = Features::with_defaults();
@@ -3067,7 +3067,7 @@ fn code_mode_only_exec_description_includes_full_nested_tool_details() {
panic!("expected freeform tool");
};
assert!(!description.contains("Enabled nested tools:"));
assert!(!description.contains("Enabled functions:"));
assert!(!description.contains("Nested tool reference:"));
assert!(description.starts_with(
"Use `exec/wait` tool to run all other tools, do not attempt to use any other tools directly"
@@ -3077,7 +3077,7 @@ fn code_mode_only_exec_description_includes_full_nested_tool_details() {
}
#[test]
fn code_mode_exec_description_omits_nested_tool_details_when_not_code_mode_only() {
fn code_mode_exec_description_omits_details_for_code_mode_functions_when_not_code_mode_only() {
let config = test_config();
let model_info = ModelsManager::construct_model_info_offline_for_tests("gpt-5-codex", &config);
let mut features = Features::with_defaults();
+11 -11
View File
@@ -316,7 +316,7 @@ async fn code_mode_only_restricts_prompt_tools() -> Result<()> {
#[cfg_attr(windows, ignore = "no exec_command on Windows")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn code_mode_only_can_call_nested_tools() -> Result<()> {
async fn code_mode_only_can_call_functions() -> Result<()> {
skip_if_no_network!(Ok(()));
let server = responses::start_mock_server().await;
@@ -328,7 +328,7 @@ async fn code_mode_only_can_call_nested_tools() -> Result<()> {
"call-1",
"exec",
r#"
const output = await functions.exec_command({ cmd: "printf code_mode_only_nested_tool_marker" });
const output = await functions.exec_command({ cmd: "printf code_mode_only_function_call_marker" });
text(output.output);
"#,
),
@@ -349,7 +349,7 @@ text(output.output);
let _ = config.features.enable(Feature::CodeModeOnly);
});
let test = builder.build(&server).await?;
test.submit_turn("use exec to run nested tool in code mode only")
test.submit_turn("use exec to run function in code mode only")
.await?;
let request = follow_up_mock.single_request();
@@ -357,15 +357,15 @@ text(output.output);
assert_ne!(
success,
Some(false),
"code_mode_only nested tool call failed unexpectedly: {output}"
"code_mode_only function call failed unexpectedly: {output}"
);
assert_eq!(output, "code_mode_only_nested_tool_marker");
assert_eq!(output, "code_mode_only_function_call_marker");
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn code_mode_update_plan_nested_tool_result_is_empty_object() -> Result<()> {
async fn code_mode_update_plan_function_call_result_is_empty_object() -> Result<()> {
skip_if_no_network!(Ok(()));
let server = responses::start_mock_server().await;
@@ -398,7 +398,7 @@ text(JSON.stringify(result));
#[cfg_attr(windows, ignore = "flaky on windows")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn code_mode_nested_tool_calls_can_run_in_parallel() -> Result<()> {
async fn code_mode_function_call_calls_can_run_in_parallel() -> Result<()> {
skip_if_no_network!(Ok(()));
let server = responses::start_mock_server().await;
@@ -580,7 +580,7 @@ async fn code_mode_exec_surfaces_handler_errors_as_exceptions() -> Result<()> {
let server = responses::start_mock_server().await;
let (_test, second_mock) = run_code_mode_turn(
&server,
"surface nested tool handler failures as script exceptions",
"surface function call handler failures as script exceptions",
r#"
try {
await functions.exec_command({});
@@ -598,7 +598,7 @@ try {
assert_ne!(
success,
Some(false),
"script should catch the nested tool error: {output}"
"script should catch the tool error: {output}"
);
assert!(
output.contains("caught:"),
@@ -606,7 +606,7 @@ try {
);
assert!(
!output.contains("no-exception"),
"nested tool error should not allow success path: {output}"
"tool error should not allow success path: {output}"
);
Ok(())
@@ -1879,7 +1879,7 @@ image(out);
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn code_mode_can_apply_patch_via_nested_tool() -> Result<()> {
async fn code_mode_can_apply_patch_via_function_call() -> Result<()> {
skip_if_no_network!(Ok(()));
let server = responses::start_mock_server().await;