anthropics / anthropics/claude-code-action

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

Ouverte
#892 24 commentaires 29 réactions 0 personnes assignées Voir sur GitHub
area:installation bug p1 provider:1p
Langage dominant
TypeScript
Étoiles
8.9k
Forks
2.1k
Merge moyen
3 j 9 h
PR mergées (30 j)
10

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.