Skip to content

[Bug]: Full access stops on Claude Code 2.1.327's reworded dangerous-removal check #38572

Closed

Description

@ctrlShiftBryan

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server (Claude adapter, Full access)

Steps to reproduce

  1. Use Claude Code 2.1.327 and start a Claude thread in Full access.

  2. Have the agent run a Bash command that Claude Code cannot parse reliably. For example, a bash -c '…' whose body has a heredoc that contains ''', which ends the outer single quote early.

  3. Claude Code raises its dangerous-removal safety check with the reason:

    Claude Code can't be sure it read this command the way the shell will, so it can't rule out a dangerous removal. Read the command, and don't go ahead if you can't tell what it does.

Expected behavior

As docs/user/permission-modes.md says: "Dangerous-removal safety checks in bypass mode reject the command with Claude's warning", and the agent continues without the removal. T3 does this today for the other removal-check reasons.

Actual behavior

T3 shows a normal approval card, and the turn waits for a person.

The bypass-mode reject in ClaudeAdapterV2.ts (canUseToolEffect, line 12373 on main at 3088d26665) finds removal checks by their reason text:

  • /^Dangerous rm(?:dir)?\b/i
  • "This shell -c script runs rm and could not be checked"
  • "A permission rule denies a command in this shell -c script"

In Claude Code 2.1.327 the unparsed_line removal check has two wordings. One branch still says "Dangerous rm operation not ruled out — the shell may read this command differently than it was parsed", which matches. The other says "Claude Code can't be sure it read this command the way the shell will, so it can't rule out a dangerous removal…", which matches none of the three patterns.

From the 2.1.327 binary, the CLI has exactly three removal-check reasons, each tagged circuitBreaker:"dangerousRemoval". This is the only one T3 misses.

Text matching is still the only option. The CLI sends decision_reason_type and decision_reason_code, but not circuitBreaker. For removals the code is empty and the type is a generic safetyCheck. SDK 0.3.276, the version T3 pins, also drops both fields; SDK 0.3.327 passes them through. So nothing structured identifies a removal check.

Impact

An unattended Full access run stops until someone answers. In my case a coordinator thread working overnight launched a foreground subagent. The subagent hit this at 05:53:04 UTC and sat on the approval until 10:59:27 UTC, about 5 hours. The coordinator was blocked the whole time.

It also matters for open PR #32317 ("let Full access approve Claude Code's own safety checks"). Its auto-approve step runs after this reject, and it relies on the reject to keep removal checks blocked. With that setting on, this reason would get past the reject and be approved automatically.

Version or commit

T3 Code 0.1.7 (server t3 serve, macOS arm64). Claude Code 2.1.327. @anthropic-ai/claude-agent-sdk 0.3.276. Same code on main at 3088d26665.

Environment

macOS arm64. A Claude thread in Full access (permissionMode: "bypassPermissions", allowDangerouslySkipPermissions: true), with no ask rules matched.

Logs or stack traces

Stored runtime request: kind: "command", createdAt: 2026-11-18T05:53:04.494Z, resolvedAt: 2026-11-18T10:59:27.602Z, decision: "accept". The approval card's reason is the text quoted above. In the subagent transcript, the tool result has permission_decision: {"decision":"accept","source":"user_temporary"}.

Suggested fix

Also match the new wording. Adding a row to the existing table in ClaudeAdapterV2.test.ts (the "resolves and cancels the SDK resume dialog through structured runtime input" case) fails on main with expected 'approval' to equal 'decision'. It passes with:

-            (/^Dangerous rm(?:dir)?\b/i.test(safetyReason) ||
+            (/^Dangerous rm(?:dir)?\b|\bdangerous removal\b/i.test(safetyReason) ||
{
  askRule: false,
  reason:
    "Claude Code can't be sure it read this command the way the shell will, so it can't rule out a dangerous removal. Read the command, and don't go ahead if you can't tell what it does.",
},

All 288 tests in the file pass with the change. Matching dangerous removal anywhere in the reason, not as a prefix, should also catch the next small rewording. The change is small enough to apply directly, so I'm not opening a PR.

Workaround

None in T3. Watching threads and answering by hand works, but that defeats Full access for unattended runs. Agents can avoid the trigger by writing multi-line scripts to a file instead of nesting heredocs in bash -c '…'.

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