mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
Add buffered code-mode exec yields (#34441)
## What changed - Add the experimental `code_mode_buffered_exec` feature. - When enabled, default code-mode `exec` calls without an explicit `yield_time_ms` to 30 seconds instead of 10 seconds. - Report the effective default in the model-visible `exec` tool description. ## Testing - Verify that the generated tool description advertises the 30-second default when the feature is enabled. GitOrigin-RevId: 0eea4d0105137f09050ce31aad18c25c79df6b2a
This commit is contained in:
@@ -253,10 +253,14 @@ pub fn build_exec_tool_description(
|
||||
enabled_tools: &[ToolDefinition],
|
||||
deferred_tools: &[ToolDefinition],
|
||||
namespace_descriptions: &BTreeMap<String, ToolNamespaceDescription>,
|
||||
default_exec_yield_time_ms: u64,
|
||||
code_mode_only: bool,
|
||||
) -> String {
|
||||
let mut sections = Vec::new();
|
||||
sections.push(EXEC_DESCRIPTION_TEMPLATE.to_string());
|
||||
sections.push(EXEC_DESCRIPTION_TEMPLATE.replace(
|
||||
"Defaults to 10000 ms.",
|
||||
&format!("Defaults to {default_exec_yield_time_ms} ms."),
|
||||
));
|
||||
if !deferred_tools.is_empty() {
|
||||
sections.push(DEFERRED_NESTED_TOOLS_GUIDANCE.to_string());
|
||||
}
|
||||
@@ -868,6 +872,7 @@ mod tests {
|
||||
}],
|
||||
&[],
|
||||
&BTreeMap::new(),
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ true,
|
||||
);
|
||||
assert!(description.contains(
|
||||
@@ -879,8 +884,13 @@ bar"
|
||||
|
||||
#[test]
|
||||
fn exec_description_mentions_timeout_helpers() {
|
||||
let description =
|
||||
build_exec_tool_description(&[], &[], &BTreeMap::new(), /*code_mode_only*/ false);
|
||||
let description = build_exec_tool_description(
|
||||
&[],
|
||||
&[],
|
||||
&BTreeMap::new(),
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ false,
|
||||
);
|
||||
assert!(description.contains("`audio(audioUrlOrItem:"));
|
||||
assert!(description.contains("`setTimeout(callback: () => void, delayMs?: number)`"));
|
||||
assert!(description.contains("`clearTimeout(timeoutId?: number)`"));
|
||||
@@ -932,6 +942,7 @@ bar"
|
||||
],
|
||||
&[],
|
||||
&namespace_descriptions,
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ true,
|
||||
);
|
||||
assert_eq!(description.matches("## mcp__sample").count(), 1);
|
||||
@@ -972,6 +983,7 @@ bar"
|
||||
}],
|
||||
&[],
|
||||
&namespace_descriptions,
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ true,
|
||||
);
|
||||
|
||||
@@ -1071,6 +1083,7 @@ bar"
|
||||
],
|
||||
&[],
|
||||
&BTreeMap::new(),
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ true,
|
||||
);
|
||||
|
||||
@@ -1106,6 +1119,7 @@ bar"
|
||||
&[],
|
||||
&[deferred_tool],
|
||||
&BTreeMap::new(),
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ true,
|
||||
);
|
||||
|
||||
@@ -1127,6 +1141,7 @@ bar"
|
||||
output_schema: None,
|
||||
}],
|
||||
&BTreeMap::new(),
|
||||
crate::DEFAULT_EXEC_YIELD_TIME_MS,
|
||||
/*code_mode_only*/ false,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user