fix(client): slow servers finish loading the thread list instead of loading it twice (#13683)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Theo BrowneandClaude Opus 5.5 authored and GitHub committed 2026-09-25 20:28:35 -07:00
1 parent b6eefc926a
commit b2577d6efa
3 files changed
+16 -9

No files matched your search

+2 -2
View File
@@ -30,8 +30,8 @@ function initialConfigOption<E>(
);
}
// Bounded like the snapshot fetches: a wedged environment must not pin the
// permissions check (and with it the settings UI) in a loading state for long.
// Bounded so a wedged environment cannot pin the permissions check (and with it
// the settings UI) in a loading state for long.
const DEFAULT_SESSION_STATE_TIMEOUT_MS = 6_000;
/**
@@ -12,9 +12,13 @@ import { environmentEndpointUrl } from "../environment/endpoint.ts";
import { ManagedRelayDpopSigner } from "../relay/managedRelay.ts";
import { executeAuthenticatedEnvironmentHttpRequest } from "./environmentHttpAuth.ts";
// Bounded so a pathologically slow endpoint cannot block the (cheaper) socket
// fallback for long. The cached shell renders while this runs.
const DEFAULT_SHELL_SNAPSHOT_TIMEOUT_MS = 6_000;
// Long enough for a slow but alive server to finish. On timeout the socket asks
// the same server for the same full snapshot, so a short deadline only throws
// the first build away. The socket fallback is for setups where /api fails but
// /ws works, such as a proxy that blocks /api. A dead server is caught by the
// socket ping, which drops the session and interrupts this load. The cached
// shell renders while this runs.
const DEFAULT_SHELL_SNAPSHOT_TIMEOUT_MS = 20_000;
/**
* Load the environment shell snapshot (projects + thread shells) over HTTP
@@ -13,10 +13,13 @@ import { ManagedRelayDpopSigner } from "../relay/managedRelay.ts";
import type { RemoteEnvironmentRequestError } from "../rpc/http.ts";
import { executeAuthenticatedEnvironmentHttpRequest } from "./environmentHttpAuth.ts";
// Bounded so a pathologically slow endpoint cannot block the (cheaper) socket
// fallback for long. The cached thread renders while this runs, so the wait only
// delays the transition to live data on the first open, not the initial paint.
const DEFAULT_THREAD_SNAPSHOT_TIMEOUT_MS = 6_000;
// Long enough for a slow but alive server to finish. On a cold open a timeout
// makes the socket ask the same server for the same snapshot again, and older
// turn pages have no fallback, so a short deadline only drops work. The socket
// fallback is for setups where /api fails but /ws works, such as a proxy that
// blocks /api. A dead server drops the socket session, which interrupts a
// cold-open load. Older turn pages wait for this deadline.
const DEFAULT_THREAD_SNAPSHOT_TIMEOUT_MS = 20_000;
/**
* Load a thread's detail snapshot over HTTP instead of embedding it in the