Skip to content

feat: add status filter to SDK listen() for SSE zombie fix#32

Merged
George-iam merged 3 commits intomainfrom
feat/sse-status-filter-20260317
Mar 17, 2026
Merged

feat: add status filter to SDK listen() for SSE zombie fix#32
George-iam merged 3 commits intomainfrom
feat/sse-status-filter-20260317

Conversation

@George-iam
Copy link
Contributor

Summary

  • Add optional status parameter to listen() and _iter_agent_intents_stream()
  • Server now excludes terminal statuses (COMPLETED, FAILED, CANCELED, TIMED_OUT) by default
  • SDK passes ?status= query param when explicitly provided, otherwise relies on server default
  • Fully backward-compatible: all existing agents benefit from server-side zombie filtering automatically

Context

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

  • All 11 SDK listen tests pass
  • E2E verification with deployed server (after control-plane PR#121 merge)

🤖 Generated with Claude Code

George-iam and others added 3 commits March 15, 2026 22:09
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>
@George-iam George-iam merged commit cf17875 into main Mar 17, 2026
1 check passed
@George-iam George-iam deleted the feat/sse-status-filter-20260317 branch March 17, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant