anthropics / anthropics/claude-code-action

[BUG] API Error 400 after v1 update (f0c8eb2) - PR review workflows fail with "tool use concurrency issues"

Đang mở
#732 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
bug p1 provider:1p
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

PR review workflows started failing with `API Error: 400 due to tool use concurrency issues` after `claude-code-action@v1` auto-updated from SHA `6337623` (Dec 2, 2025) to `f0c8eb2` (Dec 9, 2025, Claude Code 2.0.62).

## Environment

- **Action version**: `anthropics/claude-code-action@v1` (auto-resolving to `f0c8eb2`)
- **Claude Code version**: 2.0.62
- **Workflow type**: PR review with pending review creation
- **Provider**: Anthropic API (1p)
- **GitHub Runner**: ubuntu-latest

## Error Details

```json
{
"type": "result",
"subtype": "success",
"is_error": true,
"duration_ms": 10084,
"num_turns": 2,
"result": "API Error: 400 due to tool use concurrency issues.",
"error": "invalid_request"
}
```

## Configuration

```yaml
- name: Claude Code Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
show_full_output: true
claude_args: |
--max-turns 30
--model claude-sonnet-4-5-20250929
--allowedTools "mcp__github__create_pending_pull_request_review,mcp__github__get_pull_request_diff,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review"
```

## Reproduction Steps

1. Use `claude-code-action@v1` (defaults to latest f0c8eb2)
2. Configure PR review workflow with `allowedTools` parameter
3. Open or reopen a pull request to trigger the workflow
4. Observe failure after 2-3 turns with "API Error: 400 due to tool use concurrency issues"

## Expected Behavior

The workflow should complete successfully and post PR review comments, as it did with SHA `6337623`.

## Actual Behavior

- Workflow fails consistently after 2-3 turns
- Error message: "API Error: 400 due to tool use concurrency issues"
- No PR review is posted
- Tool execution appears to succeed (tool_use/tool_result pairs are properly matched)

## Analysis

### Last Working Version
- **SHA**: `6337623ebba10cf8c8214b507993f8062fd4ccfb` (Dec 2, 2025)
- **Status**: ✅ Consistently successful
- **Test runs**: Multiple PRs reviewed successfully (Dec 5-9, 2025)

### Breaking Version
- **SHA**: `f0c8eb29807907de7f5412d04afceb5e24817127` (Dec 9, 2025)
- **Changes**: Claude Code version bump 2.0.61 → 2.0.62
- **Status**: ❌ Consistently fails with 400 error

### Changes Between Versions

Between these commits, the following PRs were merged:

1. **#719**: "fix: accumulate multiple --allowedTools flags" ⚠️ **Suspected cause**
- Modified how allowedTools/disallowedTools are processed
- May have introduced regression in tool parameter handling

2. **#710**: "fix: prevent TOCTOU race condition on issue/PR body edits"
- Security fix for body content validation

3. **Other PRs**: Various minor fixes

### Suspicious Finding

Tool execution logs show:
- Tool calls are properly formed with valid IDs
- Tool results are returned successfully
- tool_use/tool_result pairs are correctly matched
- **However**, Anthropic API still returns 400 error

This suggests the issue may be in how the tool list or parameters are serialized to the API request, possibly related to #719's changes in `allowedTools` accumulation logic.

## Workaround

Pin to the last working version:

```yaml
uses: anthropics/claude-code-action@6337623ebba10cf8c8214b507993f8062fd4ccfb
```

This resolves the issue and allows PR reviews to complete successfully.

## Impact

- **Severity**: P1 - All users using `@v1` tag are affected
- **Scope**: PR review workflows fail completely
- **Workaround exists**: Yes (version pinning)

## Additional Context

- Similar error message appeared in anthropics/claude-code#8763, but that was related to actual tool concurrency
- In this case, tools are executed sequentially (only 1 tool call per turn observed)
- Error persists even with explicit sequential execution constraints in prompt

## Logs

Detailed error log (with show_full_output: true)

```
pr-review Claude Code Review {"type":"result","subtype":"success","is_error":true,"duration_ms":10084,"duration_api_ms":32359,"num_turns":2,"result":"API Error: 400 due to tool use concurrency issues.","session_id":"697908da-f203-4ce3-9758-e24f7513e039","total_cost_usd":0.21781100000000003,"usage":{"input_tokens":9,"cache_creation_input_tokens":46642,"cache_read_input_tokens":2320,"output_tokens":316}}
```

Tool execution sequence:
1. ✅ `mcp__github__get_pull_request` (toolu_015BVVwKWnHWfpKay5gbQBe2) - Success
2. ❌ Anthropic API returns 400 error

## Request

Please investigate PR #719's changes to `allowedTools` accumulation logic, as this appears to be the most likely cause of the regression.

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.