{"record":{"id":"11f60cfa7dab9ed6","repo":"Hmbown/CodeWhale","slug":"tool-name-was-called-with-test-selection-argumen","errorCode":null,"errorMessage":"Tool {name} was called with test-selection arguments, which start a test process, and this agent has no shell authority. Drop `args` to run the default verification gate.","messagePattern":"Tool (.+?) was called with test-selection arguments, which start a test process, and this agent has no shell authority\\. Drop `args` to run the default verification gate\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":18341,"sourceCode":"/// the role useless. But both tools accept an escape hatch that is not\n/// verification at all — `run_verifiers` takes `commands`, an array of arbitrary\n/// `program` + `args` pairs, and `run_tests` takes `args`, a raw cargo argv.\n/// `{\"program\": \"bash\", \"args\": [\"-lc\", \"rm -rf src\"]}` is exactly the raw shell\n/// that [`crate::fleet::role::RAW_SHELL_DENYLIST`] just removed, re-entered\n/// 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\"","sourceCodeStart":18323,"sourceCodeEnd":18359,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/mod.rs#L18323-L18359","documentation":"`classify_verification` sorts verification-related tool calls into Default, Filter, or Unbounded. A Filter (test-selection arguments like test-name filters) starts a test process, which requires shell authority. A sub-agent without shell authority may only run the built-in default verification gate.","triggerScenarios":"A no-shell sub-agent calls a verification tool with test-selection arguments in `args` (e.g. cargo test filters, --test flags), so `canonical_action_alias` + `classify_verification` yields `VerificationBound::Filter` while `shell` is false.","commonSituations":"Asking a read-only verifier-role agent to run only one test module; passing `args: [\"test\", \"foo::bar\"]` to a verification tool from a role configured without shell authority.","solutions":["Remove the `args` field so the default verification gate runs","Use a role with shell authority for filtered test runs","Delegate filtered test execution to a dedicated `verifier` role member"],"exampleFix":"// before\nsubagent.call(\"verify\", { action: \"test\", args: [\"my_module::tests::unit_case\"] })\n// after\nsubagent.call(\"verify\", { action: \"test\" })","handlingStrategy":"validation","validationCode":"if (!agent.shell && Array.isArray(input.args) && input.args.length > 0) {\n  throw new Error('test-selection args require shell authority; drop args');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass `args` to verification tools from no-shell roles","Use the built-in default verification gate for read-only agents","Route filtered test runs to a dedicated verifier role"],"tags":["subagent","tests","shell-authority"],"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"}