fix(web): stop mistaking offline servers for updates (#13083)

This commit is contained in:
Tristan Knight authored and GitHub committed 2026-09-26 14:59:18 -05:00
1 parent 3dae78f33b
commit dd582dee36
1 file changed
+25 -53
+25 -53
View File
@@ -2705,68 +2705,40 @@ export default function ChatView(props: ChatViewProps) {
unavailableConnection !== null &&
(unavailableConnection.phase === "connecting" ||
unavailableConnection.phase === "reconnecting");
// Reconnecting to a version-skewed server with no update in flight
// usually means the server is restarting mid-update and a refresh wiped
// the in-memory update state. Fold the reconnect and version banners
// into one calm line instead of stacking "Failed to connect" on
// "versions differ". A failed update never folds: its error and retry
// action must stay visible.
const reconnectingThroughVersionSkew =
serverUpdateState.status === "idle" && environmentReconnecting && versionMismatch !== null;
// While an update runs, transient connect blips are expected (the server
// restarts) and the update banner already shows progress. Hard failure
// phases still surface so the Reconnect action stays reachable.
const suppressUnavailableBanner =
environmentReconnecting &&
(updateRunning || (!reconnectingThroughVersionSkew && !reconnectWarningGraceElapsed));
environmentReconnecting && (updateRunning || !reconnectWarningGraceElapsed);
if (activeEnvironmentUnavailableState && unavailableConnection && !suppressUnavailableBanner) {
if (reconnectingThroughVersionSkew) {
items.push({
id: `environment-unavailable:${activeEnvironmentUnavailableState.environmentId}`,
variant: "default",
// Prioritize live connection progress among the notices.
priority: "urgent",
icon: (
<span
className="size-1.5 animate-status-pulse rounded-full bg-foreground"
aria-hidden="true"
/>
),
title: `${unavailableConnection.phase === "connecting" ? "Connecting" : "Reconnecting"} to ${activeEnvironmentUnavailableState.label}`,
description: "Finishing an update",
actions: disconnectAction,
});
} else {
items.push({
id: `environment-unavailable:${activeEnvironmentUnavailableState.environmentId}`,
variant: unavailableConnection.phase === "error" ? "error" : "warning",
icon: <WifiOffIcon />,
title: `${activeEnvironmentUnavailableState.label} is ${environmentReconnecting ? "reconnecting" : "offline"}`,
actions: (
<>
{!environmentReconnecting ? (
<Button
size="xs"
variant="ghost"
onClick={() =>
void handleReconnectActiveEnvironment(
activeEnvironmentUnavailableState.environmentId,
)
}
>
Reconnect
</Button>
) : null}
{disconnectAction}
</>
),
});
}
items.push({
id: `environment-unavailable:${activeEnvironmentUnavailableState.environmentId}`,
variant: unavailableConnection.phase === "error" ? "error" : "warning",
icon: <WifiOffIcon />,
title: `${activeEnvironmentUnavailableState.label} is ${environmentReconnecting ? "reconnecting" : "offline"}`,
actions: (
<>
{!environmentReconnecting ? (
<Button
size="xs"
variant="ghost"
onClick={() =>
void handleReconnectActiveEnvironment(
activeEnvironmentUnavailableState.environmentId,
)
}
>
Reconnect
</Button>
) : null}
{disconnectAction}
</>
),
});
}
if (
!automaticEnvironment &&
serverUpdateEnvironmentId &&
!reconnectingThroughVersionSkew &&
(serverUpdateState.status === "idle"
? showVersionMismatchBanner
: !serverUpdateFailureDismissed)