fix(desktop): wait for first-run bootstrap before connection timeout

This commit is contained in:
yilsem committed 2026-09-05 13:46:53 +03:00
1 parent 03634b1ca3
commit b9bb62ea82
6 files changed
+231 -30

No files matched your search

@@ -8,7 +8,12 @@ import { translateNow } from '@/i18n'
import { desktopDefaultCwd } from '@/lib/desktop-fs'
import { decideLivenessForceClose, LIVENESS_REPROBE_DELAY_MS } from '@/lib/gateway-liveness-policy'
import { reconnectBackoffDelayMs } from '@/lib/reconnect-backoff'
import { BACKEND_BOOT_WAIT_TIMEOUT_MS, RECONNECT_ATTEMPT_TIMEOUT_MS, withTimeout } from '@/lib/with-timeout'
import {
BACKEND_BOOT_WAIT_TIMEOUT_MS,
RECONNECT_ATTEMPT_TIMEOUT_MS,
withBootstrapAwareTimeout,
withTimeout
} from '@/lib/with-timeout'
import {
$desktopBoot,
applyDesktopBootProgress,
@@ -988,10 +993,12 @@ export function useGatewayBoot({
// round-trip must not hang "Starting Hermes…" forever. Initial boot
// rides out a full backend cold spawn, so it gets the shared 45s
// backend-boot budget, not the 20s reconnect budget.
const conn = await withTimeout(
const conn = await withBootstrapAwareTimeout(
desktop.getConnection(windowProfileOverride() ?? undefined),
BACKEND_BOOT_WAIT_TIMEOUT_MS,
'Timed out connecting to Hermes backend'
'Timed out connecting to Hermes backend',
desktop.getBootstrapState ? () => desktop.getBootstrapState!() : undefined,
() => cancelled
)
if (cancelled) {