anthropics / anthropics/claude-agent-sdk-typescript

using abortController to cancel running session immediately after init message causes the next resume to fail

Aperta
#69 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Shell
Stelle
1.8k
Fork
226
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I found out that if you use `abortController` to cancel a running session immediately after seeing the init message from agent, with the `session_id` from the init message:

```
"type":"system","subtype":"init","cwd":"/data/src","session_id":"f5802da8-0bd0-4da5-8e6e-0396e7cd89f5","tools":...
```

then the subsequent resume with the same `session_id` would immediately exit with an error:

```
Error: Claude Code process exited with code 1
2025-11-19 15:27:13.847 at ProcessTransport.getProcessExitError (file:///agent/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:6564:14)
2025-11-19 15:27:13.847 at ChildProcess.exitHandler (file:///agent/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:6701:28)
2025-11-19 15:27:13.847 at Object.onceWrapper (node:events:639:26)
2025-11-19 15:27:13.847 at ChildProcess.emit (node:events:536:35)
2025-11-19 15:27:13.847 at ChildProcess._handle.onexit (node:internal/child_process:293:12)
```

## Steps to reproduce (`0.1.30`):

- Start a new session with `abortController` and `"forkSession": true`
- Immediately abort the session after getting `session_id` from init message
- Resume the session
- Observe `Error: Claude Code process exited with code 1`

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.