mirror of
https://github.com/openai/codex.git
synced 2026-05-25 21:45:22 +00:00
clean up instructions (#22543)
rm behavioral steering in tool docs for code mode.
This commit is contained in:
@@ -7,10 +7,8 @@ use std::collections::BTreeMap;
|
||||
use crate::PUBLIC_TOOL_NAME;
|
||||
|
||||
const MAX_JS_SAFE_INTEGER: u64 = (1_u64 << 53) - 1;
|
||||
const CODE_MODE_ONLY_PREFACE: &str =
|
||||
"Use `exec/wait` tool to run all other tools, do not attempt to use any other tools directly";
|
||||
const DEFERRED_NESTED_TOOLS_GUIDANCE: &str = r#"Some nested MCP/app tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.
|
||||
To find one, filter `ALL_TOOLS` by `name` and `description`; do not print the full `ALL_TOOLS` array. Print only a small set of relevant matches if you need to inspect them."#;
|
||||
To find one, filter `ALL_TOOLS` by `name` and `description`."#;
|
||||
const EXEC_DESCRIPTION_TEMPLATE: &str = r#"Run JavaScript code to orchestrate/compose tool calls
|
||||
- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.
|
||||
- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.
|
||||
@@ -256,9 +254,6 @@ pub fn build_exec_tool_description(
|
||||
deferred_tools_available: bool,
|
||||
) -> String {
|
||||
let mut sections = Vec::new();
|
||||
if code_mode_only {
|
||||
sections.push(CODE_MODE_ONLY_PREFACE.to_string());
|
||||
}
|
||||
sections.push(EXEC_DESCRIPTION_TEMPLATE.to_string());
|
||||
if deferred_tools_available {
|
||||
sections.push(DEFERRED_NESTED_TOOLS_GUIDANCE.to_string());
|
||||
@@ -875,6 +870,7 @@ mod tests {
|
||||
"### `foo`
|
||||
bar"
|
||||
));
|
||||
assert!(!description.contains("do not attempt to use any other tools directly"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1097,5 +1093,6 @@ bar"
|
||||
|
||||
assert!(description.contains("Some nested MCP/app tools may be omitted"));
|
||||
assert!(description.contains("filter `ALL_TOOLS` by `name` and `description`"));
|
||||
assert!(!description.contains("do not print the full `ALL_TOOLS` array"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2265,9 +2265,8 @@ fn code_mode_only_exec_description_includes_full_nested_tool_details() {
|
||||
|
||||
assert!(!description.contains("Enabled nested tools:"));
|
||||
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"
|
||||
));
|
||||
assert!(description.starts_with("Run JavaScript code to orchestrate/compose tool calls"));
|
||||
assert!(!description.contains("do not attempt to use any other tools directly"));
|
||||
assert!(description.contains("### `update_plan`"));
|
||||
assert!(description.contains("### `view_image`"));
|
||||
}
|
||||
|
||||
@@ -1441,6 +1441,11 @@ async fn code_mode_only_can_expose_multi_agent_v2_as_normal_tools() {
|
||||
};
|
||||
assert!(!exec.description.contains("spawn_agent"));
|
||||
assert!(!exec.description.contains("wait_agent"));
|
||||
assert!(
|
||||
!exec
|
||||
.description
|
||||
.contains("do not attempt to use any other tools directly")
|
||||
);
|
||||
|
||||
let spawn_agent = find_tool(&model_visible_specs, "spawn_agent");
|
||||
let ToolSpec::Function(spawn_agent) = spawn_agent else {
|
||||
|
||||
Reference in New Issue
Block a user