Skip to content

[Bug]: Testing an SSH device host twice hides the pending check #39327

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open Settings → Devices in an environment with devices enabled and a slow SSH host configured.
  2. Open the host’s More menu.
  3. Select Test connection.
  4. Reopen the host’s More menu while Testing connection is still visible.
  5. Select Test connection again.

Expected behavior

Testing connection stays visible until the check finishes.

Actual behavior

Testing connection disappears as soon as the second menu action closes, while the original check is still running.

second connection check

failure

Impact

Major degradation or frequent failure. Anyone who tests the same slow SSH host again before its check finishes loses the progress indicator.

Version or commit

main at 5f8ab374af. The cause is at apps/web/src/components/settings/DeviceSourcesSettings.tsx:326.

Environment

Linux x64 boat.dev default machine, a fresh checkout.

Logs or stack traces

The SSH connection check still shows as pending
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts b/scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts
new file mode 100644
index 0000000000..8f4b09d77d
--- /dev/null
+++ b/scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts
@@ -0,0 +1,97 @@
+/// <reference lib="dom" />
+import { expect } from "e2e";
+import * as Effect from "effect/Effect";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { environmentId, rpcClient, runPromise, test, WEB } from "./t3.ts";
+
+declare global {
+  interface Window {
+    deviceHostProbeGate?: { readonly started: Promise<void>; readonly release: () => void };
+  }
+}
+
+test(
+  "A second SSH connection check keeps the pending status visible",
+  WEB,
+  async ({ t3, app, browser, screen }) => {
+    const origin = app.baseUrl ?? "";
+    const environment = await runPromise(environmentId(origin));
+    await t3.project("demo");
+    await runPromise(
+      Effect.gen(function* () {
+        const client = yield* rpcClient(T3_HOME, origin);
+        yield* client["server.updateSettings"]({
+          patch: {
+            enableDeviceSupport: true,
+            deviceHosts: [
+              { kind: "ssh", id: "slow-host", label: "Slow host", target: "127.0.0.1", port: 1 },
+            ],
+          },
+        });
+      }).pipe(Effect.scoped),
+    );
+
+    // Delay just the explicit probe at the transport boundary until after the UI sample.
+    await browser.addInitScript(() => {
+      const held: Array<() => void> = [];
+      const started = Promise.withResolvers<void>();
+      let delaying = true;
+      const send = WebSocket.prototype.send;
+      WebSocket.prototype.send = function (this: WebSocket, data) {
+        if (!delaying || typeof data !== "string") return send.call(this, data);
+        const parsed = JSON.parse(data);
+        const messages = [parsed].flat();
+        const isProbe = (message: { _tag?: string; tag?: string }) =>
+          message?._tag === "Request" && message.tag === "device.testHost";
+        if (!messages.some(isProbe)) return send.call(this, data);
+        const probes = messages.filter(isProbe);
+        const other = messages.filter((message) => !isProbe(message));
+        if (other.length) send.call(this, JSON.stringify(other));
+        held.push(() => send.call(this, Array.isArray(parsed) ? JSON.stringify(probes) : data));
+        started.resolve();
+      };
+      window.deviceHostProbeGate = {
+        started: started.promise,
+        release: () => {
+          delaying = false;
+          for (const release of held.splice(0)) release();
+        },
+      };
+    });
+
+    await t3.open(`/settings/devices?machine=${encodeURIComponent(environment)}#device-sources`);
+    const more = browser.locator("#device-sources").getByRole("button", "More", { exact: true });
+    const testConnection = screen.getByRole("menuitem", "Test connection", { exact: true });
+    const pending = screen.getByText("Testing connection", { exact: true });
+    try {
+      await more.tap();
+      await testConnection.tap();
+      await pending.waitFor();
+      await browser.evaluate(async () => {
+        await window.deviceHostProbeGate!.started;
+        return null;
+      });
+      if (await more.isEnabled()) {
+        await more.tap();
+        await screen.getByRole("menu").waitFor();
+        if ((await testConnection.isVisible()) && (await testConnection.isEnabled())) {
+          await testConnection.tap();
+          await testConnection.waitFor({ state: "hidden" });
+        } else {
+          await browser.keyboard.press("Escape");
+        }
+      }
+
+      await app.screenshot("second-connection-check");
+      expect(await pending.isVisible(), "The SSH connection check still shows as pending").toBe(
+        true,
+      );
+    } finally {
+      await browser.evaluate(() => {
+        window.deviceHostProbeGate?.release();
+        return null;
+      });
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions