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.
This commit is contained in:
pr-eval
2026-07-22 20:53:17 +02:00
committed by can1357
parent b6674731a0
commit ab8e36fa6c
@@ -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);