anthropics / anthropics/claude-code-action

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

Abierto
#902 0 comentarios 2 reacciones 0 asignados Ver en GitHub
area:installation bug p1 provider:1p
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Merge medio
3 d 9 h
PR fusionados (30 d)
10

Descripción

## 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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.