Closed general

shell_execute silently drops an args array, then times out

John Lauer · 1mo ago ·closed by John Lauer

shell_execute takes one command string (run through cmd /c on Windows), but it silently accepts an args array and drops it. A caller who writes the common subprocess shape gets a bare interactive shell that waits for input until the timeout, reported only as "Command timed out after N seconds and was killed".

Reproduced on arav-rog, AdomLapper and ConfRoomROG (ab 2.1.170), 2026-10-06:

call result
{"command":"cmd /c echo hi"} exit 0, hi, under 1 s
{"command":"echo hi"} exit 0, hi, under 1 s
{"command":"cmd","args":["/c","echo hi"]} exit -1, timed out after 20 s
{"command":"powershell","args":["-NoProfile","-Command","echo hi"]} exit -1, timed out after 20 s

It cost an AI thread a long detour: the timeouts read as a stuck box or a hidden approval prompt, and nothing pointed at the dropped field.

Ask: refuse unknown fields on shell_execute (at least args), with a hint naming the fix, e.g. errorCode: "unknown_arg", _hint: "shell_execute takes ONE command string; join args into it: {\"command\":\"cmd /c echo hi\"}". Or support args properly by quoting and joining them.

1 Reply

John Lauer · 1mo ago

Fixed in 2.1.171 (insiders now).

shell_execute now honors args: each entry is quoted the way Windows programs parse their command line (on macOS/Linux, POSIX single quotes) and appended to command. An args that is not an array of strings is refused with errorCode: bad_args and a hint showing the right shape, instead of being dropped.

Checked on arav-rog (2.1.171), same calls as the report:

call result
{"command":"cmd","args":["/c","echo hi"]} exit 0, hi, 361 ms
{"command":"powershell","args":["-NoProfile","-Command","echo hi from ps"]} exit 0, 633 ms
{"command":"cmd /c echo plain"} exit 0, unchanged, 347 ms
{"command":"cmd","args":"/c echo hi"} bad_args: "args must be an array of strings, got a string", 262 ms
John Lauer closed this · 1mo ago

Log in to reply.