From e1282b69048a6fa20e0601fd8d17144eaa727355 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Thu, 22 Jan 2026 11:36:07 -0600 Subject: [PATCH] chore: reword unhealthy agents on workspace page depending on the failure (#21622) Also remove the "restart" button. The language is still there, and the restart button is already on this page. That button being present had users clicking it when waiting was the correct solution. So the "Restart" option is not as pushed. --- site/src/pages/WorkspacePage/Workspace.tsx | 94 +++++++++++++++------- 1 file changed, 64 insertions(+), 30 deletions(-) diff --git a/site/src/pages/WorkspacePage/Workspace.tsx b/site/src/pages/WorkspacePage/Workspace.tsx index 198cca3a5c..90a0530e28 100644 --- a/site/src/pages/WorkspacePage/Workspace.tsx +++ b/site/src/pages/WorkspacePage/Workspace.tsx @@ -1,4 +1,5 @@ import type * as TypesGen from "api/typesGenerated"; +import type { WorkspaceAgentStatus } from "api/typesGenerated"; import { Alert, AlertDetail, AlertTitle } from "components/Alert/Alert"; import { SidebarIconButton } from "components/FullPageLayout/Sidebar"; import { Link } from "components/Link/Link"; @@ -20,7 +21,6 @@ import { WorkspaceBuildProgress, } from "./WorkspaceBuildProgress"; import { WorkspaceDeletedBanner } from "./WorkspaceDeletedBanner"; -import { NotificationActionButton } from "./WorkspaceNotifications/Notifications"; import { findTroubleshootingURL } from "./WorkspaceNotifications/WorkspaceNotifications"; import { WorkspaceTopbar } from "./WorkspaceTopbar"; @@ -101,7 +101,6 @@ export const Workspace: FC = ({ const shouldShowProvisionerAlert = workspacePending && !haveBuildLogs && !provisionersHealthy && !isRestarting; const troubleshootingURL = findTroubleshootingURL(workspace.latest_build); - const hasActions = permissions.updateWorkspace || troubleshootingURL; return (
@@ -203,34 +202,10 @@ export const Workspace: FC = ({ )} {!workspace.health.healthy && ( - - Workspace is unhealthy - -

- Your workspace is running but{" "} - {workspace.health.failing_agents.length > 1 - ? `${workspace.health.failing_agents.length} agents are unhealthy` - : "1 agent is unhealthy"} - .{" "} - {troubleshootingURL && ( - - View docs to troubleshoot - - )} -

- {hasActions && ( -
- {permissions.updateWorkspace && ( - handleRestart()} - > - Restart - - )} -
- )} -
-
+ )} {transitionStats !== undefined && ( @@ -290,6 +265,65 @@ export const Workspace: FC = ({ ); }; +interface UnhealthyWorkspaceAlertProps { + workspace: TypesGen.Workspace; + troubleshootingURL: string | undefined; +} + +const UnhealthyWorkspaceAlert: FC = ({ + workspace, + troubleshootingURL, +}) => { + const failingAgentCount = workspace.health.failing_agents.length; + const failureSet = new Set(); + + workspace.latest_build.resources.forEach((resource) => { + resource.agents?.forEach((agent) => { + failureSet.add(agent.status); + }); + }); + + var title = "Workspace agents are not connected"; + var message = + "Your workspace cannot be used until an agent connects. Continue to wait and check the log output of your workspace for any errors."; + + // Disconnected is a more serious failure than timeout, so we can + // prioritize handling it first. + if (failureSet.has("disconnected")) { + title = "Workspace agents have disconnected"; + message = + "Continue to wait and check the log output of your workspace for any errors. If the agent does not reconnect, restarting the workspace can be used to try again."; + } else if (failureSet.has("timeout")) { + // Handle timeout case + title = "Your workspace is starting, but the agent has not yet connected."; + message = + "The agent is taking longer than expected to connect. Continue to wait and check the log output of your workspace for any errors. If the agent does not connect, restarting the workspace can be used to try again."; + } + + return ( + + {title} + +

+ Your workspace is running but{" "} + {failingAgentCount > 1 + ? `${failingAgentCount} agents have not connected yet.` + : "the agent has not connected yet."} + .{" "} +

+

{message}

+

+ {troubleshootingURL && ( + + View docs to troubleshoot + + )} +

+
+
+ ); +}; + const countAgents = (resource: TypesGen.WorkspaceResource) => { return resource.agents ? resource.agents.length : 0; };