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.

An engine launch looks past a search-path folder the account may not enter

bitcoinbuildera9008dfcf098
diff --git a/cli/src/engines/kit/launchExecutable.spec.ts b/cli/src/engines/kit/launchExecutable.spec.ts
index 609d1d2dd..b246c7303 100644
--- a/cli/src/engines/kit/launchExecutable.spec.ts
+++ b/cli/src/engines/kit/launchExecutable.spec.ts
@@ -33,6 +33,21 @@ it('distinguishes complete absence from inaccessible or ambiguous candidates', a
vi.stubEnv('PATH', 'relative')
expect(await captureLaunchExecutable('opencode', '')).toMatchObject({ state: 'held' })
})
+it('looks past a search-path folder this account may not enter, and still never installs with nothing found after it', async () => {
+ // A Harness Team account: Homebrew's bin is on every account's PATH (/etc/paths.d/homebrew), its owner's alone (770).
+ // The folder beside Harness's Node is left out: it is the machine's own, and could hold a real engine.
+ vi.doMock('../../lib/engineLaunch.js', async (actual) => ({ ...await actual<object>(), npmRuntimeBins: () => [] }))
+ const { bin, captureLaunchExecutable } = await fixture()
+ vi.doUnmock('../../lib/engineLaunch.js')
+ const locked = join(root, 'locked'); mkdirSync(locked); writeFileSync(join(locked, 'opencode'), 'theirs', { mode: 0o700 }); chmodSync(locked, 0o000)
+ try {
+ vi.stubEnv('PATH', [locked, bin].join(':'))
+ // Nothing it can run after it: held, never installed over what the locked folder may hold.
+ expect(await captureLaunchExecutable('opencode', '')).toMatchObject({ state: 'held', detail: 'Waiting to confirm access to the selected engine executable.' })
+ const file = join(bin, 'opencode'); writeFileSync(file, 'its own', { mode: 0o700 })
+ expect(await captureLaunchExecutable('opencode', '')).toMatchObject({ state: 'ready', executable: { command: file } })
+ } finally { chmodSync(locked, 0o700) }
+})
it('searches the absolute folders of a PATH that also lists what is not one', async () => {
// The login PATH of a Mac with the .NET SDK: `~/.dotnet/tools`, unexpanded. An empty entry and `.` are as common.
const { bin, captureLaunchExecutable } = await fixture()
diff --git a/cli/src/engines/kit/launchExecutable.ts b/cli/src/engines/kit/launchExecutable.ts
index 83b52e0e3..c47d3d6ad 100644
--- a/cli/src/engines/kit/launchExecutable.ts
+++ b/cli/src/engines/kit/launchExecutable.ts
@@ -121,6 +121,9 @@ export async function captureLaunchExecutable(engine: AgentEngine, shell?: strin
// `npm prefix -g` names it). Looking only here, a Codex in that folder was "missing": every launch dispatched
// an installer that found it and exited 0 without a word, and the next launch dispatched another (2026-10-19).
if (recipe?.executable.npmGlobal) candidates.push(...npmRuntimeBins().flatMap(bin => recipe.executable.names.map(name => join(bin, name))))
+ // A candidate this account may not reach. Looked past, for a later one it can run; with none, held as before rather
+ // than installing over what may be there.
+ let unreachable = false
for (const path of [...new Set(candidates.flatMap(windowsPrograms))]) {
try {
const info = statSync(path)
@@ -150,12 +153,19 @@ export async function captureLaunchExecutable(engine: AgentEngine, shell?: strin
} catch { return held('Waiting to confirm the engine search path and its aliases.') }
continue
}
+ // A folder on the search path that this account may not enter, or a file it may not run, hides nothing it could
+ // run: every account's PATH has Homebrew's bin (/etc/paths.d/homebrew), and a Harness Team account on a Mac whose
+ // Homebrew is its owner's alone (mode 770) held every Claude Code launch here for good, its own Claude Code in
+ // ~/.local/bin never reached (2026-10-27).
+ const code = (error as NodeJS.ErrnoException).code
+ if (code === 'EACCES' || code === 'EPERM') { unreachable = true; continue }
return held('Waiting to confirm access to the selected engine executable.')
}
const executable = executableSnapshot(nativeVersionProbe({ args: [], output: /^$/, timeoutMs: 5_000 }, () => path))
if (!executable) return held('Waiting for the selected engine executable to stop changing.')
return { state: 'ready', executable, environment: withNodeForScript(path, environment) }
}
+ if (unreachable) return held('Waiting to confirm access to the selected engine executable.')
return recipe ? { state: 'install', recipe, environment: environment as Record<string, string> } : held('Waiting for the configured engine executable to become available.')
}