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);