-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
[Bug]: CLI backend (claude-cli) loopback MCP bridge NATIVE_TOOL_EXCLUDE contaminates session tool policy — affects subagent spawn, tool inheritance, and policy introspection #89242
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the bug
When a session runs on a claude-cli backend, the loopback MCP bridge excludes native tools (
read,write,edit,apply_patch,exec,process) viaNATIVE_TOOL_EXCLUDEto avoid duplicating tools the harness provides natively. However, these exclusions are merged into the session'sexplicitDenylistinresolveGatewayScopedTools()alongside real policy denies, making them indistinguishable.This has cascading effects beyond the ACP spawn issue (filed separately):
inheritedToolDenylistpropagates dedup exclusions to all child sessions (subagent and ACP)resolveToolProfilePolicy) reports false denies for CLI-backend sessionsexplicitDenylistorinheritedToolDenylistwill be affectedThe design gap
There are two semantically different reasons to exclude a tool from a session's tool set:
NATIVE_TOOL_EXCLUDE)Currently both flow through the same
{ deny: [...] }policy object and end up in the sameexplicitDenylistarray. Thetool-resolution.tsresolver has no way to tell them apart.Affected code path
Suggested approach
Separate the two exclusion types at the
resolveGatewayScopedToolslevel:excludeToolNamesshould filter the current session's tool array only (as it does now)excludeToolNamesshould not contribute toexplicitDenylistorinheritedToolDenylistscopeorreasonfield on deny entries so downstream consumers can distinguish policy from dedupImpact
claude-clibackend as their primary model cannot spawn ACP sessions from chat (the most natural workflow)Environment
tool-resolution.ts,mcp-http.runtime.ts,inherited-tool-deny.ts