From c033f3b05110a82e0aa7e6059d6deb32ab2d6f15 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Mon, 20 Apr 2026 18:02:22 -0700 Subject: [PATCH] chore(canvas): review nits on ConsoleModal + Peers empty state Post-review cleanup for the #1178 / #1189 bootstrap-watcher flow: - ConsoleModal status-code matching uses \b regex anchors instead of raw substrings. Before, any error message containing "501" inside a longer digit run ("15012") would false-match into the self-hosted branch. Unlikely in practice but cheap to tighten. - Peers empty-state copy now explains WHY the list is empty on offline / failed / provisioning workspaces instead of rendering the same "No reachable peers" text used for healthy workspaces with zero siblings. Online workspaces unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- canvas/src/components/ConsoleModal.tsx | 10 ++++++---- canvas/src/components/tabs/DetailsTab.tsx | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/canvas/src/components/ConsoleModal.tsx b/canvas/src/components/ConsoleModal.tsx index 6db48ee2..55265837 100644 --- a/canvas/src/components/ConsoleModal.tsx +++ b/canvas/src/components/ConsoleModal.tsx @@ -45,12 +45,14 @@ export function ConsoleModal({ workspaceId, workspaceName, open, onClose }: Prop }) .catch((e) => { if (ignore) return; - // 501 = deployment without a control plane (local docker-compose); - // we render a friendlier message than "501 Not Implemented". + // 501 = deployment without a control plane (local docker-compose). + // 404 = EC2 instance has been terminated. Match with word-boundary + // regex so a status code appearing inside an unrelated number + // ("15012") doesn't false-match. const msg = e instanceof Error ? e.message : "Failed to load console output"; - if (/501/.test(msg)) { + if (/\b501\b/.test(msg)) { setError("Console output is only available on cloud (SaaS) deployments."); - } else if (/404/.test(msg)) { + } else if (/\b404\b/.test(msg)) { setError("No EC2 instance found for this workspace — it may have been terminated."); } else { setError(msg); diff --git a/canvas/src/components/tabs/DetailsTab.tsx b/canvas/src/components/tabs/DetailsTab.tsx index 7662b49b..9766fc18 100644 --- a/canvas/src/components/tabs/DetailsTab.tsx +++ b/canvas/src/components/tabs/DetailsTab.tsx @@ -268,6 +268,10 @@ export function DetailsTab({ workspaceId, data }: Props) {
{peersError ? (

{peersError}

+ ) : peers.length === 0 && data.status !== "online" && data.status !== "degraded" ? ( +

+ Peers are only discoverable while the workspace is online. +

) : peers.length === 0 ? (

No reachable peers

) : (