From d044fde11d6f3383e5c57839d48614649beaed48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Almeida?= Date: Sun, 17 May 2026 18:54:47 +0100 Subject: [PATCH] test(e2e): wipe agentctl before F5 to assert from a fresh-install state F5 asserts that the agentctl_action probe reports "uploaded" before the first launch and "cached" after. Tests share a worker-scoped sshd container, so an earlier test in the same worker may have already primed the cache, making the "before" assertion flap. Wipe ~/.kandev/bin/agentctl + .sha256 from the container at the top of F5 so the assertion sees the documented fresh-install path. Export execInContainer so the spec can reach into the container without copying the docker-exec boilerplate. Add error_message to the listTaskSessions return type so the hostkey-rotation spec can read the field (which the backend already returns). --- apps/web/e2e/helpers/api-client.ts | 1 + apps/web/e2e/tests/ssh/test-endpoint.spec.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/apps/web/e2e/helpers/api-client.ts b/apps/web/e2e/helpers/api-client.ts index ecf4e30ec0..afe0e219cc 100644 --- a/apps/web/e2e/helpers/api-client.ts +++ b/apps/web/e2e/helpers/api-client.ts @@ -992,6 +992,7 @@ export class ApiClient { task_environment_id?: string; worktree_path?: string; worktree_branch?: string; + error_message?: string; }>; total: number; }> { diff --git a/apps/web/e2e/tests/ssh/test-endpoint.spec.ts b/apps/web/e2e/tests/ssh/test-endpoint.spec.ts index 2b6cddd9a8..e13aa5fba8 100644 --- a/apps/web/e2e/tests/ssh/test-endpoint.spec.ts +++ b/apps/web/e2e/tests/ssh/test-endpoint.spec.ts @@ -1,4 +1,5 @@ import { test, expect } from "../../fixtures/ssh-test-base"; +import { execInContainer } from "../../helpers/ssh"; /** * HTTP contract for POST /api/v1/ssh/test. The endpoint dials the host with a @@ -91,6 +92,16 @@ test.describe("ssh test-endpoint contract", () => { apiClient, seedData, }) => { + // Wipe any prior agentctl + sha256 sidecar from the per-worker container + // so the "before" probe sees a fresh-install state regardless of which + // tests ran earlier in this worker. + execInContainer(seedData.sshTarget, [ + "rm", + "-f", + "/home/kandev/.kandev/bin/agentctl", + "/home/kandev/.kandev/bin/agentctl.sha256", + ]); + // First test run: agentctl has never been uploaded, status = "uploaded". const before = await apiClient.testSSHConnection({ name: "F5-before",