{"record":{"id":"acec635504585ebf","repo":"Hmbown/CodeWhale","slug":"tool-name-was-called-with-operator-supplied-comm","errorCode":null,"errorMessage":"Tool {name} was called with operator-supplied commands or arguments that can name a program or redirect what runs, which spawns arbitrary programs and can mutate the workspace. This agent runs read-only, so only the built-in verification gates and test-selection arguments are available. Drop `commands`, drop the redirecting flag, or use a write-capable role.","messagePattern":"Tool (.+?) was called with operator-supplied commands or arguments that can name a program or redirect what runs, which spawns arbitrary programs and can mutate the workspace\\. This agent runs read-only, so only the built-in verification gates and test-selection arguments are available\\. Drop `commands`, drop the redirecting flag, or use a write-capable role\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":18346,"sourceCode":"/// through the one door that was left open for honest reasons.\n///\n/// So the tools stay and the arbitrary arguments go. The default form — the one\n/// the deny list's comment actually promises is bounded — keeps working.\nfn reject_unbounded_verification(name: &str, input: &Value, shell: bool) -> Result<()> {\n    use crate::tools::execution_envelope::{VerificationBound, classify_verification};\n\n    match classify_verification(canonical_action_alias(name, input), input) {\n        None | Some(VerificationBound::Default) => Ok(()),\n        // A pure test selection is what the shipped `verifier` role exists to\n        // run. It starts a process, so it costs shell authority — and nothing\n        // else, because `write` is not what a test filter needs.\n        Some(VerificationBound::Filter) if shell => Ok(()),\n        Some(VerificationBound::Filter) => Err(anyhow!(\n            \"Tool {name} was called with test-selection arguments, which start a test process, \\\n             and this agent has no shell authority. Drop `args` to run the default verification \\\n             gate.\"\n        )),\n        Some(VerificationBound::Unbounded) => Err(anyhow!(\n            \"Tool {name} was called with operator-supplied commands or arguments that can name a \\\n             program or redirect what runs, which spawns arbitrary programs and can mutate the \\\n             workspace. This agent runs read-only, so only the built-in verification gates and \\\n             test-selection arguments are available. Drop `commands`, drop the redirecting flag, \\\n             or use a write-capable role.\"\n        )),\n    }\n}\n\nfn is_internal_coordination_state_tool(name: &str) -> bool {\n    matches!(\n        name,\n        \"agent\"\n            | \"agents/list\"\n            | \"agents/message\"\n            | \"agents/followup\"\n            | \"agents/interrupt\"\n            | \"agents/coordinate\"","sourceCodeStart":18328,"sourceCodeEnd":18364,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/mod.rs#L18328-L18364","documentation":"Verification tools accept only the built-in gates, test-selection args (with shell authority), or nothing. `VerificationBound::Unbounded` means the input carries operator-supplied commands or redirecting flags that could name an arbitrary program or mutate the workspace, which read-only agents must never do.","triggerScenarios":"A read-only (no write capability) sub-agent calls a verification tool with a `commands` field, a redirecting flag, or other operator-supplied command material, so `classify_verification` returns `VerificationBound::Unbounded`.","commonSituations":"Prompting an agent to run a custom command through the verify tool instead of the built-in gate; trying `commands: [\"cargo test -- --nocapture > out.txt\"]` from a read-only role; injecting a shell redirect into a verification call.","solutions":["Drop the `commands` field and rely on the built-in verification gates","Remove the redirecting flag from the arguments","Use a write-capable role if arbitrary commands are genuinely required"],"exampleFix":"// before\nsubagent.call(\"verify\", { commands: [\"cargo test 2>&1 | tee result.txt\"] })\n// after\nsubagent.call(\"verify\", { action: \"test\" })","handlingStrategy":"validation","validationCode":"if (!agent.canWrite && (input.commands || /\\b[>|]{1,2}\\s*\\S/.test(JSON.stringify(input)))) {\n  throw new Error('operator commands/redirects require a write-capable role');\n}","typeGuard":"const isUnboundedVerification = (input) => 'commands' in input || /(^|\\s)[>|]{1,2}(\\s|$)/.test(input.args?.join(' ') ?? '');","tryCatchPattern":null,"preventionTips":["Restrict read-only agents to built-in verification gates","Strip commands/redirect flags from verification inputs before dispatch","Audit prompts for instruction patterns that inject commands"],"tags":["subagent","shell-injection-guard","read-only"],"backgroundTag":"permission-denied","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}