Skip to content

Commit 4bdc147

Browse files
ericpgreen2claude
andcommitted
fix (SSE): Prevent heartbeat from aborting in-progress connections (#8783)
* fix (SSE): Send server keep-alives * Push a devcontainer for testing * Bump devcontainer's Node heap size * Fix devcontainer's Go version * Add debugging logs * Modify devcontainer so I can upload my own binary * Fix heartbeat triggering reconnect during CONNECTING state * Revert "fix (SSE): Send server keep-alives" This reverts commit a719a8c. * Remove SSE debugging logs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove devcontainer (moved to separate PR) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8e7a483 commit 4bdc147

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

web-common/src/runtime-client/sse-connection-manager.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export class SSEConnectionManager {
8080
*/
8181
private async reconnect() {
8282
// Prevent concurrent reconnection attempts
83-
if (this.isReconnecting) return;
83+
if (this.isReconnecting) {
84+
return;
85+
}
8486
this.isReconnecting = true;
8587

8688
try {
@@ -117,7 +119,10 @@ export class SSEConnectionManager {
117119
* Stop the connection, mark closed and clean up resources
118120
*/
119121
public heartbeat = async () => {
120-
if (get(this.status) !== ConnectionStatus.OPEN) {
122+
const status = get(this.status);
123+
// Only reconnect if PAUSED (intentionally disconnected to save resources)
124+
// Don't reconnect if CONNECTING (already in progress) or CLOSED (fatal error)
125+
if (status === ConnectionStatus.PAUSED) {
121126
await this.reconnect();
122127
}
123128

0 commit comments

Comments
 (0)