fix: implement loading timeout, SSE reconnect, and message retry (#857)

* fix: implement loading timeout, SSE reconnect, and message retry

- Loading timeout: 30s timeout with retry/cancel buttons to prevent infinite loading
- SSE reconnect: Auto-reconnect up to 3 times with exponential backoff (1s, 2s, 4s)
- Message retry: Ensure critical messages reach webview with 5s timeout and 3 retries

This fix prevents the chat from getting stuck in a permanent loading state
and improves reliability of SSE connections and webview communication.

Fixes #851

* fix: harden vscode bridge retry flow

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
jwcrystal
2026-04-07 15:46:06 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent 1fed81439c
commit 4cb918f6cb
3 changed files with 197 additions and 25 deletions
+5
View File
@@ -47,6 +47,11 @@ window.addEventListener('message', (event: MessageEvent<BridgeResponse>) => {
const response = event.data;
if (!response || typeof response.id !== 'string') return;
const messageId = (response as BridgeResponse & { _msgId?: unknown })._msgId;
if (typeof messageId === 'string' && messageId.length > 0) {
getVSCodeAPI().postMessage({ type: 'bridge:ack', _msgId: messageId });
}
const pending = pendingRequests.get(response.id);
if (pending) {
pendingRequests.delete(response.id);