From 16dc57c3ca16d11c6dedf0ad422d4e9b7a6e820f Mon Sep 17 00:00:00 2001 From: arthurbm Date: Mon, 16 Mar 2026 09:06:24 -0300 Subject: [PATCH] fix: enable fixPath() on Linux and call it before health check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Linux (AppImage), the Codex CLI health check always fails with "not installed or not on PATH" because: 1. fixPath() guards with `platform !== "darwin"`, skipping Linux entirely 2. In the server, fixPath() runs inside Effect.gen (after Layer construction), but ProviderHealthLive fires during Layer construction Change the guard to `=== "win32"` so Linux gets PATH normalization, and call fixPath() at module top-level in the server — mirroring apps/desktop/src/main.ts which already does this correctly. --- apps/desktop/src/syncShellEnvironment.ts | 2 +- apps/server/src/main.ts | 5 +++++ apps/server/src/os-jank.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/syncShellEnvironment.ts b/apps/desktop/src/syncShellEnvironment.ts index 2181bea0c..921120ff3 100644 --- a/apps/desktop/src/syncShellEnvironment.ts +++ b/apps/desktop/src/syncShellEnvironment.ts @@ -7,7 +7,7 @@ export function syncShellEnvironment( readEnvironment?: ShellEnvironmentReader; } = {}, ): void { - if ((options.platform ?? process.platform) !== "darwin") return; + if ((options.platform ?? process.platform) === "win32") return; try { const shell = env.SHELL ?? "/bin/zsh"; diff --git a/apps/server/src/main.ts b/apps/server/src/main.ts index 0a33be0cb..d8b5fa0f5 100644 --- a/apps/server/src/main.ts +++ b/apps/server/src/main.ts @@ -18,6 +18,11 @@ import { } from "./config"; import { fixPath, resolveStateDir } from "./os-jank"; import { Open } from "./open"; + +// Fix PATH eagerly before any Layer construction so that CLI probes +// (e.g. ProviderHealthLive → `codex --version`) can find binaries +// installed via version managers (nvm, bun, etc.). +fixPath(); import * as SqlitePersistence from "./persistence/Layers/Sqlite"; import { makeServerProviderLayer, makeServerRuntimeServicesLayer } from "./serverLayers"; import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery"; diff --git a/apps/server/src/os-jank.ts b/apps/server/src/os-jank.ts index 586aca6f7..4dbd21ff4 100644 --- a/apps/server/src/os-jank.ts +++ b/apps/server/src/os-jank.ts @@ -3,7 +3,7 @@ import { Effect, Path } from "effect"; import { readPathFromLoginShell } from "@t3tools/shared/shell"; export function fixPath(): void { - if (process.platform !== "darwin") return; + if (process.platform === "win32") return; try { const shell = process.env.SHELL ?? "/bin/zsh";