@devries-cameron20 / t3code Mirror · read-only / commits / 2d6a379997
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 09:00 UTC

fix(web): only show auto balance errors after failed checks (#10407)

maria committed Sep 6, 2026 at 19:54 UTC 2d6a3799978659e349faf8ff4297098ffb782ebb
3 files changed +16 -9
apps/web/src/components/ChatView.tsx
+3 -1
@@ -3331,7 +3331,9 @@ export default function ChatView(props: ChatViewProps) {
3331 ? "Auto balance"
3332 : loadBalancing.pending
3333 ? "Checking machines…"
3334 - : "Auto balance unavailable"
3334 + : loadBalancing.failed
3335 + ? "Auto balance unavailable"
3336 + : "Auto balance"
3337 : undefined;
3338
3339 // Handle environment change for draft threads. When the user picks a
apps/web/src/hooks/useLoadBalancedEnvironment.ts
+12 -8
@@ -30,21 +30,25 @@ export function useLoadBalancedEnvironment(
30 resources: result._tag === "Success" ? result.value : null,
31 receivedAt: result._tag === "Success" ? result.timestamp : 0,
32 pending: result._tag === "Initial" || result.waiting,
33 + failed: result._tag === "Failure",
34 };
35 }),
36 ),
37 [environmentIds],
38 );
39 const resources = useAtomValue(resourcesAtom);
40 + const pending = resources.some((resource) => resource.pending);
41 + const environmentId = chooseLoadBalancedEnvironment(
42 + resources.map((resource) => ({
43 + ...resource,
44 + weight: weights[resource.environmentId] ?? 50,
45 + })),
46 + Date.now(),
47 + ) as EnvironmentId | null;
48 return {
49 refresh,
41 - pending: resources.some((resource) => resource.pending),
42 - environmentId: chooseLoadBalancedEnvironment(
43 - resources.map((resource) => ({
44 - ...resource,
45 - weight: weights[resource.environmentId] ?? 50,
46 - })),
47 - Date.now(),
48 - ) as EnvironmentId | null,
50 + pending,
51 + environmentId,
52 + failed: !pending && environmentId === null && resources.some((resource) => resource.failed),
53 };
54 }
packages/client-runtime/src/state/server.ts
+1
@@ -1021,6 +1021,7 @@ export function createServerEnvironmentAtoms<R, E>(
1021 }),
1022 hostResources: createEnvironmentQueryAtomFamily(runtime, {
1023 label: "environment-data:server:host-resources",
1024 + idleTtlMs: 0,
1025 staleTimeMs: 5_000,
1026 execute: (input: EnvironmentRpcInput<typeof WS_METHODS.serverGetHostResources>) =>
1027 request(WS_METHODS.serverGetHostResources, input).pipe(Effect.timeout("5 seconds")),