Compound bash command: one flagged segment forces approval for the whole command
Type: feature-request
Environment
- Claude Code version: 2.1.220
- OS: macOS 26.5.2 (Darwin 25.5.0)
- Platform: Claude subscription
What happened
Chained bash commands are rejected wholesale when any single segment needs approval:
This Bash command contains multiple operations. The following part requires approval: <one segment>
This appears in 123 of 5 096 transcript files. In practice the flagged segment is very often read-only — a grep with several --include globs, or a head/grep pair joined with ;. The result is that batching cheap read-only steps into a single call, which is the efficient thing to do, is penalized relative to issuing them one at a time, which is what the model then does.
Expected
Either:
- Evaluate segments independently and prompt only for the segment that needs it, running the rest, or
- Prompt once for the compound command with the specific segment highlighted (approve-all / approve-segment), rather than rejecting the whole call.
At minimum, the message should say which allow rule would have covered the flagged segment, so users can fix their settings instead of guessing.
Repro
- With a settings allowlist that permits
grepandhead, run a single Bash call chaining two such commands with;. - Observe the whole command is rejected with the message above, naming one segment.
Impact
More round trips than necessary for the most common class of work (read-only exploration), and it teaches the model to avoid batching — which increases total tool calls and context use.