Raise the Windows exec yield floor to 10 seconds (#35670)

## What changed

- Clamp the initial `exec_command` yield time to at least 10 seconds on Windows.
- Update the tool description and unit coverage for the new effective range.
- Allow the Windows Ctrl-C integration test up to 20 seconds to complete.

GitOrigin-RevId: 65d4d1c9a89dc9979e10d3e565af61c9f632c058
This commit is contained in:
iceweasel-oai
2026-07-27 21:12:00 +00:00
committed by copyberry
parent bbb92457b0
commit fd41e813cb
5 changed files with 16 additions and 6 deletions
@@ -24,7 +24,7 @@ pub(crate) fn create_exec_command_tool_with_environment_id(
include_shell_parameter: bool,
) -> ToolSpec {
let yield_time_ms_description = if cfg!(windows) {
"Maximum time to wait before returning a session ID for a still-running command. Commands that finish sooner return immediately. For ordinary commands, omit this parameter to use the 10000 ms default. Effective range on Windows is 2000-30000 ms. Set a shorter value only when intentionally starting a long-lived or interactive process and you want a session ID promptly."
"Maximum time to wait before returning a session ID for a still-running command. Commands that finish sooner return immediately. For ordinary commands, omit this parameter to use the 10000 ms default. Effective range on Windows is 10000-30000 ms."
} else {
"Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms."
};
@@ -30,7 +30,7 @@ fn exec_command_tool_matches_expected_spec() {
.to_string()
};
let yield_time_ms_description = if cfg!(windows) {
"Maximum time to wait before returning a session ID for a still-running command. Commands that finish sooner return immediately. For ordinary commands, omit this parameter to use the 10000 ms default. Effective range on Windows is 2000-30000 ms. Set a shorter value only when intentionally starting a long-lived or interactive process and you want a session ID promptly."
"Maximum time to wait before returning a session ID for a still-running command. Commands that finish sooner return immediately. For ordinary commands, omit this parameter to use the 10000 ms default. Effective range on Windows is 10000-30000 ms."
} else {
"Wait before yielding output. Defaults to 10000 ms; effective range is 250-30000 ms."
};
+1 -1
View File
@@ -62,7 +62,7 @@ pub(crate) use process::SpawnLifecycleHandle;
pub(crate) use process::UnifiedExecProcess;
pub(crate) const MIN_YIELD_TIME_MS: u64 = 250;
pub(crate) const WINDOWS_INITIAL_EXEC_YIELD_TIME_FLOOR_MS: u64 = 2_000;
pub(crate) const WINDOWS_INITIAL_EXEC_YIELD_TIME_FLOOR_MS: u64 = 10_000;
// Minimum yield time for an empty `write_stdin`.
pub(crate) const MIN_EMPTY_YIELD_TIME_MS: u64 = 5_000;
pub(crate) const MAX_YIELD_TIME_MS: u64 = 30_000;
@@ -231,6 +231,14 @@ fn initial_exec_yield_time_uses_windows_floor() {
clamp_yield_time(/*yield_time_ms*/ 1_000),
crate::unified_exec::WINDOWS_INITIAL_EXEC_YIELD_TIME_FLOOR_MS
);
assert_eq!(
clamp_yield_time(/*yield_time_ms*/ 2_000),
crate::unified_exec::WINDOWS_INITIAL_EXEC_YIELD_TIME_FLOOR_MS
);
assert_eq!(
clamp_yield_time(/*yield_time_ms*/ 5_000),
crate::unified_exec::WINDOWS_INITIAL_EXEC_YIELD_TIME_FLOOR_MS
);
assert_eq!(clamp_yield_time(/*yield_time_ms*/ 10_000), 10_000);
assert_eq!(
clamp_yield_time(/*yield_time_ms*/ above_max_yield_time_ms),