fix: surface disconnect reason, switch health probe to /global/health (#978)

- event-pipeline: onDisconnect now carries a reason tag (ws_closed:code=N, ws_error_frame, ws_closed_before_ready, sse_error)
- useConfigStore: store lastDisconnectReason, clear on reconnect
- send guards: embed reason in Connection lost toast so we can tell which path tripped
- lifecycle: isOpenCodeProcessHealthy hits /global/health (healthy flag) with 5s timeout instead of /session with 2s, avoids false restarts under stream load
This commit is contained in:
Bohdan Triapitsyn
2026-04-22 00:33:21 +03:00
committed by GitHub
parent 8e86891d8e
commit 5ec7f46105
6 changed files with 46 additions and 16 deletions
@@ -319,12 +319,17 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
}
try {
const response = await fetch(buildOpenCodeUrl('/session', ''), {
const response = await fetch(buildOpenCodeUrl('/global/health', ''), {
method: 'GET',
headers: getOpenCodeAuthHeaders(),
signal: AbortSignal.timeout(2000),
headers: {
Accept: 'application/json',
...getOpenCodeAuthHeaders(),
},
signal: AbortSignal.timeout(5000),
});
return response.ok;
if (!response.ok) return false;
const body = await response.json().catch(() => null);
return body?.healthy === true;
} catch {
return false;
}