Skip to content

fix(api-server): send initial SSE event to complete handshake#10159

Merged
davidfirst merged 2 commits intomasterfrom
fix/sse-initial-event-handshake
Jan 16, 2026
Merged

fix(api-server): send initial SSE event to complete handshake#10159
davidfirst merged 2 commits intomasterfrom
fix/sse-initial-event-handshake

Conversation

@davidfirst
Copy link
Member

Some EventSource clients (like the eventsource npm package used in VS Code extension) stay in CONNECTING state until they receive data from the server.

This adds an initial connected event immediately after sending the SSE headers, ensuring proper handshake completion and allowing clients to transition to OPEN state.

Before: EventSource stays in readyState: 0 (CONNECTING) indefinitely
After: EventSource transitions to readyState: 1 (OPEN) immediately

Some EventSource clients stay in CONNECTING state until they receive data.
Sending an initial 'connected' event ensures proper handshake completion.
Copilot AI review requested due to automatic review settings January 16, 2026 16:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where some EventSource clients (like the eventsource npm package used in VS Code extensions) remain in CONNECTING state indefinitely. The fix adds an initial connected event immediately after sending SSE headers to complete the handshake.

Changes:

  • Adds an initial SSE event (event: connected\ndata: {}\n\n) immediately after writing response headers to ensure proper EventSource client handshake completion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@davidfirst davidfirst enabled auto-merge (squash) January 16, 2026 16:59
@davidfirst davidfirst merged commit 8a2a9b2 into master Jan 16, 2026
12 checks passed
@davidfirst davidfirst deleted the fix/sse-initial-event-handshake branch January 16, 2026 17: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.

3 participants