feat: add status filter to SDK listen() for SSE zombie fix#32
Merged
George-iam merged 3 commits intomainfrom Mar 17, 2026
Merged
feat: add status filter to SDK listen() for SSE zombie fix#32George-iam merged 3 commits intomainfrom
George-iam merged 3 commits intomainfrom
Conversation
SSE streaming calls now use wait_seconds + 15s read timeout instead of the global 15s client timeout. Fixes agent.listen() crashing when the server holds the connection open for 30s keepalive cycles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Server now excludes terminal statuses (COMPLETED, FAILED, CANCELED, TIMED_OUT) by default. SDK gains optional status parameter to override the server default when needed (e.g. for debugging or audit). Backward-compatible: existing agents that call listen() without status= benefit from server-side zombie filtering automatically. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the SSE stream returns a 4xx/5xx, _raise_http_error accessed response.text inside a streaming context, causing httpx.ResponseNotRead. This crashed agents on transient 503s instead of allowing reconnect. Fix: call response.read() before accessing .text/.json(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
statusparameter tolisten()and_iter_agent_intents_stream()?status=query param when explicitly provided, otherwise relies on server defaultContext
Agents connecting to SSE stream were receiving all historic intents including terminal ones (CANCELED, COMPLETED, FAILED, TIMED_OUT), forcing them to process hundreds of dead intents before reaching actionable work.
Test plan
🤖 Generated with Claude Code