anthropics / anthropics/claude-code-action

SDK execution error in Agent SDK 0.2.27+ causes crash before API calls

未关闭
#892 24 条评论 29 个 reaction 已指派 0 人 在 GitHub 查看
area:installation bug p1 provider:1p
主要语言
TypeScript
星标
8.9k
派生
2.1k
平均合并
3 天 9 小时
30 天内合并 PR
10

描述

## Description

After the Agent SDK was bumped to 0.2.27 (commit `0ed5eea` on Jan 30, 2025), the claude-code-action crashes with an SDK execution error before any API calls are made.

## Environment

- **Action version:** `@v1` (currently points to Agent SDK 0.2.27+)
- **Last working version:** SHA `01e756b` (Agent SDK 0.2.25)
- **Runner:** `ubuntu-latest`
- **Workflow trigger:** `pull_request`

## Error Output

```
{
"type": "result",
"subtype": "success",
"is_error": true,
"duration_ms": 372,
"num_turns": 1,
"total_cost_usd": 0,
"permission_denials": []
}
SDK execution error: 14 | depsCount: ${Q},
15 | deps: ${$}}`};var Pj={keyword:"dependencies",type:"object",schemaType:"object",error:EB.error,code(X){...
...
error: Claude Code process exited with code 1
at $ (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:19:7668)
at emit (node:events:98:22)
at #handleOnExit (node:child_process:520:14)
```

## Key Observations

1. **`total_cost_usd: 0`** - No API calls are made before the crash
2. **`is_error: true`** with `subtype: "success"` - Contradictory status
3. **Error appears to be in JSON schema validation** (ajv library) based on the minified code referencing `dependencies`, `schemaType`, etc.
4. **Crash happens during SDK initialization**, not during API communication

## Reproduction

The issue occurs with a minimal workflow configuration:

```yaml
- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
model: claude-opus-4-5-20251101
prompt: "Review this PR"
```

We also tested:
- ❌ Removing `allowed_tools` - still crashes
- ❌ Using `model` input instead of `claude_args` - still crashes
- ✅ Pinning to SHA `01e756b` (SDK 0.2.25) - works correctly

## Workaround

Pin to the last working SHA:

```yaml
uses: anthropics/claude-code-action@01e756b34ef7a1447e9508f674143b07d20c2631
```

## Timeline

| Commit | Date | SDK Version | Status |
|--------|------|-------------|--------|
| `01e756b` | Jan 29 | 0.2.25 | ✅ Working |
| `0ed5eea` | Jan 30 | 0.2.27 | ❌ Broken |
| `70e16de` | Jan 31 | 0.2.29 | ❌ Broken |
| `4ce5f17` | Feb 1 | Latest | ❌ Broken |

## Expected Behavior

The action should successfully initialize and make API calls to perform code review.

## Actual Behavior

The action crashes with an SDK execution error during initialization, before any API calls are made.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。