Skip to content

fix(permissions): return guidance for multi-word forms instead of falling through to LLM#2994

Merged
code-yeongyu merged 1 commit intomainfrom
fix/permissions-subcommand-fallthrough
May 4, 2026
Merged

fix(permissions): return guidance for multi-word forms instead of falling through to LLM#2994
code-yeongyu merged 1 commit intomainfrom
fix/permissions-subcommand-fallthrough

Conversation

@code-yeongyu
Copy link
Copy Markdown
Collaborator

Problem

claw permissions list, claw permissions allow bash, claw permissions deny bash etc. all fall through to the prompt/LLM path, calling the Anthropic API and returning auth errors. Only the bare single-word form claw permissions was intercepted by bare_slash_command_guidance.

Root Cause

parse_single_word_command_alias guards on rest.len() != 1 and returns None for multi-word forms, then parse_subcommand had no "permissions" arm so those forms hit _other => CliAction::Prompt.

Same root cause cluster as claw plugin list / claw marketplace fixed in #2993.

Fix

Add a "permissions" arm in parse_subcommand returning a structured guidance Err with the correct usage hint.

Verification

All 6 invocation forms tested — all exit 1 with kind:unknown guidance JSON, zero sessions created:

claw permissions              → guidance exit:1 ✅
claw permissions list         → guidance exit:1 ✅
claw permissions read-only    → guidance exit:1 ✅
claw permissions allow bash   → guidance exit:1 ✅
claw permissions deny bash    → guidance exit:1 ✅
claw permissions workspace-write → guidance exit:1 ✅

…ling through to LLM

claw permissions list / claw permissions allow <tool> / claw permissions deny <tool>
all fell through to the prompt/LLM path because parse_subcommand had no
arm for "permissions". The single-word bare form was already intercepted
by bare_slash_command_guidance, but any form with rest.len() > 1 bypassed
the single-word guard and landed in the _other => CliAction::Prompt branch.

Fix: add a "permissions" arm in parse_subcommand that returns a structured
guidance Err so all multi-word forms get the same exit:1 + JSON error as
the bare single-word form, without any LLM call or session creation.

Verified: all invocation forms (bare, list, read-only, workspace-write,
allow/deny <tool>) exit 1 with kind:unknown guidance JSON. Zero sessions.
@code-yeongyu code-yeongyu merged commit caeac82 into main May 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant