claude-code - 💡(How to fix) Fix Bash permission walker reports "Unhandled node type: ;" and forces prompt on subshell-form commands [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55170Fetched 2026-05-01 05:44:26
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×5

Claude Code's Bash permission evaluator walks the tree-sitter-bash AST of each command to match it against the allow-list. The walker is missing a handler for the ; node type emitted between statements inside a subshell body, so any command of the form (cmd1; cmd2) produces Unhandled node type: ; and is forced to a manual approval prompt even when both inner commands would otherwise be auto-allowed.

Root Cause

The two-call form (cd <path> in one Bash call, then bare commands in subsequent calls) relies on CWD persisting across tool calls. That works in the main agent but not in subagents — each subagent Bash call resets to the agent's CWD. The documented alternative for subagents is the subshell form (cd <abs-path>; <command>), which avoids the CVE-2025-59536 harness gate on cd <path> && <cmd>. With ; unhandled by the walker, the subshell form also forces a prompt, leaving subagents with no auto-approvable form for "run X inside this directory."

Code Example

(cd /tmp; ls)
RAW_BUFFERClick to expand / collapse

Summary

Claude Code's Bash permission evaluator walks the tree-sitter-bash AST of each command to match it against the allow-list. The walker is missing a handler for the ; node type emitted between statements inside a subshell body, so any command of the form (cmd1; cmd2) produces Unhandled node type: ; and is forced to a manual approval prompt even when both inner commands would otherwise be auto-allowed.

Minimal reproduction

With Bash(cd:*) and Bash(ls:*) (or equivalent) on the allow-list:

(cd /tmp; ls)

Result: Unhandled node type: ; is shown to the user and an approval prompt appears, despite both cd /tmp and ls being individually allow-listed.

Why this matters

The two-call form (cd <path> in one Bash call, then bare commands in subsequent calls) relies on CWD persisting across tool calls. That works in the main agent but not in subagents — each subagent Bash call resets to the agent's CWD. The documented alternative for subagents is the subshell form (cd <abs-path>; <command>), which avoids the CVE-2025-59536 harness gate on cd <path> && <cmd>. With ; unhandled by the walker, the subshell form also forces a prompt, leaving subagents with no auto-approvable form for "run X inside this directory."

Related walker bugs

Same family — walker missing handlers for specific tree-sitter-bash node types, diagnostic leaking to user output:

  • #47701 — `file_redirect` (`>`, `>>`, `2>&1`, heredocs)
  • #47706 — the diagnostic leaking to user output at all
  • #42085 — `string` (for `$(...)` and backticks; regression in 2.1.89)
  • #49483 — trailing `$`
  • #50144 — `string` from MCP results

Suggested fix

Add a handler for the `;` node type in the walker (treat as a statement separator, recurse into both children). Same shape as the fix that would unblock `&&` / `||` / `|` inside subshells if they have the same gap.

Environment

  • Claude Code (CLI), macOS (Darwin 25.4.0)
  • Shell: zsh 5.9

extent analysis

TL;DR

Add a handler for the ; node type in the walker to treat it as a statement separator and recurse into both children.

Guidance

  • Identify the walker code responsible for handling tree-sitter-bash AST nodes and locate the section where node type handlers are defined.
  • Add a new handler for the ; node type, following the same pattern as existing handlers for other node types.
  • Verify that the new handler correctly recurses into both children of the ; node, allowing the walker to properly evaluate commands separated by semicolons.
  • Test the updated walker with the provided minimal reproduction example to ensure that it no longer produces an "Unhandled node type: ;" error.

Example

# Pseudocode example of the new handler
handle_node(node) {
  if node.type == ';':
    # Recurse into both children
    handle_node(node.left)
    handle_node(node.right)

Notes

The suggested fix assumes that the walker's architecture allows for easy extension with new node type handlers. If the walker's codebase is complex or difficult to modify, additional guidance may be necessary.

Recommendation

Apply the suggested fix by adding a handler for the ; node type, as it directly addresses the reported issue and allows for proper evaluation of commands separated by semicolons.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Bash permission walker reports "Unhandled node type: ;" and forces prompt on subshell-form commands [1 participants]