Skip to content

Fix Claude Code commands matching permissions.ask running without a prompt - #4630

Merged
SawyerHood merged 3 commits into
get-bb:mainfrom
stefanroex:claude-code-permissions-ask
Oct 2, 2026
Merged

SawyerHood merged 3 commits into
get-bb:mainfrom
stefanroex:claude-code-permissions-ask

Conversation

@stefanroex

@stefanroex stefanroex commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

I'm improving how the Claude Code provider follows Claude Code's own permission settings and patterns. Related PRs: #4628, #4629. Each PR stands on its own and can be merged in any order. One more PR is pending: honouring permissions.ask from settings.json in full access mode, which depends on these initial PRs.

What was wrong

Add "ask": ["Bash(*askprobe*)"] to a project's .claude/settings.json and ask Claude to run echo askprobe: it runs without a prompt.

Claude Code does ask bb about it, but the request carries no details: no folder, reason or suggested rule. bb treated requests without details as harmless and approved them itself.

What changed

bb now shows every approval request from Claude Code to the user. Other requests always carry details (checked with the Claude Agent SDK across modes, sandbox on and off), so nothing else starts prompting. Threads set to never ask now deny these commands. Full access will follow in a separate PR.

The first commit makes sure this holds: an earlier "Allow for session" for a folder also approved any later request without details, because nothing requested counted as covered. Session approvals now only cover requests that ask for a folder or network access.

How you verified

  • pnpm exec turbo run typecheck test --filter=bb-plugin-provider-claude-code passes all 350 tests.
  • New tests for both changes. Each fails without its fix.
  • Manually QA'd the steps above: echo askprobe prompted, also after an earlier "Allow for session", and Deny was reported back to Claude.

AGENT GENERATED

@stefanroex stefanroex changed the title Ask before Claude Code commands matching permissions.ask Fix Claude Code commands matching permissions.ask running without a prompt Oct 1, 2026
An approval request that names no folder or network access matched
any earlier "allow for session" for the same tool. Approving one
folder could therefore silently approve an unrelated request later,
such as an auto-mode escalation for `curl ... | sh`.

A session grant now only covers requests that ask for a specific
folder or network permission. Anything else is shown to the user.
bb never offers "allow for session" on such requests, so this only
removes accidental matches.
Commands marked "always ask" in Claude Code's settings
(`permissions.ask`, for example `git push`) ran in bb without a
prompt. Claude Code sends these approval requests without a blocked
path, reason or suggested rule, and bb approved any request without
those details on the user's behalf.

bb now shows every approval request Claude Code sends. With current
Claude Code, only requests the user configured to ask arrive without
those details, so nothing else starts prompting. Threads set to never
ask now deny these commands instead of running them. Full access
threads still approve them, as before.
@stefanroex
stefanroex force-pushed the claude-code-permissions-ask branch from 629b2e8 to e79be69 Compare October 1, 2026 18:03
SawyerHood pushed a commit that referenced this pull request Oct 2, 2026
## Human comments

I'm improving how the Claude Code provider follows Claude Code's own
permission settings and patterns. Related PRs: #4628, #4630. Each PR
stands on its own and can be merged in any order. One more PR is
pending: honouring `permissions.ask` from `settings.json` in full access
mode, which depends on these initial PRs.

## What was wrong

In Accept Edits, run `npm --version` and choose "Allow for session".
After that, every Bash command ran without asking, such as `python3 -c
'print(42)'`. bb ignored the rule Claude Code suggests (`Bash(npm
--version)`) and allowed the whole Bash tool instead. This shows most
with the Claude Code sandbox off or unavailable; with it on, few
commands ask in the first place.

## What changed

"Allow for session" now sends back Claude Code's suggested rule, plus
any folders the command needed. It covers that command only, like Claude
Code's own "don't ask again". bb no longer remembers Bash approvals
itself and no longer labels Bash prompts as "Network access". The first
commit is a refactoring without behavior change.

## How you verified

- `pnpm exec turbo run typecheck test
--filter=bb-plugin-provider-claude-code` passes all 352 tests.
- New tests: only the suggested rule is sent back, and a different
command still prompts. The second check fails without the fix.
- Manually QA'd the steps above with the sandbox off: `npm --version`
ran again without a prompt, and `python3 -c 'print(42)'` prompted.

> AGENT GENERATED
# Conflicts:
#	plugins/provider-claude-code/src/bridge/__tests__/bridge.test.ts
#	plugins/provider-claude-code/src/bridge/bridge.ts
@SawyerHood
SawyerHood merged commit 96c40f0 into get-bb:main Oct 2, 2026
25 checks passed
SawyerHood added a commit that referenced this pull request Oct 2, 2026
## Human comments

I'm improving how the Claude Code provider follows Claude Code's own
permission settings and patterns. Related PRs: #4629, #4630. Each PR
stands on its own and can be merged in any order. One more PR is
pending: honouring `permissions.ask` from `settings.json` in full access
mode, which depends on these initial PRs.

## What was wrong

In a Full Access thread that starts in plan mode, approving the plan
didn't bring Claude Code back to full access. The session wasn't
launched with `allowDangerouslySkipPermissions`, so the switch to
`bypassPermissions` failed and Claude Code stayed in `default` mode.

Nobody notices yet: in `default` mode Claude Code asks about each
command, but bb approves every full access request itself (which also
means `permissions.ask` is ignored). It matters for the upcoming PR that
follows #4630 and respects ask rules in full access too.

## What changed

Full access sessions are now always launched with
`allowDangerouslySkipPermissions`, also when they start in plan mode.
Root is unchanged, because Claude Code refuses the flag there.

## How you verified

- `pnpm exec turbo run typecheck test
--filter=bb-plugin-provider-claude-code` passes all 350 tests.
- New test: a full access session that starts in plan mode gets the
flag. It fails without the fix.
- Manually QA'd, together with the follow-up that lets Claude Code's
prompts through in full access: after approving a plan in a Full Access
thread, commands ran without approval prompts.

> AGENT GENERATED

Co-authored-by: SawyerHood <[email protected]>
ymichael pushed a commit that referenced this pull request Oct 15, 2026
…4764)

## Human comments

I'm improving how the Claude Code provider follows Claude Code's own
permission settings and patterns. This is the last PR in the series and
builds on #4628 and #4630, which are merged. Related: #4629.

## What was wrong

In a Full Access thread, add `"ask": ["Bash(*askprobe*)"]` to the
project's `.claude/settings.json` and ask Claude to run `echo askprobe`:
it runs without a prompt. Claude Code does ask in its own full access
mode (`bypassPermissions`), as
[documented](https://code.claude.com/docs/en/permission-modes#actions-no-mode-auto-approves),
but bb approved every full access request itself.

## What changed

bb now shows these requests in full access threads too. Nothing else
starts prompting: in `bypassPermissions` Claude Code only asks about ask
rules and PreToolUse hooks that answer "ask". As root, bb keeps
approving requests itself, because Claude Code refuses
`bypassPermissions` there and bb runs those sessions in `default` mode.

Worth noting: an unattended full access thread, such as an automation,
now waits at such a command until someone answers.

## How you verified

- `pnpm exec turbo run typecheck test
--filter=bb-plugin-provider-claude-code` passes all 368 tests.
- New tests: an ask-rule request in a full access thread reaches the
user, which fails without the fix; as root, requests are still approved
without a prompt.
- Manually QA'd in a local dev app: in a Full Access thread that started
in plan mode, after approving the plan, `echo askprobe` prompted and `ls
-la` ran without a prompt.

> AGENT GENERATED
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.

2 participants