anthropics / anthropics/claude-code-action

SDK AJV crash after successful multi-turn execution with --agent flag

Đang mở
#902 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
area:installation 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ả

## Description

When using `--agent` flag to load a custom agent definition, the SDK crashes with an AJV validation error **after** successfully completing multiple turns and spending API credits. This is different from issues #852/#892 which crash on initialization.

## Environment

- **Action version:** Tested both `@v1` (SHA:6867bb3ab0b2c0a10629b6823e457347e74ad6d2) and pinned `@01e756b` (SDK 0.2.25)
- **Agent SDK versions:** Both 0.2.31 and 0.2.25 exhibit the issue
- **Custom agent:** Using `--agent pr-review` with a custom `.claude/agents/pr-review.md` definition

## Key Observations

- **Work completes successfully:** 4 turns, $0.27 cost, 17 seconds
- **Crash happens post-execution:** After the result JSON is emitted
- **Comments are partially posted:** The review work succeeds before the crash

## Error Output

```json
{
"type": "result",
"subtype": "success",
"is_error": true,
"duration_ms": 16752,
"num_turns": 4,
"total_cost_usd": 0.27037100000000003,
"permission_denials": []
}
SDK execution error: 14 | depsCount: ${Q},
15 | deps: ${$}}`};var Pj={keyword:"dependencies"...

error: Claude Code process exited with code 1
```

## Workflow Configuration

```yaml
- name: Run PR Review
uses: anthropics/claude-code-action@01e756b34ef7a1447e9508f674143b07d20c2631
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: |
--agent pr-review
--allowedTools "Task,Read,Grep,Glob,mcp__github_inline_comment__create_inline_comment,Bash(git diff:*),Bash(git log:*),Bash(gh pr comment:*),Bash(gh api:*)"
prompt: Review PR #${{ github.event.pull_request.number }}.
```

## Difference from #852/#892

| Issue #852/#892 | This Issue |
|-----------------|------------|
| Crashes on turn 1, $0 cost | Crashes after 4+ turns, $0.27 spent |
| SDK initialization failure | Post-execution validation failure |
| No API calls made | Work completes successfully |
| Pinning to SDK 0.2.25 fixes it | Pinning does NOT fix it |

## Hypothesis

The crash appears to happen during output serialization/validation when the agent response contains certain structures. The custom agent may produce output that triggers a bug in AJV's schema validation when the SDK tries to process the result.

## Workaround Attempts

- ❌ Pinned to SDK 0.2.25 (`@01e756b`) - same crash
- ❌ Different allowedTools combinations - same crash

## Repository

https://github.com/inkeep/agents (private, can provide access if needed)

Failed runs: https://github.com/inkeep/agents/actions/runs/21688290864

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.