mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +00:00
Configure the default code-mode exec yield timeout (#37352)
## What changed - Add `features.code_mode.default_exec_yield_time_ms`, defaulting to 30 seconds. - Apply the configured default to code-mode `exec` calls that omit `yield_time_ms` and reflect it in the tool description. - Remove the `code_mode_buffered_exec` compatibility feature flag. ## Testing - Cover config loading and tool descriptions for both default and custom yield timeouts. GitOrigin-RevId: 581ffc737b04721c7b5fc81260b1da1cf7d87523
This commit is contained in:
1 parent
9457f8f734
commit
d0c8f422ea
11 files changed
+64
-38
No files matched your search
@@ -538,6 +538,7 @@ async fn load_config_resolves_code_mode_config() -> std::io::Result<()> {
|
||||
r#"
|
||||
[features.code_mode]
|
||||
enabled = true
|
||||
default_exec_yield_time_ms = 10000
|
||||
excluded_tool_namespaces = ["mcp__codex_apps", "multi_agent_v1"]
|
||||
direct_only_tool_namespaces = ["mcp__history", "mcp__notes"]
|
||||
|
||||
@@ -554,6 +555,7 @@ disable_in_process_fallback = true
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_eq!(config.code_mode.default_exec_yield_time_ms, 10_000);
|
||||
assert_eq!(
|
||||
config.code_mode.excluded_tool_namespaces,
|
||||
vec!["mcp__codex_apps".to_string(), "multi_agent_v1".to_string()]
|
||||
|
||||
@@ -1117,14 +1117,28 @@ pub struct ToolRegistryConfig {
|
||||
pub error_on_tool_collisions: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize)]
|
||||
const DEFAULT_CODE_MODE_EXEC_YIELD_TIME_MS: u64 = 30_000;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct CodeModeConfig {
|
||||
pub default_exec_yield_time_ms: u64,
|
||||
pub excluded_tool_namespaces: Vec<String>,
|
||||
pub direct_only_tool_namespaces: Vec<String>,
|
||||
/// Keep code mode fail-closed when the standalone host is unavailable.
|
||||
pub disable_in_process_fallback: bool,
|
||||
}
|
||||
|
||||
impl Default for CodeModeConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
default_exec_yield_time_ms: DEFAULT_CODE_MODE_EXEC_YIELD_TIME_MS,
|
||||
excluded_tool_namespaces: Vec::new(),
|
||||
direct_only_tool_namespaces: Vec::new(),
|
||||
disable_in_process_fallback: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) const DEFAULT_TOKEN_BUDGET_REMINDER_MESSAGE_TEMPLATE: &str = concat!(
|
||||
"Your context window is nearly exhausted (only {n_remaining} tokens remaining) and will be automatically reset for you soon. ",
|
||||
"Once reset, message items in current context window will be cleared in the new window, but notes and history items will be persistent across windows."
|
||||
@@ -2685,6 +2699,9 @@ fn resolve_code_mode_config(config_toml: &ConfigToml) -> CodeModeConfig {
|
||||
});
|
||||
|
||||
CodeModeConfig {
|
||||
default_exec_yield_time_ms: base
|
||||
.and_then(|config| config.default_exec_yield_time_ms)
|
||||
.unwrap_or(DEFAULT_CODE_MODE_EXEC_YIELD_TIME_MS),
|
||||
excluded_tool_namespaces: base
|
||||
.and_then(|config| config.excluded_tool_namespaces.as_ref())
|
||||
.cloned()
|
||||
|
||||
Reference in new issue
Block a user