Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: show workspace health error alert above agents in WorkspacePage#19400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aqandrew merged 6 commits intomainfromaqandrew/unhealthy-workspace-alert
Aug 22, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletionssite/src/pages/WorkspacePage/Workspace.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ import type { ProvisionerJobLog } from "api/typesGenerated";
import { action } from "storybook/actions";
import type { WorkspacePermissions } from "../../modules/workspaces/permissions";
import { Workspace } from "./Workspace";
import { defaultPermissions } from "./WorkspaceNotifications/WorkspaceNotifications.stories";

// Helper function to create timestamps easily - Copied from AppStatuses.stories.tsx
const createTimestamp = (
Expand DownExpand Up@@ -349,6 +350,23 @@ export const Stopping: Story = {
},
};

export const Unhealthy: Story = {
args: {
...Running.args,
workspace: Mocks.MockUnhealthyWorkspace,
},
};

export const UnhealthyWithoutUpdatePermission: Story = {
args: {
...Unhealthy.args,
permissions: {
...defaultPermissions,
updateWorkspace: false,
},
},
};

export const FailedWithLogs: Story = {
args: {
...Running.args,
Expand Down
39 changes: 39 additions & 0 deletionssite/src/pages/WorkspacePage/Workspace.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,8 @@ import {
WorkspaceBuildProgress,
} from "./WorkspaceBuildProgress";
import { WorkspaceDeletedBanner } from "./WorkspaceDeletedBanner";
import { NotificationActionButton } from "./WorkspaceNotifications/Notifications";
import { findTroubleshootingURL } from "./WorkspaceNotifications/WorkspaceNotifications";
import { WorkspaceTopbar } from "./WorkspaceTopbar";

interface WorkspaceProps {
Expand DownExpand Up@@ -95,6 +97,8 @@ export const Workspace: FC<WorkspaceProps> = ({
(workspace.latest_build.matched_provisioners?.available ?? 1) > 0;
const shouldShowProvisionerAlert =
workspacePending && !haveBuildLogs && !provisionersHealthy && !isRestarting;
const troubleshootingURL = findTroubleshootingURL(workspace.latest_build);
const hasActions = permissions.updateWorkspace || troubleshootingURL;

return (
<div className="flex flex-col flex-1 min-h-0">
Expand DownExpand Up@@ -192,6 +196,41 @@ export const Workspace: FC<WorkspaceProps> = ({
</Alert>
)}

{!workspace.health.healthy && (
<Alert severity="warning">
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Alert's background color is--surface-secondary. The buttons turn--surface-secondary on hover, so there's no apparent change when hovering. (This is also the case inWorkspaceNotifications.)

Does it make sense to keep these colors? Or should we do something like giveNotificationActionButton an even lighter background (--surface-tertiary) on hover?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

the existing popup has the same problem. it should definitely get fixed eventually but our colors are a bit of a mess right now. probably out of scope for this issue.

aqandrew reacted with thumbs up emoji
<AlertTitle>Workspace is unhealthy</AlertTitle>
<AlertDetail>
<p>
Your workspace is running but{" "}
{workspace.health.failing_agents.length > 1
? `${workspace.health.failing_agents.length} agents are unhealthy`
: "1 agent is unhealthy"}
.
</p>
{hasActions && (
<div className="flex items-center gap-2">
{permissions.updateWorkspace && (
<NotificationActionButton
onClick={() => handleRestart()}
>
Restart
</NotificationActionButton>
)}
{troubleshootingURL && (
<NotificationActionButton
onClick={() =>
window.open(troubleshootingURL, "_blank")
}
>
Troubleshooting
</NotificationActionButton>
)}
</div>
)}
</AlertDetail>
</Alert>
)}

{transitionStats !== undefined && (
<WorkspaceBuildProgress
workspace={workspace}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import type { WorkspacePermissions } from "modules/workspaces/permissions";
import { expect, userEvent, waitFor, within } from "storybook/test";
import { WorkspaceNotifications } from "./WorkspaceNotifications";

const defaultPermissions: WorkspacePermissions = {
exportconst defaultPermissions: WorkspacePermissions = {
readWorkspace: true,
updateWorkspaceVersion: true,
updateWorkspace: true,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,7 @@ const styles = {
},
} satisfies Record<string, Interpolation<Theme>>;

const findTroubleshootingURL = (
exportconst findTroubleshootingURL = (
workspaceBuild: WorkspaceBuild,
): string | undefined => {
for (const resource of workspaceBuild.resources) {
Expand Down
23 changes: 23 additions & 0 deletionssite/src/testHelpers/entities.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -992,6 +992,15 @@ export const MockWorkspaceSubAgent: TypesGen.WorkspaceAgent = {
],
};

const MockWorkspaceUnhealthyAgent: TypesGen.WorkspaceAgent = {
...MockWorkspaceAgent,
id: "test-workspace-unhealthy-agent",
name: "a-workspace-unhealthy-agent",
status: "timeout",
lifecycle_state: "start_error",
health: { healthy: false },
};

export const MockWorkspaceAppStatus: TypesGen.WorkspaceAppStatus = {
id: "test-app-status",
created_at: "2022-05-17T17:39:01.382927298Z",
Expand DownExpand Up@@ -1443,6 +1452,20 @@ export const MockStoppingWorkspace: TypesGen.Workspace = {
status: "stopping",
},
};
export const MockUnhealthyWorkspace: TypesGen.Workspace = {
...MockWorkspace,
id: "test-unhealthy-workspace",
health: {
healthy: false,
failing_agents: [MockWorkspaceUnhealthyAgent.id],
},
latest_build: {
...MockWorkspace.latest_build,
resources: [
{ ...MockWorkspaceResource, agents: [MockWorkspaceUnhealthyAgent] },
],
},
};
export const MockStartingWorkspace: TypesGen.Workspace = {
...MockWorkspace,
id: "test-starting-workspace",
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp