Skip to content

Fix Claude Code permissions.ask rules being ignored in full access - #4764

Merged
ymichael merged 2 commits into
get-bb:mainfrom
stefanroex:claude-code-permissions-ask-full-access
Oct 15, 2026
Merged

ymichael merged 2 commits into
get-bb:mainfrom
stefanroex:claude-code-permissions-ask-full-access

Conversation

@stefanroex

Copy link
Copy Markdown
Contributor

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, 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

Commands marked "always ask" in Claude Code's settings
(`permissions.ask`) still ran without a prompt in full access
threads. In this mode Claude Code only asks bb about requests the
user configured to be asked about, such as ask rules and PreToolUse
hooks answering "ask", but bb approved all of them itself. Claude
Code alone does prompt for these in its equivalent mode.

bb now shows these requests in full access threads too. Everything
else in full access is unchanged, because Claude Code doesn't ask
about it. When running as root, bb keeps approving requests itself:
Claude Code refuses bypassPermissions for root, so bb runs those
sessions in "default" mode and stands in for bypass.
@stefanroex
stefanroex force-pushed the claude-code-permissions-ask-full-access branch from 981a8ce to cfae65f Compare October 7, 2026 08:15
The new full access permission tests faked the user id with
process.getuid, which doesn't exist on Windows, so they crashed in
the Windows CI job. The ask-rule test now only fakes the user id
where it exists, and the root test is skipped on Windows because
Windows has no root user, matching the existing SdkSession tests.
@ymichael
ymichael merged commit 7ac31b1 into get-bb:main Oct 15, 2026
22 checks passed
ymichael added a commit that referenced this pull request Oct 24, 2026
## Human comments

## What was wrong

Since #4764 (0.47), the Claude Code bridge forwards every `canUseTool`
request in Full Access to the user, so that `permissions.ask` rules
prompt. That PR assumed Claude Code asks only about ask rules and
PreToolUse hooks that answer "ask" in `bypassPermissions`. It also asks
on some of its own built-in safety checks. On CLI 2.1.309, `W=/tmp/x;
for d in a b; do echo $d; done; rm -f $W/*.log` reaches `canUseTool`
with "Dangerous rm operation on possibly-empty variable path…", although
the same `rm` alone does not. Full Access threads and automations now
stop for approval on these. A user reported this on Discord ("A variable
in this command can't be checked before it runs", "This command changes
directory before running a version-control command…"), and it hit one of
our own Full Access threads too.

bb can't approve only the safety checks while keeping ask-rule prompts.
The SDK drops the control request's `decision_reason_type` before
calling `canUseTool`, so a plain ask rule, a hook "ask", and a safety
check differ only in free-form `decisionReason` text.

## What changed

- New Claude Code provider setting **Approvals in Full Access**
(`fullAccessApprovalsEnabled`), off by default.
- Off: Full Access approves every request Claude Code sends, as before
0.47.
- On: keeps #4764's behaviour and shows ask rules, hook "ask" answers,
and safety checks.
- Running as root: Full Access still always approves, since Claude Code
refuses `bypassPermissions` there.
- The value travels in `providerOptions` like `sandboxEnabled` and sits
with the bridge's live session settings, so a change applies from the
next turn without restarting Claude. `HOST_DAEMON_PROTOCOL_VERSION` is
unchanged.
- Docs: `docs/configuration.md`, the providers guide, and the
claude-code-provider skill.

## How you verified

- `pnpm exec turbo run typecheck test lint
--filter=bb-plugin-provider-claude-code`: 406 tests pass. `pnpm exec
turbo run test --filter=@bb/server --
test/threads/thread-runtime-config.test.ts`: 33 pass.
- New bridge test: in Full Access a safety-check request is approved
without a prompt by default, and is forwarded after a turn turns the
setting on. It fails without the bridge change.
- Reproduced the cause against the Agent SDK directly with bb's launch
options (CLI 2.1.309, streaming input, `bypassPermissions`). The
compound `rm` command reached `canUseTool`, and the simpler variants did
not.
- Manually QA'd in a source dev app, with a real Full Access Claude Code
thread running the command above:
  1. Setting off: the command ran with no prompt.
2. Setting turned on with the CLI: the next turn showed the "Dangerous
rm…" approval card, and Deny worked.
3. Setting toggled off in Settings → Plugins → Claude Code provider
(still off after a reload): the command ran with no prompt again.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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