From 292fdfb7821902a005fc95629ff432d166165871 Mon Sep 17 00:00:00 2001 From: Dreamstick Date: Fri, 14 Aug 2026 00:12:15 +0530 Subject: [PATCH] fix(test): remove the duplicate WSL spy from the connect harness The connect harness installs two spies on platform.isWsl. The explicit options.isWsl spy from #8951 runs first, then the platform pin from #8984 replaces it and delegates to the captured binding, so a case that passes isWsl: true resolves to the environment instead of the option. "repairs a WSL Ollama route without requiring an auth proxy token" then takes the non-WSL branch and exits 1. Remove the pin. The explicit option supersedes it: it states the WSL decision per case instead of inferring one from the host, and it already keeps the case host-independent, which is what the pin was for. All seven suites that use the harness pass. Signed-off-by: Kushagar Garg --- test/support/connect-flow-test-harness.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/support/connect-flow-test-harness.ts b/test/support/connect-flow-test-harness.ts index bae208eaadb..0cfbc3e33ac 100644 --- a/test/support/connect-flow-test-harness.ts +++ b/test/support/connect-flow-test-harness.ts @@ -7,7 +7,6 @@ import { createRequire } from "node:module"; import { type MockInstance, vi } from "vitest"; import type { ManagedGatewayControlCompletion } from "../../src/lib/actions/sandbox/gateway-restart"; import type { SecretBoundaryRefusalReason } from "../../src/lib/actions/sandbox/hermes-secret-boundary-recovery"; -import type { WslDetectionOptions } from "../../src/lib/platform"; import type { ConfigObject } from "../../src/lib/security/credential-filter"; import type { SandboxEntry } from "../../src/lib/state/registry"; @@ -275,15 +274,6 @@ export function createConnectHarness(options: ConnectHarnessOptions = {}): Conne const probeOllamaAuthProxyHealthSpy = vi .spyOn(ollamaProxy, "probeOllamaAuthProxyHealth") .mockReturnValue({ ok: true }); - const realIsWsl = platform.isWsl as (opts?: WslDetectionOptions) => boolean; - // Pin the platform gate for every isWsl consumer the harness loads: isWsl - // answers false off Linux before it reads WSL_DISTRO_NAME, so a case that - // stubs that variable cannot reach the WSL route on a macOS contributor - // machine. With the gate pinned, the stubbed environment decides, on every - // host, and a caller's own options still win over the pin (#8868). - vi.spyOn(platform, "isWsl").mockImplementation((...args: unknown[]) => - realIsWsl({ platform: "linux", ...((args[0] as WslDetectionOptions | undefined) ?? {}) }), - ); const primaryRegistryEntry: SandboxEntry = { name: "alpha", agent: options.agentName ?? "openclaw",