Hmbown/CodeWhale · error · anyhow::Error

Invalid auto_review.allow[{index}].action_kind '{action_kind

Error message

Invalid auto_review.allow[{index}].action_kind '{action_kind}': this retired narrow kind cannot safely widen to a v0.9.8 decision class; replace it with an exact tool rule or a current action_kind.

What it means

Specialized allow-rule guard (crates/tui/src/config.rs:3052): for kind == "allow", the normalized action_kind must be exactly one of read, write, shell, external, publish, destructive. Aliases that parse for other rule kinds (e.g. mcp_read) are rejected for allow, because a retired narrow allow rule cannot safely widen to a v0.9.8 decision class - widening would silently allow more than before.

Source

Thrown at crates/tui/src/config.rs:3052

        if !rule.has_matcher() {
            anyhow::bail!(
                "Invalid auto_review.{kind}[{index}]: set at least one of tool or action_kind."
            );
        }
        if let Some(action_kind) = rule.action_kind.as_deref() {
            let normalized = action_kind.trim().to_ascii_lowercase().replace('-', "_");
            if parse_auto_review_action_kind(&normalized).is_none() {
                anyhow::bail!(
                    "Invalid auto_review.{kind}[{index}].action_kind '{action_kind}': expected read, write, shell, external, publish, or destructive."
                );
            }
            if kind == "allow"
                && !matches!(
                    normalized.as_str(),
                    "read" | "write" | "shell" | "external" | "publish" | "destructive"
                )
            {
                anyhow::bail!(
                    "Invalid auto_review.allow[{index}].action_kind '{action_kind}': this retired narrow kind cannot safely widen to a v0.9.8 decision class; replace it with an exact tool rule or a current action_kind."
                );
            }
        }
    }
    Ok(())
}

fn parse_auto_review_action_kind(raw: &str) -> Option<crate::tui::auto_review::ToolActionKind> {
    match raw.trim().to_ascii_lowercase().replace('-', "_").as_str() {
        "read" | "mcp_read" => Some(crate::tui::auto_review::ToolActionKind::Read),
        "write" => Some(crate::tui::auto_review::ToolActionKind::Write),
        "shell" => Some(crate::tui::auto_review::ToolActionKind::Shell),
        "external" | "network" | "git" | "mcp_action" | "browser" | "unknown" => {
            Some(crate::tui::auto_review::ToolActionKind::External)
        }
        "publish" => Some(crate::tui::auto_review::ToolActionKind::Publish),
        "destructive" | "secret" => Some(crate::tui::auto_review::ToolActionKind::Destructive),

View on GitHub (pinned to 8880682c63)

Solutions

  1. Replace the alias with the exact class (mcp_read -> read) or one of the other five current kinds
  2. Or drop action_kind and pin the allow to an exact tool = "<tool-id>" rule
  3. Prefer exact tool allows when in doubt - they can never widen

Example fix

# config.toml - before
[[auto_review.allow]]
action_kind = "mcp_read"

# config.toml - after
[[auto_review.allow]]
action_kind = "read"
# or narrower and safer:
# tool = "mcp__myserver__fetch"
Defensive patterns

Strategy: validation

Validate before calling

// Allow rules: exact classes only, no aliases
const ALLOW_KINDS: [&str; 6] = ["read","write","shell","external","publish","destructive"];
fn allow_kind_ok(k: &str) -> bool { ALLOW_KINDS.contains(&k.trim().to_ascii_lowercase().replace('-', "_").as_str()) }

Type guard

fn is_widened_allow_error(msg: &str) -> bool {
    msg.contains("cannot safely widen to a v0.9.8 decision class")
}

Try / catch

// On migration errors, prefer the narrowest safe rewrite: exact tool allow
if is_widened_allow_error(&e.to_string()) {
    rewrite_rule_to_exact_tool(&mut rule); // tool = "mcp__server__method"; drop action_kind
}

Prevention

When it happens

Trigger: An upgraded config whose allow rules use alias action_kinds like mcp_read; hand-written allow rules copied from deny/ask examples where aliases are legal.

Common situations: Post-v0.9.8 migration of auto_review.allow sections; mixing rule templates between kinds.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/e70c042ab92c6bce. Report an issue: GitHub.