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:
pakrym-oai authored and copyberry committed 2026-08-07 01:41:54 +00:00
1 parent 9457f8f734
commit d0c8f422ea
11 files changed
+64 -38

No files matched your search

+18 -1
View File
@@ -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()