From 77b8a47339a76c030876dd877c90baf4d14fa3b4 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 22 Jul 2026 21:33:03 +0100 Subject: [PATCH] test(harness): allow runtime cold start in CI Generated-By: PostHog Code Task-Id: f5d6c417-32e8-4a2b-bfdc-98f33b60c450 --- packages/harness/src/runtime.test.ts | 72 +++++++++++++++------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/packages/harness/src/runtime.test.ts b/packages/harness/src/runtime.test.ts index 1411a67363..335a50b543 100644 --- a/packages/harness/src/runtime.test.ts +++ b/packages/harness/src/runtime.test.ts @@ -23,41 +23,45 @@ afterEach(async () => { }); describe("createHarnessRuntime", () => { - it("returns a native Pi runtime with the PostHog model and named harness extensions", async () => { - vi.stubEnv("PI_OFFLINE", "1"); - const pi = await import("@earendil-works/pi-coding-agent"); - const cwd = await temporaryDirectory(); - const agentDir = await temporaryDirectory(); - - const runtime = await createHarnessRuntime({ - agentDir, - authStorage: pi.AuthStorage.inMemory(), - cwd, - sessionManager: pi.SessionManager.inMemory(cwd), - }); + it( + "returns a native Pi runtime with the PostHog model and named harness extensions", + { timeout: 15_000 }, + async () => { + vi.stubEnv("PI_OFFLINE", "1"); + const pi = await import("@earendil-works/pi-coding-agent"); + const cwd = await temporaryDirectory(); + const agentDir = await temporaryDirectory(); + + const runtime = await createHarnessRuntime({ + agentDir, + authStorage: pi.AuthStorage.inMemory(), + cwd, + sessionManager: pi.SessionManager.inMemory(cwd), + }); - try { - expect(runtime).toBeInstanceOf(pi.AgentSessionRuntime); - expect(runtime.session.model?.provider).toBe("posthog"); - expect(runtime.services.settingsManager.isProjectTrusted()).toBe(false); - expect( - runtime.services.resourceLoader - .getExtensions() - .extensions.map((extension) => extension.path), - ).toEqual( - expect.arrayContaining([ - "", - "", - "", - "", - "", - "", - ]), - ); - } finally { - await runtime.dispose(); - } - }); + try { + expect(runtime).toBeInstanceOf(pi.AgentSessionRuntime); + expect(runtime.session.model?.provider).toBe("posthog"); + expect(runtime.services.settingsManager.isProjectTrusted()).toBe(false); + expect( + runtime.services.resourceLoader + .getExtensions() + .extensions.map((extension) => extension.path), + ).toEqual( + expect.arrayContaining([ + "", + "", + "", + "", + "", + "", + ]), + ); + } finally { + await runtime.dispose(); + } + }, + ); it("keeps desktop-provided OAuth credentials in memory without touching auth.json", async () => { vi.stubEnv("PI_OFFLINE", "1");