From 0b08fc5242f862c970304af1c269602d177f262a Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 6 Nov 2026 23:34:38 +1100 Subject: [PATCH] fix(ui): harness setup terminal reports the real failure and can be reopened (#1755) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A websocket that never opened stays "failed" — onclose no longer overwrites it with "closed", so the terminal says "Could not open the setup terminal." instead of "The terminal session ended.". The terminal emits ended when its session closes, and HarnessPage resets terminalOpen on it (plus a Close terminal button), so reopening starts a fresh session instead of requiring a page reload. The harness load failure now has a Retry button. --- ui/src/harness/HarnessPage.vue | 7 ++++--- ui/src/harness/SetupTerminal.vue | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ui/src/harness/HarnessPage.vue b/ui/src/harness/HarnessPage.vue index 38b230d01..1495cc321 100644 --- a/ui/src/harness/HarnessPage.vue +++ b/ui/src/harness/HarnessPage.vue @@ -112,7 +112,7 @@ function scopes(binding: HarnessBinding): string { Could not load the harness - {{ failure }} + {{ failure }}
@@ -153,8 +153,9 @@ function scopes(binding: HarnessBinding): string {
-
-
+
+ +
diff --git a/ui/src/harness/SetupTerminal.vue b/ui/src/harness/SetupTerminal.vue index 0530fce62..06ee2e3bd 100644 --- a/ui/src/harness/SetupTerminal.vue +++ b/ui/src/harness/SetupTerminal.vue @@ -18,6 +18,9 @@ import "@xterm/xterm/css/xterm.css"; import { setupTerminalURL } from "./harness"; const props = defineProps<{ profile: string }>(); +// The parent resets its open flag when the session ends, so reopening starts +// a new terminal rather than showing a dead one. +const emit = defineEmits<{ ended: [] }>(); const host = ref(null); const status = ref<"connecting" | "open" | "closed" | "failed">("connecting"); @@ -78,7 +81,10 @@ onMounted(() => { status.value = "failed"; }; ws.onclose = () => { - status.value = "closed"; + // A connection that never opened stays "failed": onclose must not + // overwrite the real reason with "ended". + if (status.value !== "failed") status.value = "closed"; + emit("ended"); }; term.onData((data) => { if (ws.readyState === WebSocket.OPEN) ws.send(data);