anthropics / anthropics/claude-code-action

Tag mode filters custom Bash tools from claude_args - intentional?

Đang mở
#724 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
bug p2 question
Ngôn ngữ chính
TypeScript
Star
8.9k
Fork
2.1k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

## Summary

When using `tag` mode (auto-detected for `pull_request` events), custom Bash tools specified in `claude_args` are silently filtered out. Only MCP tools prefixed with `mcp__github_` are merged with the default tool set.

## Expected Behavior

Custom tools specified via `claude_args: --allowedTools "Bash(npx markdownlint:*)"` should be available to Claude during PR reviews.

## Actual Behavior

The tools are parsed but filtered out in tag mode:

```javascript
// From src/modes/tag/index.ts
userAllowedMCPTools = parseAllowedTools(userClaudeArgs)
.filter((tool) => tool.startsWith("mcp__github_"))
```

This means `Bash(npx markdownlint:*)`, `Bash(gh pr:*)`, etc. are ignored.

## Reproduction

```yaml
# .github/workflows/claude-pr-review.yml
on:
pull_request:
types: [opened, synchronize, ready_for_review]

jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"

- uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
Run `npx markdownlint *.md` to check markdown files.
claude_args: |
--allowedTools "Bash(npx markdownlint:*),Read,Glob"
```

**Result**: Claude reports it cannot run markdownlint due to missing permissions.

**Workaround**: Use `mode: agent` which accepts all user-provided tools.

## Questions

1. **Is this filtering intentional?** If so, what's the security/design rationale?
2. **Should tag mode support custom Bash tools?** The use case of running linters during PR review seems common.
3. **Can documentation be updated?** Either to explain the limitation or to show the `mode: agent` workaround.

## Environment

- claude-code-action version: v1.0.22
- Trigger: `pull_request` (auto-detects to `tag` mode)

## Relevant Logs

```
Auto-detected mode: tag for event: pull_request
ALLOWED_TOOLS: Edit,MultiEdit,Glob,Grep,LS,Read,Write,mcp__github_comment__update_claude_comment,Bash(git add:*),Bash(git commit:*),Bash(git push:*),Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git rm:*)
```

Note: `Bash(npx markdownlint:*)` from `claude_args` is not present in `ALLOWED_TOOLS`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.