Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."#
Expand Down Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions src/crates/execution/tool-execution/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
30 changes: 27 additions & 3 deletions src/crates/execution/tool-execution/src/exec_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!({
Expand All @@ -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!({
Expand All @@ -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!({
Expand Down
Loading