You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 Block standalone sleep commands in bash tool (#262)
Blocks `sleep` at the start of bash commands to prevent agents from
wasting time waiting. Agents are instructed via error message to use
polling loops instead (`while ! condition; do sleep 1; done`).
**Pattern:** `/^\s*sleep\s/` - Only blocks sleep at the beginning, not
in loops or after other commands.
**Examples:**
- Blocked: `sleep 5`
- Allowed: `while ! test -f done; do sleep 1; done`
- Allowed: `echo start; sleep 2`
Tests verify blocking behavior and confirm sleep works correctly in
polling loops.
_Generated with `cmux`_
// Block sleep at the beginning of commands - they waste time waiting. Use polling loops instead.
56
+
if(/^\s*sleep\s/.test(script)){
57
+
return{
58
+
success: false,
59
+
error:
60
+
"sleep commands are blocked to minimize waiting time. Instead, use polling loops to check conditions repeatedly (e.g., 'while ! condition; do sleep 1; done' or 'until condition; do sleep 1; done').",
61
+
exitCode: -1,
62
+
wall_duration_ms: 0,
63
+
};
64
+
}
65
+
55
66
// Default timeout to 3 seconds for interactivity
56
67
// OpenAI models often don't provide timeout_secs even when marked required,
57
68
// so we make it optional with a sensible default.
0 commit comments