Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: isolate inherited env from AI CLI children

[._.]/ Adam Eivy5ae3ae6c8fd1
diff --git a/server/lib/README.md b/server/lib/README.md
index 947fc07f35..5def0a4a4a 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -155,7 +155,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `opencodeStream.js` | OpenCode's `--format json` event stream — ONE parser, shared by `services/localModelAgentBenchmark.js` (which wants chars/tokens) and `services/modelCapabilityTests.js` (which wants a readable transcript). `eventPart` (accepts the flat `{part}` and nested `{properties.part}` envelopes OpenCode has both used), `isToolEvent` / `eventText`, `parseAgentLine` / `parseAgentEvents` (blank and unparsable lines yield nothing rather than throwing), `formatAgentEvent` (one frame → a transcript line a person can read, with the path or command the tool acted on), and `summarizeOpenCodeEvents` (assistant chars, tool calls, and output tokens — `null`, never 0, when OpenCode reported no usage; tool ARGUMENTS are deliberately not counted as answer text). Pure. The runner that produces the stream is `services/opencodeTask.js`. |
| `openAiModelsProbe.js` | `probeOpenAiModels(baseUrl, { timeoutMs, apiKey })` → `{ reachable, models, error }` — the one `GET {base}/models` probe for the local OpenAI-compatible daemons, shared by `services/providerReadiness.js` and `services/llamaServerManager.js`. Distinguishes unreachable from reachable-but-unlistable (`models: null`) from up-with-nothing-loaded (`[]`), names the real transport failure via `describeFetchError` (undici reports every one as a bare `fetch failed`), and cancels an unread body on a non-OK response. `apiKey` attaches a Bearer header for a key-gated daemon (vLLM's compose stack), and a 401/403 answers `reachable: true` with `error: 'authentication required'` — a server that refused the request is definitively running, and calling it unreachable would send the user to start it again. Consolidated after the two copies drifted — one passed its timeout as a `timeout` key inside the fetch init object, where it is not an option, silently running a 500ms poll loop on the 15s default. |
| `openAiChatStream.js` | `streamOpenAiChat({ endpoint, apiKey, model, messages, temperature, maxTokens, extraBody, signal, onChunk, onStats })` → the streamed text — one streaming `POST {base}/chat/completions` against any local OpenAI-compatible daemon; `streamOllamaChat(...)` is the assessment-only native `/api/chat` transport that preserves Ollama's exact eval counts and nanosecond timings. Also exports `buildMessages`, `parseStreamFrame`, `parseOllamaStreamFrame`, `normalizeUsage` (snake/camel/Ollama token-count keys → `{completionTokens, promptTokens}`, `null` = not reported), and `resolvePartialOutput`. Registering `onStats` on the OpenAI path asks for token counts; a daemon that rejects `stream_options` is retried once without it and remembered per endpoint. Sibling of `openAiModelsProbe.js`. Shared by `services/localLlmPlayground.js` (provider-backed runs with a `/runs` record) and its `runEndpointLlmTest` (a bare loopback daemon PortOS holds no provider record for, which is how `services/localModelAssessments.js` measures llama.cpp / MTPLX / vLLM). An abort mid-stream throws with `.partialOutput` carrying what already streamed. |
-| `cliChildEnv.js` | The one place the AI-CLI child environment is composed, replacing the hand-rolled copy every spawn site carried — which made each env-level fix an N-file sweep (#3194). `buildCliChildEnv({ baseEnv, before, provider, model, cwd, extra, guard })` returns a COMPLETE env for `spawn`: layers `baseEnv → before → Ollama-Claude defaults → provider.envVars → buildOpencodeEnvVars → extra`, pins `PWD` to `cwd`, strips `CLAUDECODE`, and (with `guard: true`) prepends the pm2 guard shim onto the final `PATH`. The Ollama-Claude layer raises Claude Code's default output ceiling to 65,536 tokens so a thinking-capable local model cannot finish its reasoning past the stock 32K ceiling and die before its final tool call; an explicit provider env value wins. `composeProviderEnv({ before, provider, model, extra })` returns just the ordered provider layers, for sites that build a DELTA someone else bases and spawns (the CoS runner payload, a shell-session overlay). The two slots are not interchangeable: `before` sits UNDER `provider.envVars` (forgeTokenEnv/claudeSettingsEnv, so a provider override still wins), `extra` sits OVER it (TERM/COLORTERM for a PTY). `cliChildEnv.test.js` asserts the composed order per call site and **discovers** any new site that hand-rolls the tuple instead of calling these — so the call-site list stays in the test, not in prose here. |
+| `cliChildEnv.js` | The one place the AI-CLI child environment is composed, replacing the hand-rolled copy every spawn site carried — which made each env-level fix an N-file sweep (#3194). `buildCliChildEnv({ baseEnv, before, provider, model, cwd, extra, guard })` returns a COMPLETE env for `spawn`: filters the inherited base to runtime essentials/provider auth, then layers `baseEnv → before → Ollama-Claude defaults → provider.envVars → buildOpencodeEnvVars → extra`, pins `PWD` to `cwd`, strips `CLAUDECODE`, and (with `guard: true`) prepends the pm2 guard shim onto the final `PATH`. The Ollama-Claude layer raises Claude Code's default output ceiling to 65,536 tokens so a thinking-capable local model cannot finish its reasoning past the stock 32K ceiling and die before its final tool call; an explicit provider env value wins. `composeProviderEnv({ before, provider, model, extra })` returns just the ordered provider layers, for sites that build a DELTA someone else bases and spawns (the CoS runner payload, a shell-session overlay). The two slots are not interchangeable: `before` sits UNDER `provider.envVars` (forgeTokenEnv/claudeSettingsEnv, so a provider override still wins), `extra` sits OVER it (TERM/COLORTERM for a PTY). `cliChildEnv.test.js` asserts the composed order per call site and **discovers** any new site that hand-rolls the tuple instead of calling these — so the call-site list stays in the test, not in prose here. |
| `cliProviderArgs.js` | Per-CLI argv conventions (`buildCliArgs`) for stdin prompt delivery — dependency-light extraction from runner.js so out-of-process callers (autofixer) can import it. |
| `cliProviderRun.js` | One-shot CLI provider invocation (`pickCliProvider` + `runCliProviderPrompt`) — lightweight path for the autofixer + calendar MCP sync to honor the configured provider/model. |
| `codex.js` | OpenAI Codex CLI (`codex`) provider helpers — the `CODEX_COMMAND`/`CODEX_CLI_ID` constants, the `isCodexCommand` predicate, and `ensureCodexTuiArgs` (injects `--dangerously-bypass-approvals-and-sandbox` + disables the startup update-check config, skipped when the argv already declares an approval/sandbox posture via `argvHasFlag`). Extracted from `tuiHandshake.js` (#3618) to match the one-file-per-vendor shape of `antigravity.js`/`grok.js`/`kimi.js`/`cursor.js`, which `providerVendors.js` consumes as registry rows. |
@@ -250,7 +250,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `githubRepoUrl.js` | `parseGitHubUrl(url)` → `{ owner, repo }` / `isGitHubRepoUrl(url)` — authoritative "is this a clonable GitHub repo URL?" rule, re-exported by `services/githubCloner.js`. Mirrored to `client/src/lib/githubRepoUrl.js` (parity pinned by `githubRepoUrl.mirror.test.js`) so the Brain capture boxes reveal the post-clone agent options for exactly the URLs the server will clone. |
| `glabArgs.js` | `GLAB_JSON_ARGS`, `withGlabJson(args)` — pure `glab` argv conventions. The JSON output flag is `--output json`, NOT `-F json`: on `glab issue list` (and only there) `-F` is `--output-format` (details/ids/urls), so `-F json` is accepted, ignored, and answers with the human table at exit 0. Shared by all three `glab` runners so the spelling has one definition; guarded tree-wide by `services/gitlab.glabFlags.test.js`. |
| `killWithEscalation.js` | `killWithEscalation(proc, {label, stillRunning, delayMs=8000})` — shared SIGTERM→grace→SIGKILL cancel-escalation for spawn-based media jobs. Sends SIGTERM, then escalates to SIGKILL after `delayMs` only when `stillRunning()` holds and the child hasn't exited (`exitCode===null && signalCode===null`). The timer is unref'd and the callback is try/catch-wrapped (runs outside the request lifecycle). Converges musicVideo/render, videoTimeline, imageGen local+codex, videoGen, loraTraining, and the yt-dlp track import cancel paths. |
-| `processEnv.js` | `stripDebugMallocEnv(env)` / `safeChildProcessEnv(extra)` — drop macOS `Malloc*` debug env vars before spawning a child. `safeChildProcessOptions(options)` adds that sanitized environment plus `windowsHide: true`, preventing detached PM2 subprocesses from opening transient Windows console UI; route Node→Python and other background CLI spawns through it. Also `whichFirst(name)` — first-hit `which`/`where` PATH probe (safe options, 5s timeout) returning the absolute binary path or `null`; `whichFirstSync(name)` provides the same contract without the await; `findCommandOnPath(name, { env, cwd })` resolves an executable from the exact child environment without needing `which` itself on that PATH. |
+| `processEnv.js` | `stripDebugMallocEnv(env)` / `safeChildProcessEnv(extra)` — drop macOS `Malloc*` debug env vars before spawning a child. `safeChildProcessOptions(options)` adds that sanitized environment plus `windowsHide: true`, preventing detached PM2 subprocesses from opening transient Windows console UI; `buildSafeCliBaseEnv(env)` allowlists runtime essentials and provider auth before an AI CLI inherits the server environment. Route Node→Python and other background CLI spawns through the process helpers. Also `whichFirst(name)` — first-hit `which`/`where` PATH probe (safe options, 5s timeout) returning the absolute binary path or `null`; `whichFirstSync(name)` provides the same contract without the await; `findCommandOnPath(name, { env, cwd })` resolves an executable from the exact child environment without needing `which` itself on that PATH. |
| `branchUpstreamGuard.js` | `enforceSafeBranchUpstream(repo, branch)` / `readBranchUpstream` / `isSafeBranchUpstream` — the agent-branch upstream invariant (#4172): a branch handed to a CoS agent tracks either NOTHING or its OWN ref, never `refs/heads/main`. `git worktree add -b <b> <path> origin/main` does not leave the branch untracked — `branch.autoSetupMerge` records `merge=refs/heads/main` — and `/do:pr` derives its push destination from that config (`git push <remote> HEAD:<merge>`), so the agent's work lands straight on the default branch with no PR. Prevention is `--no-track` at the `worktreeManager.js` creation sites; this is the backstop that also REPAIRS branches created before the fix (drops the bogus upstream, logs it) and throws only if the repair doesn't take. Fails CLOSED: `readBranchUpstream` returns `null` for could-not-read (distinct from `''` = genuinely unset), and an unverifiable upstream is refused rather than waved through — `worktreeManager.js` undoes the `worktree add` on refusal so the throw can't strand a tree. Pairs with `primaryCheckoutGuard.js`, which catches the other way agent work reaches `main`. |
| `primaryCheckoutGuard.js` | `capturePrimaryCheckoutState(path)` / `detectPrimaryCheckoutDrift(baseline, {agentBranch})` + `PRIMARY_CHECKOUT_MUTATED_REASON`/`_CATEGORY` — the branch-jack detector (#3680): stamps the PRIMARY checkout's branch + HEAD onto a worktree agent's metadata at spawn (`agentLifecycle.js`) and re-reads it in the shared finalize path (`agentFinalization.js`), so a worktree-isolated agent that commits to the primary is recorded as a FAILURE naming the drifted branch, the commit count, and the `git reset --hard` recovery — instead of a silent "completed". Detect-and-report only: the reset discards commits, so it stays a human decision. Non-throwing (runs outside the request lifecycle); an unreadable checkout reports no drift rather than inventing one. |
| `pythonSetup.js` | Python venv / runner setup helpers. |
diff --git a/server/lib/cliChildEnv.js b/server/lib/cliChildEnv.js
index 6b929ee3f7..9334faf96b 100644
--- a/server/lib/cliChildEnv.js
+++ b/server/lib/cliChildEnv.js
@@ -45,6 +45,7 @@ import { buildOpencodeEnvVars } from './opencodeConfig.js';
import { getOpencodeLocalProviderNamespace, isClaudeCommand } from './providerModels.js';
import { isGatewayNamespace } from './providerGateways.js';
import { agentGuardEnv } from './agentGuard/index.js';
+import { buildSafeCliBaseEnv } from './processEnv.js';
// Claude Code defaults to 32K output tokens. Thinking-capable local models can
// legitimately spend more than that before returning their final tool call;
@@ -134,10 +135,9 @@ export function composeProviderEnv({ before = null, provider = null, model = nul
* is true — the pm2 guard shim prepended to the final `PATH`.
*
* @param {object} options
- * @param {NodeJS.ProcessEnv|object} [options.baseEnv=process.env] - env to start
- * from. Callers that must not leak host credentials to an autonomous agent
- * (e.g. the autofixer) pass a sanitized allowlist; every later layer still
- * overlays it.
+ * @param {NodeJS.ProcessEnv|object} [options.baseEnv=process.env] - env to
+ * start from. It is filtered through `buildSafeCliBaseEnv`; every later
+ * explicit layer still overlays it.
* @param {object|null} [options.before] - see `composeProviderEnv`.
* @param {object|null} [options.provider] - see `composeProviderEnv`.
* @param {string|null} [options.model] - see `composeProviderEnv`.
@@ -162,7 +162,7 @@ export function buildCliChildEnv({
guard = false,
} = {}) {
const env = withSpawnCwdEnv(
- { ...baseEnv, ...composeProviderEnv({ before, provider, model, extra }) },
+ { ...buildSafeCliBaseEnv(baseEnv), ...composeProviderEnv({ before, provider, model, extra }) },
cwd,
);
diff --git a/server/lib/cliChildEnv.test.js b/server/lib/cliChildEnv.test.js
index 3fde93b967..47a46006f5 100644
--- a/server/lib/cliChildEnv.test.js
+++ b/server/lib/cliChildEnv.test.js
@@ -26,14 +26,18 @@ const declaredMtplxModels = (env) => Object.keys(JSON.parse(env.OPENCODE_CONFIG_
describe('buildCliChildEnv — layering', () => {
it('layers baseEnv < before < provider.envVars < extra', () => {
const env = buildCliChildEnv({
- baseEnv: { WHO: 'base', FROM_BASE: '1' },
- before: { WHO: 'before', FROM_BEFORE: '1' },
- provider: { envVars: { WHO: 'provider', FROM_PROVIDER: '1' } },
- extra: { WHO: 'extra', FROM_EXTRA: '1' },
+ baseEnv: { PATH: '/base/bin', HOME: '/home/example' },
+ before: { HOME: '/before', TZ: 'before', XDG_CONFIG_HOME: '/before-config' },
+ provider: { envVars: { HOME: '/provider', TZ: 'provider', ANTHROPIC_BASE_URL: 'https://provider.example' } },
+ extra: { TZ: 'extra', LANG: 'extra' },
});
- expect(env.WHO).toBe('extra');
+ expect(env.HOME).toBe('/provider');
+ expect(env.TZ).toBe('extra');
+ expect(env.LANG).toBe('extra');
// Every layer still contributes its own non-conflicting keys.
- expect(env).toMatchObject({ FROM_BASE: '1', FROM_BEFORE: '1', FROM_PROVIDER: '1', FROM_EXTRA: '1' });
+ expect(env.PATH).toBe('/base/bin');
+ expect(env.XDG_CONFIG_HOME).toBe('/before-config');
+ expect(env.ANTHROPIC_BASE_URL).toBe('https://provider.example');
});
// The `before` slot exists specifically so agentCliSpawning's forgeTokenEnv
@@ -79,7 +83,22 @@ describe('buildCliChildEnv — layering', () => {
});
it('tolerates an absent provider / before / extra', () => {
- expect(buildCliChildEnv({ baseEnv: { A: '1' }, provider: null, before: null, extra: null })).toEqual({ A: '1' });
+ expect(buildCliChildEnv({ baseEnv: { PATH: '/usr/bin' }, provider: null, before: null, extra: null })).toEqual({ PATH: '/usr/bin' });
+ });
+
+ it('filters unrelated inherited app variables before applying explicit overlays', () => {
+ const env = buildCliChildEnv({
+ baseEnv: {
+ PATH: '/usr/bin',
+ GH_TOKEN: 'ambient-owner-token',
+ PRIVATE_APP_AUTH_KEYS: 'must-not-forward',
+ },
+ before: { GH_TOKEN: 'owner-token' },
+ provider: { envVars: { PRIVATE_PROVIDER_TOKEN: 'explicit-provider-token' } },
+ });
+ expect(env.PRIVATE_APP_AUTH_KEYS).toBeUndefined();
+ expect(env.GH_TOKEN).toBe('owner-token');
+ expect(env.PRIVATE_PROVIDER_TOKEN).toBe('explicit-provider-token');
});
it('defaults baseEnv to process.env', () => {
@@ -263,7 +282,7 @@ describe('composeProviderEnv — delta for sites that do not spawn directly', ()
// have silently changed two of them — these pin the actual contracts.
describe('buildCliChildEnv — per-call-site composition', () => {
it('runner.js / cliProviderRun.js: provider.envVars over baseEnv, guarded only for the runner', () => {
- const args = { baseEnv: { A: 'base', PATH: '/usr/bin' }, provider: { envVars: { A: 'provider' } }, cwd: '/w' };
+ const args = { baseEnv: { PATH: '/usr/bin' }, provider: { envVars: { A: 'provider' } }, cwd: '/w' };
expect(buildCliChildEnv({ ...args, guard: true }).A).toBe('provider');
expect(buildCliChildEnv({ ...args, guard: true }).PATH).toContain(AGENT_GUARD_BIN);
// The fire-and-collect path is not an agent — it must stay unguarded.
diff --git a/server/lib/cliProviderRun.js b/server/lib/cliProviderRun.js
index 32777b7105..cf5e1f286f 100644
--- a/server/lib/cliProviderRun.js
+++ b/server/lib/cliProviderRun.js
@@ -74,7 +74,7 @@ export function pickCliProvider(providers, config = {}) {
* @param {string[]} [args.extraArgs] - extra argv appended after the built args (e.g. `--allowedTools …`)
* @param {number} [args.timeoutMs] - SIGTERM after this many ms (default 300000)
* @param {(chunk: string, stream: 'stdout'|'stderr') => void} [args.onData] - live output callback
- * @param {NodeJS.ProcessEnv} [args.baseEnv] - base env for the child (default process.env). Callers that must NOT leak host credentials to an autonomous agent (e.g. the autofixer) pass a sanitized allowlist here; provider.envVars still overlays it.
+ * @param {NodeJS.ProcessEnv} [args.baseEnv] - base env for the child (default process.env); the shared child-env composer filters inherited variables. Explicit provider.envVars still overlays it.
* @returns {Promise<{ text: string, exitCode: number, stderr: string } | { error: string, exitCode?: number, stderr?: string }>}
*/
export function runCliProviderPrompt(args = {}) {
diff --git a/server/lib/processEnv.js b/server/lib/processEnv.js
index 88be91921b..7736c05867 100644
--- a/server/lib/processEnv.js
+++ b/server/lib/processEnv.js
@@ -36,6 +36,46 @@ export function safeChildProcessOptions(options = {}) {
return { ...rest, env: stripDebugMallocEnv(env), windowsHide: true };
}
+// AI CLIs need the host's runtime essentials and provider authentication, but
+// they do not need the rest of the server's ambient environment. Keeping this
+// list here makes the boundary reusable by direct and durable agent spawns;
+// explicit provider.envVars / before overlays remain available for configured
+// credentials and per-run settings.
+const SAFE_CLI_BASE_ENV_KEYS = new Set([
+ 'PATH', 'Path', 'HOME', 'USER', 'LOGNAME', 'SHELL', 'PWD', 'TMPDIR', 'TMP', 'TEMP',
+ 'LANG', 'LANGUAGE', 'TERM', 'COLORTERM', 'TZ', 'HOSTNAME', 'NODE', 'NODE_ENV', 'NODE_PATH',
+ 'NVM_DIR', 'NVM_BIN', 'XDG_CONFIG_HOME', 'XDG_CACHE_HOME', 'XDG_DATA_HOME',
+ 'SSL_CERT_FILE', 'SSL_CERT_DIR', 'EDITOR', 'VISUAL', 'PORTOS_REAL_PM2',
+ 'SystemRoot', 'SystemDrive', 'ComSpec', 'PATHEXT', 'USERPROFILE', 'APPDATA',
+ 'LOCALAPPDATA', 'ProgramData', 'ProgramFiles', 'HOMEDRIVE', 'HOMEPATH',
+ 'AWS_REGION', 'AWS_DEFAULT_REGION',
+ 'ANTHROPIC_API_KEY', 'ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_BASE_URL',
+ 'CLAUDE_CODE_USE_BEDROCK', 'CLAUDE_CODE_USE_VERTEX',
+ 'OPENAI_API_KEY', 'OPENAI_BASE_URL', 'OPENAI_API_BASE',
+ 'GEMINI_API_KEY', 'GOOGLE_API_KEY', 'GOOGLE_GENAI_API_KEY',
+ 'XAI_API_KEY', 'GROK_API_KEY', 'OPENROUTER_API_KEY',
+ 'OLLAMA_HOST', 'OLLAMA_API_BASE', 'OPENCODE_CONFIG_CONTENT',
+]);
+
+const SAFE_CLI_BASE_ENV_PREFIXES = ['LC_', 'CLAUDE_CODE_', 'CLAUDE_', 'GEMINI_CLI_'];
+
+/**
+ * Keep only the environment an AI CLI needs to start and authenticate.
+ * Provider-specific values should be supplied through the explicit overlays,
+ * not inherited from the PortOS server process.
+ *
+ * @param {NodeJS.ProcessEnv|object} [env=process.env]
+ * @returns {Record<string,string>}
+ */
+export function buildSafeCliBaseEnv(env = process.env) {
+ return Object.fromEntries(
+ Object.entries(env || {}).filter(([key, value]) => value != null && (
+ SAFE_CLI_BASE_ENV_KEYS.has(key)
+ || SAFE_CLI_BASE_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))
+ )),
+ );
+}
+
// Resolve the first PATH hit for a binary via `which` (POSIX) / `where`
// (Windows) — the "is this system tool installed, and where?" probe copied
// inline across ytdlp/ffmpeg/pythonSetup/voice discovery. Returns the absolute
diff --git a/server/lib/processEnv.test.js b/server/lib/processEnv.test.js
index fa7c7c66f2..fb20dbc8b1 100644
--- a/server/lib/processEnv.test.js
+++ b/server/lib/processEnv.test.js
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { basename, dirname } from 'path';
-import { findCommandOnPath, safeChildProcessEnv, stripDebugMallocEnv, whichFirst } from './processEnv.js';
+import { buildSafeCliBaseEnv, findCommandOnPath, safeChildProcessEnv, stripDebugMallocEnv, whichFirst } from './processEnv.js';
describe('stripDebugMallocEnv', () => {
it('drops every key that starts with "Malloc"', () => {
@@ -64,6 +64,30 @@ describe('safeChildProcessEnv', () => {
});
});
+describe('buildSafeCliBaseEnv', () => {
+ it('keeps CLI essentials and provider auth while dropping unrelated app variables', () => {
+ const env = buildSafeCliBaseEnv({
+ PATH: '/usr/bin',
+ HOME: '/home/example',
+ ANTHROPIC_API_KEY: 'provider-key',
+ PRIVATE_APP_AUTH_KEYS: 'sidecar-secret',
+ PRIVATE_APP_TOKEN: 'sidecar-token',
+ });
+
+ expect(env).toEqual({
+ PATH: '/usr/bin',
+ HOME: '/home/example',
+ ANTHROPIC_API_KEY: 'provider-key',
+ });
+ });
+
+ it('does not mutate the source environment', () => {
+ const source = { PATH: '/usr/bin', PRIVATE_APP_AUTH_KEYS: 'sidecar-secret' };
+ buildSafeCliBaseEnv(source);
+ expect(source).toEqual({ PATH: '/usr/bin', PRIVATE_APP_AUTH_KEYS: 'sidecar-secret' });
+ });
+});
+
describe('whichFirst', () => {
// `node` (both `which node` and `where node`) is on PATH wherever this runs.
it('resolves an on-PATH binary to an absolute path', async () => {