Skip to content

Claude Code provider: "Disable provider subagents" denies the Agent call but still sends the tool and agent list (~2.6k tokens per thread) #3959

Description

@luketraas

Summary

With the Claude Code provider setting "Disable provider subagents" switched on, every new Claude Code thread still receives the full Agent and ListAgents tool definitions plus the list of agent types. The setting's own description says it hides the tool ("Hide Claude Code's native Task tool so agents use bb for delegation"), but it only refuses the call after the model has tried it. I expected the tool text to be absent from the thread, so the model is not offered a tool it cannot use and the thread does not carry about 2,600 tokens of dead context. Sister report for Codex: #2706.

Versions and environment

  • bb 0.43.3, desktop app
  • macOS 26.5.2 (25F84)
  • Provider: Claude Code (built-in provider-claude-code), Claude Code CLI 2.1.278, bundled Agent SDK 0.3.245
  • Models: reproduced on claude-opus-5; the same tools are present in claude-fable-5-1 threads
  • Provider settings: subagentsDisabled = true, workflowsDisabled = false, chromeEnabled = true, memoryEnabled = false
  • Nothing unusual: local machine, thread in a project checkout environment

Steps to reproduce

  1. bb plugin config provider-claude-code set subagentsDisabled true
  2. Confirm: bb plugin config provider-claude-code prints subagentsDisabled = true (boolean) with the description "Hide Claude Code's native Task tool so agents use bb for delegation."
  3. Start a new Claude Code thread (here: claude-opus-5, permission mode auto) with this prompt:
1. Print the exact names of every tool you were given up-front (not deferred ones), one per line.
2. Print the names of the agent types listed to you, one per line.
3. Call the Agent tool once with subagent_type "general-purpose", description "probe", prompt "Reply OK". Then quote the exact result or error text verbatim.
  1. The reply lists Agent and ListAgents among the up-front tools and 9 agent types, and the Agent call is refused by a hook.

Not tried: toggling the setting off and on again, or a resumed thread.

Expected vs actual

Actual — reply of the probe thread, verbatim:


Up-front tools:
Agent
AskUserQuestion
Bash
Edit
ListAgents
Read
Skill
ToolSearch
Write

Agent types:
claude
codex:codex-rescue
Explore
feature-dev:code-architect
feature-dev:code-explorer
feature-dev:code-reviewer
general-purpose
Plan
statusline-setup

Result of the Agent call, verbatim:
<error>PreToolUse:Agent hook error: bb has disabled Claude Code native subagents; use bb delegation instead.</error>


Expected: with "Disable provider subagents" on, `Agent`, `ListAgents` and the agent-type list are not sent to the model at all, as the setting's description ("Hide … Task tool") says. Same expectation for "Disable Workflow tool" (not tested here).

Evidence

  • Probe thread thr_7z2igtxtp8 (archived), parent thr_68ufcgwe8z, project proj_i8pc24h5c3, environment env_rye8dhknar.
  • Where it happens, read from the shipped bundle builtin-plugins/provider-claude-code/dist/ in bb 0.43.3 (no repo permalink — read from the installed app, not from source):
    • server.js deriveProviderOptions: providerSubagentsEnabled: context.settings.subagentsDisabled !== true
    • host.js: the place I found that acts on it is a PreToolUse hook — if (!threadSession.attachment.liveSettings.providerSubagentsEnabled && CLAUDE_PROVIDER_SUBAGENT_TOOL_NAMES.has(input.tool_name))permissionDecision: "deny" with the reason quoted above. CLAUDE_PROVIDER_SUBAGENT_TOOL_NAMES = new Set(["Agent", "Task"]).
    • The session params already accept and forward a disallowedTools array to the Agent SDK (...params.disallowedTools && params.disallowedTools.length > 0 ? { disallowedTools: [...] } : {}), but the setting does not appear to add the sub-agent tools to it.
  • Cost, how measured: first-request usage (input + cache write + cache read) of headless claude -p sessions, Claude Code 2.1.278, claude-opus-5. With Agent, ListAgents, ReportFindings and the claude.ai connector tools removed, the first request went from 22,113 to 16,418 tokens; the share of Agent + ListAgents + the agent-type list is about 2,600–2,950 tokens, split estimated from text lengths. For scale: a new Claude Code thread here starts at about 52,000 tokens.

What you ruled out

  • Not a stale setting: bb plugin config provider-claude-code shows subagentsDisabled = true, and the deny hook fires, so the thread does see the setting.
  • Not a Claude Code plugin adding the tool: Agent and ListAgents are Claude Code built-ins; only 4 of the 9 agent types come from plugins (feature-dev, codex).
  • Not fixable on the user side without collateral damage: the bare-name deny Agent in ~/.claude/settings.json does remove the tool text, but that file is shared with Claude Code outside bb, where native sub-agents are in daily use.
  • Not the same as Disabled Codex subagents remain advertised, causing deterministic spawn failures #2706: that one is the Codex provider; this is the Claude Code provider, and here the call is cleanly refused — the cost is context, not spawn failures.

Suggested priority and effort (optional)

Every Claude Code thread of every user with this setting on: about 2,600–2,950 tokens per new thread plus a tool that is offered and then refused; no data or work lost; no safe workaround. Suggested fix (small): when the setting is on, add Agent, Task and ListAgents to the disallowedTools the provider already forwards, keep the deny hook as backstop; same for Workflow. Low priority, low effort. > AGENT GENERATED

Checks

  • I reproduced this on the latest release or on main, or I say above that I could not.
  • I searched open and closed issues for the same problem.
  • If an agent wrote this, the body ends with > AGENT GENERATED and links the thread or report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions