Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

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

iceweasel-oaifd41e813cb59
diff --git a/codex-rs/core/src/tools/handlers/shell_spec.rs b/codex-rs/core/src/tools/handlers/shell_spec.rs
index 8ef9af9083..a07b741639 100644
--- a/codex-rs/core/src/tools/handlers/shell_spec.rs
+++ b/codex-rs/core/src/tools/handlers/shell_spec.rs
@@ -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."
};
diff --git a/codex-rs/core/src/tools/handlers/shell_spec_tests.rs b/codex-rs/core/src/tools/handlers/shell_spec_tests.rs
index 441d93a89d..044a6112f7 100644
--- a/codex-rs/core/src/tools/handlers/shell_spec_tests.rs
+++ b/codex-rs/core/src/tools/handlers/shell_spec_tests.rs
@@ -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."
};
diff --git a/codex-rs/core/src/unified_exec/mod.rs b/codex-rs/core/src/unified_exec/mod.rs
index e8dd31c2ce..ac146dd448 100644
--- a/codex-rs/core/src/unified_exec/mod.rs
+++ b/codex-rs/core/src/unified_exec/mod.rs
@@ -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;
diff --git a/codex-rs/core/src/unified_exec/process_manager_tests.rs b/codex-rs/core/src/unified_exec/process_manager_tests.rs
index ced51882a1..35c6a4e9aa 100644
--- a/codex-rs/core/src/unified_exec/process_manager_tests.rs
+++ b/codex-rs/core/src/unified_exec/process_manager_tests.rs
@@ -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),
diff --git a/codex-rs/core/tests/suite/unified_exec.rs b/codex-rs/core/tests/suite/unified_exec.rs
index dfead68896..07902d01fd 100644
--- a/codex-rs/core/tests/suite/unified_exec.rs
+++ b/codex-rs/core/tests/suite/unified_exec.rs
@@ -2267,9 +2267,11 @@ async fn write_stdin_ctrl_c_terminates_non_tty_session_on_windows() -> Result<()
)
.await?;
- wait_for_event(&test.codex, |event| {
- matches!(event, EventMsg::TurnComplete(_))
- })
+ wait_for_event_with_timeout(
+ &test.codex,
+ |event| matches!(event, EventMsg::TurnComplete(_)),
+ Duration::from_secs(20),
+ )
.await;
let start_output = request_log