mirror of
https://github.com/openai/codex.git
synced 2026-04-26 15:45:02 +00:00
Rename code mode tool to exec (#14254)
Summary - update the code-mode handler, runner, instructions, and error text to refer to the `exec` tool name everywhere that used to say `code_mode` - ensure generated documentation strings and tool specs describe `exec` and rely on the shared `PUBLIC_TOOL_NAME` - refresh the suite tests so they invoke `exec` instead of the old name Testing - Not run (not requested)
This commit is contained in:
committed by
Michael Bolin
parent
e77b2fd925
commit
8a099b3dfb
@@ -50,7 +50,7 @@ async fn run_code_mode_turn(
|
||||
server,
|
||||
sse(vec![
|
||||
ev_response_created("resp-1"),
|
||||
ev_custom_tool_call("call-1", "code_mode", code),
|
||||
ev_custom_tool_call("call-1", "exec", code),
|
||||
ev_completed("resp-1"),
|
||||
]),
|
||||
)
|
||||
@@ -114,7 +114,7 @@ async fn run_code_mode_turn_with_rmcp(
|
||||
server,
|
||||
sse(vec![
|
||||
ev_response_created("resp-1"),
|
||||
ev_custom_tool_call("call-1", "code_mode", code),
|
||||
ev_custom_tool_call("call-1", "exec", code),
|
||||
ev_completed("resp-1"),
|
||||
]),
|
||||
)
|
||||
@@ -141,7 +141,7 @@ async fn code_mode_can_return_exec_command_output() -> Result<()> {
|
||||
let server = responses::start_mock_server().await;
|
||||
let (_test, second_mock) = run_code_mode_turn(
|
||||
&server,
|
||||
"use code_mode to run exec_command",
|
||||
"use exec to run exec_command",
|
||||
r#"
|
||||
import { exec_command } from "tools.js";
|
||||
|
||||
@@ -156,7 +156,7 @@ add_content(JSON.stringify(await exec_command({ cmd: "printf code_mode_exec_mark
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode call failed unexpectedly: {output}"
|
||||
"exec call failed unexpectedly: {output}"
|
||||
);
|
||||
let parsed: Value = serde_json::from_str(&output)?;
|
||||
assert!(
|
||||
@@ -184,7 +184,7 @@ async fn code_mode_can_truncate_final_result_with_configured_budget() -> Result<
|
||||
let server = responses::start_mock_server().await;
|
||||
let (_test, second_mock) = run_code_mode_turn(
|
||||
&server,
|
||||
"use code_mode to truncate the final result",
|
||||
"use exec to truncate the final result",
|
||||
r#"
|
||||
import { exec_command } from "tools.js";
|
||||
import { set_max_output_tokens_per_exec_call } from "@openai/code_mode";
|
||||
@@ -205,7 +205,7 @@ add_content(JSON.stringify(await exec_command({
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode call failed unexpectedly: {output}"
|
||||
"exec call failed unexpectedly: {output}"
|
||||
);
|
||||
let expected_pattern = r#"(?sx)
|
||||
\A
|
||||
@@ -228,7 +228,7 @@ async fn code_mode_can_output_serialized_text_via_openai_code_mode_module() -> R
|
||||
let server = responses::start_mock_server().await;
|
||||
let (_test, second_mock) = run_code_mode_turn(
|
||||
&server,
|
||||
"use code_mode to return structured text",
|
||||
"use exec to return structured text",
|
||||
r#"
|
||||
import { output_text } from "@openai/code_mode";
|
||||
|
||||
@@ -243,7 +243,7 @@ output_text({ json: true });
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode call failed unexpectedly: {output}"
|
||||
"exec call failed unexpectedly: {output}"
|
||||
);
|
||||
assert_eq!(output, r#"{"json":true}"#);
|
||||
|
||||
@@ -257,7 +257,7 @@ async fn code_mode_surfaces_output_text_stringify_errors() -> Result<()> {
|
||||
let server = responses::start_mock_server().await;
|
||||
let (_test, second_mock) = run_code_mode_turn(
|
||||
&server,
|
||||
"use code_mode to return circular text",
|
||||
"use exec to return circular text",
|
||||
r#"
|
||||
import { output_text } from "@openai/code_mode";
|
||||
|
||||
@@ -276,7 +276,7 @@ output_text(circular);
|
||||
Some(true),
|
||||
"circular stringify unexpectedly succeeded"
|
||||
);
|
||||
assert!(output.contains("code_mode execution failed"));
|
||||
assert!(output.contains("exec execution failed"));
|
||||
assert!(output.contains("Converting circular structure to JSON"));
|
||||
|
||||
Ok(())
|
||||
@@ -289,7 +289,7 @@ async fn code_mode_can_output_images_via_openai_code_mode_module() -> Result<()>
|
||||
let server = responses::start_mock_server().await;
|
||||
let (_test, second_mock) = run_code_mode_turn(
|
||||
&server,
|
||||
"use code_mode to return images",
|
||||
"use exec to return images",
|
||||
r#"
|
||||
import { output_image } from "@openai/code_mode";
|
||||
|
||||
@@ -342,14 +342,14 @@ async fn code_mode_can_apply_patch_via_nested_tool() -> Result<()> {
|
||||
);
|
||||
|
||||
let (test, second_mock) =
|
||||
run_code_mode_turn(&server, "use code_mode to run apply_patch", &code, true).await?;
|
||||
run_code_mode_turn(&server, "use exec to run apply_patch", &code, true).await?;
|
||||
|
||||
let req = second_mock.single_request();
|
||||
let (output, success) = custom_tool_output_text_and_success(&req, "call-1");
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode apply_patch call failed unexpectedly: {output}"
|
||||
"exec apply_patch call failed unexpectedly: {output}"
|
||||
);
|
||||
|
||||
let file_path = test.cwd_path().join(file_name);
|
||||
@@ -378,15 +378,14 @@ add_content(
|
||||
"#;
|
||||
|
||||
let (_test, second_mock) =
|
||||
run_code_mode_turn_with_rmcp(&server, "use code_mode to run the rmcp echo tool", code)
|
||||
.await?;
|
||||
run_code_mode_turn_with_rmcp(&server, "use exec to run the rmcp echo tool", code).await?;
|
||||
|
||||
let req = second_mock.single_request();
|
||||
let (output, success) = custom_tool_output_text_and_success(&req, "call-1");
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode rmcp echo call failed unexpectedly: {output}"
|
||||
"exec rmcp echo call failed unexpectedly: {output}"
|
||||
);
|
||||
assert_eq!(
|
||||
output,
|
||||
@@ -418,15 +417,14 @@ add_content(
|
||||
"#;
|
||||
|
||||
let (_test, second_mock) =
|
||||
run_code_mode_turn_with_rmcp(&server, "use code_mode to run the rmcp echo tool", code)
|
||||
.await?;
|
||||
run_code_mode_turn_with_rmcp(&server, "use exec to run the rmcp echo tool", code).await?;
|
||||
|
||||
let req = second_mock.single_request();
|
||||
let (output, success) = custom_tool_output_text_and_success(&req, "call-1");
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode rmcp echo call failed unexpectedly: {output}"
|
||||
"exec rmcp echo call failed unexpectedly: {output}"
|
||||
);
|
||||
assert_eq!(
|
||||
output,
|
||||
@@ -460,7 +458,7 @@ add_content(
|
||||
|
||||
let (_test, second_mock) = run_code_mode_turn_with_rmcp(
|
||||
&server,
|
||||
"use code_mode to run the rmcp image scenario tool",
|
||||
"use exec to run the rmcp image scenario tool",
|
||||
code,
|
||||
)
|
||||
.await?;
|
||||
@@ -470,7 +468,7 @@ add_content(
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode rmcp image scenario call failed unexpectedly: {output}"
|
||||
"exec rmcp image scenario call failed unexpectedly: {output}"
|
||||
);
|
||||
assert_eq!(
|
||||
output,
|
||||
@@ -504,15 +502,14 @@ add_content(
|
||||
"#;
|
||||
|
||||
let (_test, second_mock) =
|
||||
run_code_mode_turn_with_rmcp(&server, "use code_mode to call rmcp echo badly", code)
|
||||
.await?;
|
||||
run_code_mode_turn_with_rmcp(&server, "use exec to call rmcp echo badly", code).await?;
|
||||
|
||||
let req = second_mock.single_request();
|
||||
let (output, success) = custom_tool_output_text_and_success(&req, "call-1");
|
||||
assert_ne!(
|
||||
success,
|
||||
Some(false),
|
||||
"code_mode rmcp error call failed unexpectedly: {output}"
|
||||
"exec rmcp error call failed unexpectedly: {output}"
|
||||
);
|
||||
assert_eq!(
|
||||
output,
|
||||
@@ -540,7 +537,7 @@ async fn code_mode_can_store_and_load_values_across_turns() -> Result<()> {
|
||||
ev_response_created("resp-1"),
|
||||
ev_custom_tool_call(
|
||||
"call-1",
|
||||
"code_mode",
|
||||
"exec",
|
||||
r#"
|
||||
import { store } from "@openai/code_mode";
|
||||
|
||||
@@ -569,7 +566,7 @@ add_content("stored");
|
||||
assert_ne!(
|
||||
first_success,
|
||||
Some(false),
|
||||
"code_mode store call failed unexpectedly: {first_output}"
|
||||
"exec store call failed unexpectedly: {first_output}"
|
||||
);
|
||||
assert_eq!(first_output, "stored");
|
||||
|
||||
@@ -579,7 +576,7 @@ add_content("stored");
|
||||
ev_response_created("resp-3"),
|
||||
ev_custom_tool_call(
|
||||
"call-2",
|
||||
"code_mode",
|
||||
"exec",
|
||||
r#"
|
||||
import { load } from "openai/code_mode";
|
||||
|
||||
@@ -607,7 +604,7 @@ add_content(JSON.stringify(load("nb")));
|
||||
assert_ne!(
|
||||
second_success,
|
||||
Some(false),
|
||||
"code_mode load call failed unexpectedly: {second_output}"
|
||||
"exec load call failed unexpectedly: {second_output}"
|
||||
);
|
||||
let loaded: Value = serde_json::from_str(&second_output)?;
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user