claudeacp passes --allow-dangerously-skip-permissions whatever the mode: find what brings Claude Code's 'use Bash' instruction #9

Merged
city-root merged 1 commit from worker/claudeacp-5st into main 2026-11-12 13:45:10 +00:00
Contributor

Answer

--allow-dangerously-skip-permissions is not the cause, so no code changes: this pull request is the README paragraph and changelog entry that record the finding.

The "do your work through Bash" instruction follows the permission mode being bypassPermissions, however the session gets there: --dangerously-skip-permissions, --permission-mode=bypassPermissions, or a switch to the mode over the control channel (what an ACP session/set_mode does).

How it was found (no model call)

claude 2.1.322, started as claudeacp starts it (--output-format stream-json --verbose --input-format stream-json --permission-prompt-tool=stdio --model=… --effort=high plus the flags below), with ANTHROPIC_BASE_URL on a listener of my own on 127.0.0.1 that wrote each request to a file and answered 400. A throwaway CLAUDE_CONFIG_DIR and an empty working folder, so no user settings or CLAUDE.md. I compared the request bodies (system, messages, and the tools' descriptions) with UUIDs normalized.

Flags Request differs from default?
none (default mode) –
--permission-mode=dontAsk no, identical
--permission-mode=dontAsk --allow-dangerously-skip-permissions (what the Operator's sessions ran) no, identical
--allow-dangerously-skip-permissions alone no, identical
--dangerously-skip-permissions yes
--permission-mode=bypassPermissions --allow-dangerously-skip-permissions yes, same as the one above

Under bypass two things differ, and nothing else:

  1. The first message gains, ahead of "Today's date is …":

    While bypass permissions mode is active:

    You can do much of your work through the Bash tool when it is the simpler route: read files with cat, head, or sed -n, search with grep and find, and make small, mechanical file changes with sed, heredocs, or short scripts instead of the dedicated Read, Edit, or Write tools. The choice is yours: prefer Edit or Write when a shell edit would be fragile, such as exact or multi-line replacements, or sed/awk flags that differ between GNU and BSD/macOS.

  2. The Bash tool's description loses its line:

    IMPORTANT: Avoid using this tool to run cat, head, tail, sed, awk, or echo commands, unless explicitly instructed or after you have verified that a dedicated tool cannot accomplish your task. Instead, use the appropriate dedicated tool as this will provide a much better experience for the user.

The system prompt itself (6039 characters) is the same in all six.

A switch over the control channel. Starting in dontAsk and sending set_permission_mode bypassPermissions after the first turn:

  • with --allow-dangerously-skip-permissions: success, and the next request carries text 1 (the Bash tool's description, fixed at start, keeps its line);
  • without it: {"subtype":"error","error":"Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions","error_code":"bypass_not_launched"}, and no instruction is sent.

Wanted item 2

The flag's purpose is the switch above: a client can pick "Bypass permissions" after the session started. Passing it only in bypass mode would stop that (the mode would be refused with bypass_not_launched) and brings nothing in return, since the flag changes no text. Left as it is.

What this means for the five sessions

Their transcripts show the mode dontAsk at session/new (currentModeId) and no mode change after, so by the table they got neither text 1 nor the removal of line 2: the instruction is not what made them 84% Bash. I did not look for what did (under dontAsk a tool not allowed by a rule is refused, which would push a model toward whatever is allowed; that is a guess, not checked). Worth its own bead if the Operator wants it chased.

Changes

README (a "Bypass permissions" paragraph under Claude's options) and CHANGELOG (Unreleased, Changed). No test: nothing in the code changes, and claudeagent's options test already pins the flag. go build ./... and go test ./... pass.

Bead: claudeacp-5st

## Answer `--allow-dangerously-skip-permissions` is **not** the cause, so no code changes: this pull request is the README paragraph and changelog entry that record the finding. The "do your work through Bash" instruction follows **the permission mode being `bypassPermissions`**, however the session gets there: `--dangerously-skip-permissions`, `--permission-mode=bypassPermissions`, or a switch to the mode over the control channel (what an ACP `session/set_mode` does). ## How it was found (no model call) claude 2.1.322, started as claudeacp starts it (`--output-format stream-json --verbose --input-format stream-json --permission-prompt-tool=stdio --model=… --effort=high` plus the flags below), with `ANTHROPIC_BASE_URL` on a listener of my own on 127.0.0.1 that wrote each request to a file and answered 400. A throwaway `CLAUDE_CONFIG_DIR` and an empty working folder, so no user settings or CLAUDE.md. I compared the request bodies (system, messages, and the tools' descriptions) with UUIDs normalized. | Flags | Request differs from default? | |---|---| | none (default mode) | – | | `--permission-mode=dontAsk` | no, identical | | `--permission-mode=dontAsk --allow-dangerously-skip-permissions` (what the Operator's sessions ran) | no, identical | | `--allow-dangerously-skip-permissions` alone | no, identical | | `--dangerously-skip-permissions` | yes | | `--permission-mode=bypassPermissions --allow-dangerously-skip-permissions` | yes, same as the one above | Under bypass two things differ, and nothing else: 1. The first message gains, ahead of "Today's date is …": > While bypass permissions mode is active: > > You can do much of your work through the Bash tool when it is the simpler route: read files with cat, head, or sed -n, search with grep and find, and make small, mechanical file changes with sed, heredocs, or short scripts instead of the dedicated Read, Edit, or Write tools. The choice is yours: prefer Edit or Write when a shell edit would be fragile, such as exact or multi-line replacements, or sed/awk flags that differ between GNU and BSD/macOS. 2. The Bash tool's description loses its line: > IMPORTANT: Avoid using this tool to run `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or after you have verified that a dedicated tool cannot accomplish your task. Instead, use the appropriate dedicated tool as this will provide a much better experience for the user. The system prompt itself (6039 characters) is the same in all six. **A switch over the control channel.** Starting in `dontAsk` and sending `set_permission_mode bypassPermissions` after the first turn: - with `--allow-dangerously-skip-permissions`: success, and the next request carries text 1 (the Bash tool's description, fixed at start, keeps its line); - without it: `{"subtype":"error","error":"Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions","error_code":"bypass_not_launched"}`, and no instruction is sent. ## Wanted item 2 The flag's purpose is the switch above: a client can pick "Bypass permissions" after the session started. Passing it only in bypass mode would stop that (the mode would be refused with `bypass_not_launched`) and brings nothing in return, since the flag changes no text. Left as it is. ## What this means for the five sessions Their transcripts show the mode `dontAsk` at `session/new` (`currentModeId`) and no mode change after, so by the table they got neither text 1 nor the removal of line 2: the instruction is not what made them 84% Bash. I did not look for what did (under `dontAsk` a tool not allowed by a rule is refused, which would push a model toward whatever is allowed; that is a guess, not checked). Worth its own bead if the Operator wants it chased. ## Changes README (a "Bypass permissions" paragraph under Claude's options) and CHANGELOG (Unreleased, Changed). No test: nothing in the code changes, and `claudeagent`'s options test already pins the flag. `go build ./...` and `go test ./...` pass. Bead: claudeacp-5st
docs: say what --allow-dangerously-skip-permissions is for, and what brings Claude's 'use Bash' text (claudeacp-5st)
All checks were successful
CI / Changelog (pull_request) Successful in 5s
CI / Lint (pull_request) Successful in 32s
CI / Test (pull_request) Successful in 38s
2bab27b523
Under bypass permissions claude tells the model to do its work through Bash and drops the Bash tool's 'avoid cat, head, sed' line. The Operator saw Bash-heavy sessions in dontAsk mode while claudeacp passed --allow-dangerously-skip-permissions, and asked which of the two brings that text.

Recorded the requests claude 2.1.322 sends to a listener on 127.0.0.1 (answering 400) in default, dontAsk, dontAsk with the flag, the flag alone, --dangerously-skip-permissions and --permission-mode=bypassPermissions: the requests of default, dontAsk, dontAsk+flag and flag-alone are identical to each other; the two bypass ones carry the text. A switch to bypass over the control channel brings the text with the flag, and is refused (bypass_not_launched) without it. So the flag is what allows the switch, and nothing else: no code changes, the README and the changelog say so.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Review of 2bab27b523 for claudeacp-5st. Checks of the head: success.

Verdict

pass

Findings

  • [minor] claudeagent/methods.go:122 (not in this diff): the doc comment of SetPermissionMode names claude's refusal code as bypass_disabled, while this pull request records claude 2.1.322 answering bypass_not_launched, and the new README paragraph names that one. Not blocking here, because the bead says to change no code when the flag is not the cause. A later change could fix the comment, or name both codes.

Verified

  • Requirement: the work bead claudeacp-5st, items 1–3. Item 1 is answered in the PR description: a table of six flag combinations, recorded against a local listener, with the two texts that differ quoted. They follow the mode bypassPermissions, not --allow-dangerously-skip-permissions. Item 2: the flag is not the cause, so the code is unchanged. The PR says what the flag is for (a later set_permission_mode bypassPermissions, refused with bypass_not_launched without it) and what passing it only in bypass mode would break. Item 3: no code change, so no test. The README paragraph sits under "Claude's options", next to the list of what claudeacp passes, and the changelog has an entry under [Unreleased] / Changed.
  • The README's claims about the code, checked at the head: claudeacp/options.go:63 sets AllowBypass when euid != 0 or IS_SANDBOX is set. claudeagent/options.go:176 turns that into --allow-dangerously-skip-permissions. claudeacp/config.go:78,161 offers the bypass mode only when it is allowed. claudeagent/options_test.go:58-59 already pins the flag, as the PR says.
  • The quoted instruction text: this review session runs in bypass mode, and its own context carries the same "While bypass permissions mode is active: You can do much of your work through the Bash tool …" text, word for word. I did not rerun the listener experiment for the other modes.
  • The merge into main (a911a08) is a fast-forward with no conflicts. On the merged tree, with the city's variables removed: go build ./..., go vet ./... and go test -race -shuffle=on ./... all pass. The changelog checker, built from mikluko/changelog at 7ec45bb (v1.6.0, the action's pin), gives valid=true, exit 0. golangci-lint and govulncheck were not run locally: the change is two Markdown files, and the head's CI passed.
  • The diff is CHANGELOG.md +1 and README.md +2: nothing else, no shell, no secrets.
Review of 2bab27b52364caae16c9d107004f1e73a8559d4a for claudeacp-5st. Checks of the head: success. ### Verdict pass ### Findings - [minor] claudeagent/methods.go:122 (not in this diff): the doc comment of `SetPermissionMode` names claude's refusal code as `bypass_disabled`, while this pull request records claude 2.1.322 answering `bypass_not_launched`, and the new README paragraph names that one. Not blocking here, because the bead says to change no code when the flag is not the cause. A later change could fix the comment, or name both codes. ### Verified - Requirement: the work bead claudeacp-5st, items 1–3. Item 1 is answered in the PR description: a table of six flag combinations, recorded against a local listener, with the two texts that differ quoted. They follow the mode `bypassPermissions`, not `--allow-dangerously-skip-permissions`. Item 2: the flag is not the cause, so the code is unchanged. The PR says what the flag is for (a later `set_permission_mode bypassPermissions`, refused with `bypass_not_launched` without it) and what passing it only in bypass mode would break. Item 3: no code change, so no test. The README paragraph sits under "Claude's options", next to the list of what claudeacp passes, and the changelog has an entry under [Unreleased] / Changed. - The README's claims about the code, checked at the head: `claudeacp/options.go:63` sets `AllowBypass` when euid != 0 or `IS_SANDBOX` is set. `claudeagent/options.go:176` turns that into `--allow-dangerously-skip-permissions`. `claudeacp/config.go:78,161` offers the bypass mode only when it is allowed. `claudeagent/options_test.go:58-59` already pins the flag, as the PR says. - The quoted instruction text: this review session runs in bypass mode, and its own context carries the same "While bypass permissions mode is active: You can do much of your work through the Bash tool …" text, word for word. I did not rerun the listener experiment for the other modes. - The merge into main (a911a08) is a fast-forward with no conflicts. On the merged tree, with the city's variables removed: `go build ./...`, `go vet ./...` and `go test -race -shuffle=on ./...` all pass. The changelog checker, built from mikluko/changelog at 7ec45bb (v1.6.0, the action's pin), gives `valid=true`, exit 0. golangci-lint and govulncheck were not run locally: the change is two Markdown files, and the head's CI passed. - The diff is CHANGELOG.md +1 and README.md +2: nothing else, no shell, no secrets.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/claudeacp!9
No description provided.