Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

test(cli): identify web MCP wiring independently of home paths (#859)

Dee595232f718c7
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.ts
index ff47057e9..71c68f05d 100644
--- a/cli/src/lib/gridLaunch.spec.ts
+++ b/cli/src/lib/gridLaunch.spec.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
import {
anthropicBaseUrl,
buildGridEngineLaunch,
@@ -880,23 +880,29 @@ describe('web search status — what the app is told about the launch it got', (
}
})
- it('says on exactly when the launch it describes names the server — for every engine, both machines', () => {
- // "The engine wired it" is not taken on trust from the contract that reports it: the launch
- // either carries the `harness` server (in argv or in a file it writes) or it does not, and the
- // status must agree with that. A future contract that took a url and forgot to wire it, or
- // wired it and reported otherwise, fails here.
- const names = (launch: ReturnType<typeof launchOf>): string =>
- [...launch.args, ...(launch.configDir?.files.map((f) => f.content) ?? [])].join('\n')
- for (const machine of [PLAIN_MACHINE, { hermesSystemManaged: true }]) {
- for (const engine of gridCapableEngines()) {
- for (const override of [WITH_MCP, WITH_MODEL]) {
- const built = buildGridEngineLaunch(engine, override, machine)
- if (!built.ok) continue // copilot without a model — refused, nothing to describe
- const wired = names(built.launch).includes('harness')
- expect(built.launch.webSearch === 'on', `${engine} · mcpUrl ${!!override.mcpUrl} · pinned ${machine.hermesSystemManaged}`)
- .toBe(wired)
+ it.each(['/fixture/qa-home', '/fixture/harness-home'])('says on exactly when the launch it describes names the server — for every engine, both machines, home %s', (fixtureHome) => {
+ // Found by QA on a quiet machine: a home containing "harness" made Pi's skills path look like MCP wiring.
+ vi.stubEnv('HOME', fixtureHome)
+ try {
+ // "The engine wired it" is not taken on trust from the contract that reports it: the launch
+ // either carries the MCP endpoint (in argv or in a file it writes) or it does not, and the
+ // status must agree with that. A future contract that took a url and forgot to wire it, or
+ // wired it and reported otherwise, fails here.
+ const launchContent = (launch: ReturnType<typeof launchOf>): string =>
+ [...launch.args, ...(launch.configDir?.files.map((f) => f.content) ?? [])].join('\n')
+ for (const machine of [PLAIN_MACHINE, { hermesSystemManaged: true }]) {
+ for (const engine of gridCapableEngines()) {
+ for (const override of [WITH_MCP, WITH_MODEL]) {
+ const built = buildGridEngineLaunch(engine, override, machine)
+ if (!built.ok) continue // copilot without a model — refused, nothing to describe
+ const wired = launchContent(built.launch).includes(MCP_URL)
+ expect(built.launch.webSearch === 'on', `${engine} · mcpUrl ${!!override.mcpUrl} · pinned ${machine.hermesSystemManaged}`)
+ .toBe(wired)
+ }
}
}
+ } finally {
+ vi.unstubAllEnvs()
}
})
})