Hmbown/CodeWhale · error · anyhow::Error

Tool was called with test-selection arguments, which start…

Error message

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.

What it means

`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.

Solutions

  1. Remove the `args` field so the default verification gate runs
  2. Use a role with shell authority for filtered test runs
  3. Delegate filtered test execution to a dedicated `verifier` role member

Example fix

// before
subagent.call("verify", { action: "test", args: ["my_module::tests::unit_case"] })
// after
subagent.call("verify", { action: "test" })
Defensive patterns

Strategy: validation

Validate before calling

if (!agent.shell && Array.isArray(input.args) && input.args.length > 0) {
  throw new Error('test-selection args require shell authority; drop args');
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/11f60cfa7dab9ed6. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tools/subagent/mod.rs:18341

/// the role useless. But both tools accept an escape hatch that is not
/// verification at all — `run_verifiers` takes `commands`, an array of arbitrary
/// `program` + `args` pairs, and `run_tests` takes `args`, a raw cargo argv.
/// `{"program": "bash", "args": ["-lc", "rm -rf src"]}` is exactly the raw shell
/// that [`crate::fleet::role::RAW_SHELL_DENYLIST`] just removed, re-entered
/// through the one door that was left open for honest reasons.
///
/// So the tools stay and the arbitrary arguments go. The default form — the one
/// the deny list's comment actually promises is bounded — keeps working.
fn reject_unbounded_verification(name: &str, input: &Value, shell: bool) -> Result<()> {
    use crate::tools::execution_envelope::{VerificationBound, classify_verification};

    match classify_verification(canonical_action_alias(name, input), input) {
        None | Some(VerificationBound::Default) => Ok(()),
        // A pure test selection is what the shipped `verifier` role exists to
        // run. It starts a process, so it costs shell authority — and nothing
        // else, because `write` is not what a test filter needs.
        Some(VerificationBound::Filter) if shell => Ok(()),
        Some(VerificationBound::Filter) => Err(anyhow!(
            "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."
        )),
        Some(VerificationBound::Unbounded) => Err(anyhow!(
            "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."
        )),
    }
}

fn is_internal_coordination_state_tool(name: &str) -> bool {
    matches!(
        name,
        "agent"

View on GitHub (pinned to 73e0f67d83)