Skip to content

Commit c5415a2

Browse files
committed
Enforce 30-second minimum timeout on bash commands
The model passes timeout values thinking they are seconds (e.g. 60) but the tool reads them as milliseconds, killing nmap/curl/ping in 15-60ms before they can even connect. Now any timeout under 30s is bumped to 30s so network commands actually have time to finish.
1 parent 05ae7f0 commit c5415a2

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

rust/crates/runtime/src/bash.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ async fn execute_bash_async(
109109
) -> io::Result<BashCommandOutput> {
110110
let mut command = prepare_tokio_command(&input.command, &cwd, &sandbox_status, true);
111111

112+
// The model often passes timeout values thinking they're seconds (e.g. 60)
113+
// but the parameter is in milliseconds. Enforce a 30-second floor so
114+
// network commands (nmap, curl, ping) actually have time to finish.
112115
let output_result = if let Some(timeout_ms) = input.timeout {
116+
let timeout_ms = timeout_ms.max(30_000);
113117
match timeout(Duration::from_millis(timeout_ms), command.output()).await {
114118
Ok(result) => (result?, false),
115119
Err(_) => {

rust/crates/tools/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5985,6 +5985,9 @@ fn execute_shell_command(
59855985
.stderr(std::process::Stdio::piped());
59865986

59875987
if let Some(timeout_ms) = timeout {
5988+
// Floor: 30 seconds minimum — the model often passes small values
5989+
// thinking the unit is seconds, but it's milliseconds.
5990+
let timeout_ms = timeout_ms.max(30_000);
59885991
let mut child = process.spawn()?;
59895992
let started = Instant::now();
59905993
loop {

0 commit comments

Comments
 (0)