anthropics / anthropics/claude-agent-sdk-typescript
Process exits if session isn't found – session management broken in ephemeral environments
- 主要言語
- Shell
- スター
- 1.8k
- フォーク
- 226
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
We're in the process of moving to Claude Code SDK for our agent, however, we're running into an issue where we can't trust using Claude Code's [session management](https://docs.claude.com/en/api/agent-sdk/sessions) breaks in ephemeral environments.
It looks like sessions are stored as files locally in jsonl files. We're using [trigger.dev](https://trigger.dev) to manage tool calls in general, including the main agent loop. When these environments reset, the session files are deleted. If a user comes back later to continue the conversation in the same session, Claude isn't able to handle this case well and exist.
Here it is not being able to find the session file anymore:
```[ERROR] "Error: Error: Error opening file /Users/nimagardideh/.claude/projects/-Users-nimagardideh-workspace-praxo--trigger-tmp-build-Ox2OjD/794ac809-34ed-49d2-82ce-7c23380140a8.jsonl: Error: ENOENT: no such file or directory, open '/Users/nimagardideh/.claude/projects/-Users-nimagardideh-workspace-praxo--trigger-tmp-build-Ox2OjD/794ac809-34ed-49d2-82ce-7c23380140a8.jsonl'\n at m7A (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:62:176)\n at async No1 (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:3550:2135)\n at async Pf2.getLastLog (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:3549:1068)\n at async bf2 (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:3550:2702)\n at async aG2 (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:3574:3344)\n at async sm (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:2239:2514)\n at async Mm6 (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:3723:87)\n at async Xm2 (file:///Users/nimagardideh/workspace/praxo/.trigger/tmp/build-Ox2OjD/node_modules/@anthropic-ai/claude-code/cli.js:3711:35)"```
It then prints:
```No conversation found with session ID: 794ac809-34ed-49d2-82ce-7c23380140a8```
And eventually exists with code `1`:
```Error: Claude Code process exited with code 1
at ProcessTransport.getProcessExitError (file:///Users/nimagardideh/workspace/praxo/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:6560:14)
at ChildProcess.exitHandler (file:///Users/nimagardideh/workspace/praxo/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:6697:28)
at Object.onceWrapper (node:events:622:26)
at ChildProcess.emit (node:events:519:35)
at Process.ChildProcess._handle.onexit (node:internal/child_process:294:12)
at Process.callbackTrampoline (node:internal/async_hooks:130:17)```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。