From 242b6151a60f03c451f9cf25304d37f16ee6c3f6 Mon Sep 17 00:00:00 2001 From: wsp Date: Mon, 16 Nov 2026 20:11:10 +0800 Subject: [PATCH] fix(exec): Increase default yield time to 180s Raise the ExecCommand and WriteStdin default wait from 30 to 180 seconds to reduce frequent polling of long-running commands. Document explicit 10-minute waits and verify that caller-provided wait times still take precedence over the default. --- .../implementations/exec_command/command.rs | 2 +- .../implementations/exec_command/stdin.rs | 3 +- src/crates/execution/tool-execution/AGENTS.md | 1 + .../tool-execution/src/exec_command.rs | 30 +++++++++++++++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/command.rs b/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/command.rs index 744cca675f..728b14a41a 100644 --- a/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/command.rs +++ b/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/command.rs @@ -726,7 +726,7 @@ Output: }, "yield_time_ms": { "type": "number", - "description": "How long to wait for output before yielding. Defaults to 30000 ms." + "description": "How long to wait for output before yielding. Defaults to 180000 ms." } }, "required": ["cmd"], diff --git a/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/stdin.rs b/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/stdin.rs index e34a4b6053..1dd0cdacd2 100644 --- a/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/stdin.rs +++ b/src/crates/assembly/core/src/agentic/tools/implementations/exec_command/stdin.rs @@ -113,6 +113,7 @@ impl Tool for WriteStdinTool { Ok(r#"Writes stdin to, or polls, a running ExecCommand session. Pass the session_id returned by ExecCommand. Leave chars empty or omit it to poll for new output. +When waiting for a long-running command to finish, explicitly set a longer yield_time_ms, such as 600000 ms, to avoid frequent polling. Use shorter waits when you need to respond to interactive prompts or inspect intermediate output. chars is sent only to sessions started with tty=true. For tty=false sessions, this tool only polls. Use append_enter=true to submit a line after chars. Use this for line-oriented interactive prompts instead of trying to encode \\r or \\n manually. Output is only what was produced during this tool call's wait window."# @@ -141,7 +142,7 @@ Output is only what was produced during this tool call's wait window."# }, "yield_time_ms": { "type": "number", - "description": "How long to wait for output before yielding. Defaults to 30000 ms." + "description": "How long to wait for output before yielding, in milliseconds. Defaults to 180000 ms. When waiting for a long-running command to finish, explicitly set a longer wait, such as 600000 ms, to avoid frequent polling." } }, "required": ["session_id"], diff --git a/src/crates/execution/tool-execution/AGENTS.md b/src/crates/execution/tool-execution/AGENTS.md index 527e6322da..ef7aec4d52 100644 --- a/src/crates/execution/tool-execution/AGENTS.md +++ b/src/crates/execution/tool-execution/AGENTS.md @@ -73,6 +73,7 @@ agent-facing tool surface. ```bash cargo test -p tool-runtime +cargo test -p tool-runtime --no-default-features --lib exec_command::tests:: cargo test -p tool-runtime --no-default-features --lib computer_use cargo test -p tool-runtime --features shell-analysis --lib shell_analysis cargo test -p tool-runtime --lib fs::read_file::tests:: diff --git a/src/crates/execution/tool-execution/src/exec_command.rs b/src/crates/execution/tool-execution/src/exec_command.rs index 27636fcb49..52db3d31f4 100644 --- a/src/crates/execution/tool-execution/src/exec_command.rs +++ b/src/crates/execution/tool-execution/src/exec_command.rs @@ -5,7 +5,7 @@ use std::time::Duration; pub const EXEC_COMMAND_POWERSHELL_UTF8_OUTPUT_PREFIX: &str = "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\n"; -pub const EXEC_COMMAND_DEFAULT_YIELD_TIME_MS: u64 = 30_000; +pub const EXEC_COMMAND_DEFAULT_YIELD_TIME_MS: u64 = 180_000; pub const REMOTE_EXEC_SHELL_PROBE_TIMEOUT_MS: u64 = 3_000; const REMOTE_NON_TTY_INTERRUPT_GRACE_SECONDS: u64 = 2; @@ -1416,7 +1416,7 @@ mod tests { assert_eq!(parsed.cmd, " echo ok "); assert!(!parsed.tty); - assert_eq!(parsed.yield_time_ms, EXEC_COMMAND_DEFAULT_YIELD_TIME_MS); + assert_eq!(parsed.yield_time_ms, 180_000); assert_eq!(exec_command_run_input_validation_message(&input), None); let blank = json!({ @@ -1439,7 +1439,7 @@ mod tests { assert_eq!(parsed.session_id, 7); assert_eq!(parsed.chars, ""); assert!(!parsed.append_enter); - assert_eq!(parsed.yield_time_ms, EXEC_COMMAND_DEFAULT_YIELD_TIME_MS); + assert_eq!(parsed.yield_time_ms, 180_000); assert_eq!(write_stdin_input_validation_message(&input), None); let out_of_range = json!({ @@ -1452,6 +1452,30 @@ mod tests { ); } + #[test] + fn exec_command_and_write_stdin_preserve_explicit_yield_time() { + for yield_time_ms in [0, 1_000, 600_000] { + let input = json!({ + "cmd": "echo ok", + "session_id": 7, + "yield_time_ms": yield_time_ms, + }); + + assert_eq!( + exec_command_run_input_from_input(&input) + .expect("cmd should parse") + .yield_time_ms, + yield_time_ms + ); + assert_eq!( + write_stdin_input_from_input(&input) + .expect("stdin input should parse") + .yield_time_ms, + yield_time_ms + ); + } + } + #[test] fn exec_control_input_policy_keeps_wait_optional() { let input = json!({