From 7c035acc6e282cdbaa3b0060a528660fa0dba0d4 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 22 Nov 2026 18:58:26 +0100 Subject: 0.12.1: accept `command` as an alias for `cmd` in bash A field report showed ~40% of bash calls died on a one-word slip (command vs cmd); the alias removes the failure class instead of improving the error for it. --- src/agent.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/agent.rs') diff --git a/src/agent.rs b/src/agent.rs index c3d77c1..f575908 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -372,6 +372,22 @@ fn execute( )); } }; + // A model keeps spelling the bash parameter `command` instead of `cmd`. The + // field report (0.12.0) shows that ~40% of calls died on this one-word slip, + // so accept the alias rather than teaching the model through repeated + // failures. Normalised once, here, so every downstream reader sees `cmd`. + let args = if call.name == "bash" && args.get("cmd").is_none() { + match args.get("command").and_then(|value| value.as_str()) { + Some(command) => { + let mut object = args.as_object().cloned().unwrap_or_default(); + object.insert("cmd".into(), serde_json::Value::String(command.to_string())); + serde_json::Value::Object(object) + } + None => args, + } + } else { + args + }; // The bash approval prompt prints the command; do not print it here too. let repeat_detail = !(tools::approval(&call.name) == Approval::EveryCall && approver.will_prompt_bash()); @@ -402,7 +418,11 @@ fn execute( Err(error) => ToolOutcome::Failed(error), }, Approval::EveryCall => { - let cmd = args.get("cmd").and_then(|v| v.as_str()).unwrap_or(""); + let cmd = args + .get("cmd") + .or_else(|| args.get("command")) + .and_then(|v| v.as_str()) + .unwrap_or(""); if approver.allow_bash(cmd) { match tools::run(&call.name, &args, cancel) { Ok(output) => ToolOutcome::Ok(output), -- cgit v1.2.3