fix(ui): harness setup terminal reports the real failure and can be reopened (#1755)
Quality / check (push) Canceled after 5m18s
deploy / gate (push) Successful in 4m48s
deploy / archied-image (push) Successful in 3m29s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped

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.
This commit is contained in:
sam committed 2026-11-06 23:34:38 +11:00
1 parent 93609c7ab3
commit 0b08fc5242
2 files changed
+11 -4

No files matched your search

+4 -3
View File
@@ -112,7 +112,7 @@ function scopes(binding: HarnessBinding): string {
<Alert v-if="failure" variant="destructive" class="mb-4">
<AlertTitle>Could not load the harness</AlertTitle>
<AlertDescription>{{ failure }}</AlertDescription>
<AlertDescription>{{ failure }} <Button variant="link" size="xs" class="px-0" @click="load">Retry</Button></AlertDescription>
</Alert>
<div v-if="loading" class="flex flex-col gap-2">
@@ -153,8 +153,9 @@ function scopes(binding: HarnessBinding): string {
</div>
</Section>
<Section v-if="terminalOpen && profile">
<div class="h-96"><SetupTerminal :profile="profile" /></div>
<Section v-if="terminalOpen && profile" title="Setup terminal">
<template #action><Button variant="outline" size="sm" @click="terminalOpen = false">Close terminal</Button></template>
<div class="h-96"><SetupTerminal :profile="profile" @ended="terminalOpen = false" /></div>
</Section>
<Section>
+7 -1
View File
@@ -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<HTMLDivElement | null>(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);