From ab8e36fa6c4bfdfe39ad388b6f6519cf6f26c4f1 Mon Sep 17 00:00:00 2001 From: pr-eval Date: Wed, 22 Jul 2026 20:53:17 +0200 Subject: [PATCH] test(coding-agent): make prewalk no-auth test independent of runner env keys hasAuth() consults $HOME/.env via getEnvApiKey, so a CEREBRAS_API_KEY in the runner's home .env legitimately armed prewalk and failed the no-auth case. Force the condition with a hasConfiguredAuth spy. --- .../coding-agent/test/prewalk-startup-degradation.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/test/prewalk-startup-degradation.test.ts b/packages/coding-agent/test/prewalk-startup-degradation.test.ts index 4b7ad18d0..d741051f8 100644 --- a/packages/coding-agent/test/prewalk-startup-degradation.test.ts +++ b/packages/coding-agent/test/prewalk-startup-degradation.test.ts @@ -41,9 +41,13 @@ describe("prewalk startup degradation", () => { test("leaves prewalk unarmed instead of crashing when the target has no configured auth", async () => { const settings = Settings.isolated(); settings.set("prewalk.enabled", true); - // smol role points at a provider that has NO configured API key. settings.setModelRole("smol", "cerebras/zai-glm-4.7"); const { modelRegistry } = await newRegistry("no-auth"); + // Force the no-auth condition: hasAuth() also consults $HOME/.env via + // getEnvApiKey (packages/utils/src/env.ts), so a CEREBRAS_API_KEY in the + // runner's home .env would otherwise legitimately arm prewalk and make + // this test environment-dependent. + vi.spyOn(modelRegistry, "hasConfiguredAuth").mockReturnValue(false); const options = await buildSessionOptions(parseArgs([]), [], SessionManager.inMemory(), modelRegistry, settings);