Hmbown/CodeWhale · error · anyhow::Error

Tool was called with operator-supplied commands or…

Error message

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.

What it means

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.

Solutions

  1. Drop the `commands` field and rely on the built-in verification gates
  2. Remove the redirecting flag from the arguments
  3. Use a write-capable role if arbitrary commands are genuinely required

Example fix

// before
subagent.call("verify", { commands: ["cargo test 2>&1 | tee result.txt"] })
// after
subagent.call("verify", { action: "test" })
Defensive patterns

Strategy: validation

Validate before calling

if (!agent.canWrite && (input.commands || /\b[>|]{1,2}\s*\S/.test(JSON.stringify(input)))) {
  throw new Error('operator commands/redirects require a write-capable role');
}

Type guard

const isUnboundedVerification = (input) => 'commands' in input || /(^|\s)[>|]{1,2}(\s|$)/.test(input.args?.join(' ') ?? '');

Prevention

When it happens

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

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

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/acec635504585ebf. Report an issue: GitHub.

Appendix: source

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

/// 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"
            | "agents/list"
            | "agents/message"
            | "agents/followup"
            | "agents/interrupt"
            | "agents/coordinate"

View on GitHub (pinned to 73e0f67d83)