You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4cf737f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(claude-agent-sdk): verify-r4: notifications, stream events and session state drive the idle-after-result state
R4-1: a background task_notification is queued as a main-thread command
that runs its own turn (sdk.d.ts:5440, 4603), so close() after one is a
cancellation again (supersedes 005a70f's expectation). R4-2: a main-loop
stream_event (includePartialMessages) after a result also starts a turn.
system/session_state_changed is authoritative when sent (sdk.d.ts:5858):
'idle' after a result ends OK, 'running' cancelled. README updated.
Test first: 3 new jest cases failed on 005a70f.
approved: Nikhil 2026-10-03 blanket
Refs: TH-8235
Copy file name to clipboardExpand all lines: typescript/packages/traceai_claude_agent_sdk/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ With 0.3.289 the CLI then calls `POST {ANTHROPIC_BASE_URL}/v1/messages?beta=true
132
132
-**No traces.**`register()` needs `projectName` or `FI_PROJECT_NAME`.
133
133
-**Zero spans from a short script.**`await shutdown()` before exit.
134
134
-**Duplicate model spans.** Do not also run a provider instrumentor on the same calls.
135
-
-**A span left open after abort.** Every span for the query is ended with status ERROR and `claude_agent.cancelled=true` when its `AbortController` aborts, when you call `close()` on the returned `Query` (the SDK's abort path), or when `await using` disposes it (`Symbol.asyncDispose`). Calling `close()` after the stream has completed changes nothing. Right after a result, before any further main-loop assistantor user message and with no background subagent still running, `close()`, `Symbol.asyncDispose` and an abort end the conversation OK instead, because nothing was cancelled. One gap remains: an abort after the app sends a new streaming-input prompt but before the SDK yields any message for it is recorded as OK. Anything else is a bug here.
135
+
-**A span left open after abort.** Every span for the query is ended with status ERROR and `claude_agent.cancelled=true` when its `AbortController` aborts, when you call `close()` on the returned `Query` (the SDK's abort path), or when `await using` disposes it (`Symbol.asyncDispose`). Calling `close()` after the stream has completed changes nothing. Right after a result, before the main loop starts another turn (a main-loop assistant, user or `stream_event` frame, or a background `task_notification`, which the CLI runs as its own turn) and with no background subagent still running, `close()`, `Symbol.asyncDispose` and an abort end the conversation OK instead, because nothing was cancelled. A `system/session_state_changed` frame, when the CLI sends one, decides it: `idle` after a result ends OK, `running` ends cancelled. One gap remains: an abort after the app sends a new streaming-input prompt but before the SDK yields any message for it is recorded as OK. Anything else is a bug here.
0 commit comments