bash: a plain permission refusal is reported as "bash permission not settled after 0 rounds"
Summary
When the host denies a shell command on the first permission check, the shell tool reports bash permission not settled after 0 rounds: still asking for bash <command> …: Permission denied: shell. The wording describes a permission loop that did not finish, but no loop occurred: the host refused the first and only check. Agents read this text as "the shell is no longer available" and stop their shell work.
Observed
Three review subagents in one session each got this error between 4 and 12 times. Every message said after 0 rounds, kind bash, granted already: no, and ended with Permission denied: shell. None of them contained an external_directory check. Between the refusals, other shell calls in the same sessions ran normally (echo ok, mkdir -p <dir>, git archive HEAD | tar -x -C <dir>, pytest, ruff). Only the commands that contained a component that the role's shell rules deny were refused (for example git -C <path outside the session root> …, rm -rf <dir>, pwd). The agents reported that "shell permission lapsed mid-session" and marked their remaining checks as not run.
Cause
packages/aft-bridge/src/bash-permissions.ts, withBashPermissionLoop (:47):
:95callsoptions.approve(...). In the OpenCode plugin (packages/opencode-plugin/src/tools/bash.ts:335–339) this sends one host permission check per grouped ask, and all bash components of the command go into one check.:97wraps any error fromapprove, including a plain host refusal, inunsettled(error). That uses theBASH_PERMISSION_NOT_SETTLEDtemplate (:14): "not settled after {rounds} rounds: still asking for …", and adds one entry for each component.
So a refusal on round 0 uses the same text as the real loop exit at :93 (asks that were granted already but are asked again, or 8 rounds). The text also lists every component as "still asking", so the reader cannot tell that the host refused the command as a whole, or that one denied component is enough to refuse it.
Proposal
- Use a separate error when
approverejects, for exampleshell permission denied by the host for this command (checked as one request): <components>: <host reason>. - Keep "not settled after N rounds" only for the loop exit at
:93. - Optional: add one sentence that removing the denied component, or running it as a separate call, lets the other components run.
The control flow does not change: a refusal still stops the call at once, with no retry.
Reproduction: give a role a shell rule that denies one command pattern, for example rm *. Then run mkdir -p x && rm -rf x through the shell tool. The error says "not settled after 0 rounds … still asking for bash mkdir -p x … still asking for bash rm -rf x …: Permission denied: shell".
Thanks for the precise report. Your diagnosis is right: a refusal on the first check goes through the same path as a permission loop that gave up, so it reads as "not settled after 0 rounds". We're giving refusals their own message and keeping the loop message for real loop exits. We'll post here when it ships.
This shipped in v0.64.0: a refused shell command now says it was refused, instead of reporting an unfinished permission loop.