From 04e0501480334784d1a986d02a2cbbb3ccb9465d Mon Sep 17 00:00:00 2001 From: bompus Date: Tue, 27 Oct 2026 20:53:31 -0600 Subject: [PATCH] tests: give the daemon registry/handover suites the lookup allowance Both flaked on Windows CI (unverified vs not-running; a 44s handover timeout): a loaded runner's PowerShell can exceed the 5 s production lookup timeout, and a timed-out probe has no command line to classify. daemon-lock-holder.test.ts already sets 60 s; extend the same env to the two suites that lacked it. --- __tests__/daemon-registry.test.ts | 18 +++++++++++++++++- __tests__/mcp-daemon.test.ts | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/__tests__/daemon-registry.test.ts b/__tests__/daemon-registry.test.ts index f430983a8f..be47f79b4d 100644 --- a/__tests__/daemon-registry.test.ts +++ b/__tests__/daemon-registry.test.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, beforeEach, afterEach, onTestFinished, vi } from 'vitest'; +import { describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, onTestFinished, vi } from 'vitest'; import { execFileSync, spawn } from 'child_process'; import * as fs from 'fs'; import * as net from 'net'; @@ -60,6 +60,22 @@ function startDetachedProcess(): number { return pid; } +/** + * Same allowance daemon-lock-holder.test.ts makes: each OS lookup gets a + * minute, not the 5 s production default — on a loaded runner PowerShell can + * take longer to start, and a timed-out Windows lookup returns no command + * line, flipping 'not-running' verdicts to 'unverified'. + */ +const LOOKUP_ENV = 'CODEGRAPH_PROCESS_LOOKUP_TIMEOUT_MS'; +const savedLookupTimeout = process.env[LOOKUP_ENV]; +beforeAll(() => { + process.env[LOOKUP_ENV] = '60000'; +}); +afterAll(() => { + if (savedLookupTimeout === undefined) delete process.env[LOOKUP_ENV]; + else process.env[LOOKUP_ENV] = savedLookupTimeout; +}); + describe('daemon-registry', () => { let tmpHome: string; let prevHome: string | undefined; diff --git a/__tests__/mcp-daemon.test.ts b/__tests__/mcp-daemon.test.ts index 6fc3cec738..8be3edfd62 100644 --- a/__tests__/mcp-daemon.test.ts +++ b/__tests__/mcp-daemon.test.ts @@ -32,7 +32,7 @@ * end is itself the proof the canonicalization works. */ -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'; import { ChildProcessWithoutNullStreams, spawn } from 'child_process'; import * as fs from 'fs'; import * as net from 'net'; @@ -265,6 +265,21 @@ async function staleIndex(root: string): Promise { return before; } +/** + * Same allowance daemon-lock-holder.test.ts makes: each OS lookup gets a + * minute, not the 5 s production default — on a loaded runner PowerShell can + * take longer to start, and lookups time out while handovers wait on them. + */ +const LOOKUP_ENV = 'CODEGRAPH_PROCESS_LOOKUP_TIMEOUT_MS'; +const savedLookupTimeout = process.env[LOOKUP_ENV]; +beforeAll(() => { + process.env[LOOKUP_ENV] = '60000'; +}); +afterAll(() => { + if (savedLookupTimeout === undefined) delete process.env[LOOKUP_ENV]; + else process.env[LOOKUP_ENV] = savedLookupTimeout; +}); + describe('Shared MCP daemon (issue #411)', () => { let tempDir: string; // the (possibly symlinked) path processes are spawned with let realRoot: string; // its canonical form — what the daemon keys paths on