Skip to content

Skip SSE reconnect when watched run_id set is unchanged#11574

Draft
cephalonaut wants to merge 1 commit into
masterfrom
matthew/sse-reconnect-loop
Draft

Skip SSE reconnect when watched run_id set is unchanged#11574
cephalonaut wants to merge 1 commit into
masterfrom
matthew/sse-reconnect-loop

Conversation

@cephalonaut
Copy link
Copy Markdown
Contributor

@cephalonaut cephalonaut commented May 22, 2026

Description

The orchestration SSE connection was being torn down and re-opened on every status transition (Idle → InProgress → Success/Cancelled/Error), even when the underlying run-id filter hadn't changed. This caused unnecessary connection churn on every exchange.

This change tracks the run-id set associated with each open SSE connection and only reconnects when that set actually changes.

Testing

  • Added a regression test asserting the SSE generation does not advance across a same-set re-evaluation.
  • All `orchestration_event_streamer` tests pass.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Stop tearing down and re-opening the orchestration SSE connection on every exchange's status transitions.

`reevaluate_eligibility` previously called `reconnect_sse` unconditionally
in the (true, true) arm. The dispatch at `handle_history_event` routes
`UpdatedConversationStatus` and `UpdatedConversationMetadata` through
`reevaluate_eligibility`, and those events fire on every exchange's
status transitions (Idle → InProgress → Success/Cancelled/Error), so
each exchange tore down and re-opened the orchestration SSE even when
the run-id filter hadn't changed.

Snapshot `watched_run_ids` on the connection when it's opened and only
reconnect when the current set differs from the snapshot. Call sites
that legitimately want a forced reconnect (e.g.
`finish_restore_fetch` after children are discovered) still call
`reconnect_sse` directly.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant