🐛 Fix MCP plugin reconnect loop on duplicate connection (#11520)

The MCP server closes duplicate plugin connections with 1008 (policy
violation). The plugin treated every close as retryable: shouldReconnect
stayed true, scheduleReconnect re-armed, and each brief onopen reset the
backoff - looping at ~1s until the browser froze. Treat 1008 closes as
terminal and stay disconnected until the user reconnects explicitly.
This commit is contained in:
breken 2026-09-24 06:55:09 -07:00 committed by GitHub
parent 128c495b2a
commit 9b3594748c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -255,6 +255,15 @@ function connectToMcpServer(baseUrl?: string, token?: string): void {
updateCurrentTask(null);
}
ws = null;
if (event.code === 1008) {
// Policy violation (e.g. duplicate connection for the same user
// token - another tab already holds the connection). Retrying
// would be refused again immediately, so stay disconnected
// until the user explicitly reconnects.
shouldReconnect = false;
cancelReconnect();
return;
}
scheduleReconnect();
};