Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Fix Codex process spawning and health checks on Windows

julius0a1233344896
diff --git a/apps/server/src/codexAppServerManager.ts b/apps/server/src/codexAppServerManager.ts
index cb50a302f..b197a07fd 100644
--- a/apps/server/src/codexAppServerManager.ts
+++ b/apps/server/src/codexAppServerManager.ts
@@ -185,6 +185,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
...(codexHomePath ? { CODEX_HOME: codexHomePath } : {}),
},
stdio: ["pipe", "pipe", "pipe"],
+ shell: process.platform === "win32",
});
const output = readline.createInterface({ input: child.stdout });
diff --git a/apps/server/src/git/Layers/CodexTextGeneration.ts b/apps/server/src/git/Layers/CodexTextGeneration.ts
index 9b5bbbf35..9a8d1d93f 100644
--- a/apps/server/src/git/Layers/CodexTextGeneration.ts
+++ b/apps/server/src/git/Layers/CodexTextGeneration.ts
@@ -224,6 +224,7 @@ const makeCodexTextGeneration = Effect.gen(function* () {
],
{
cwd,
+ shell: process.platform === "win32",
stdin: {
stream: Stream.make(new TextEncoder().encode(prompt)),
},
diff --git a/apps/server/src/open.ts b/apps/server/src/open.ts
index eff87b39b..ce16ef995 100644
--- a/apps/server/src/open.ts
+++ b/apps/server/src/open.ts
@@ -230,6 +230,7 @@ export const launchDetached = (launch: EditorLaunch) =>
child = spawn(launch.command, [...launch.args], {
detached: true,
stdio: "ignore",
+ shell: process.platform === "win32",
});
} catch (error) {
return resume(
diff --git a/apps/server/src/processRunner.ts b/apps/server/src/processRunner.ts
index 858da5ae3..75c939617 100644
--- a/apps/server/src/processRunner.ts
+++ b/apps/server/src/processRunner.ts
@@ -112,6 +112,7 @@ export async function runProcess(
cwd: options.cwd,
env: options.env,
stdio: "pipe",
+ shell: process.platform === "win32",
});
let stdout = "";
diff --git a/apps/server/src/provider/Layers/ProviderHealth.test.ts b/apps/server/src/provider/Layers/ProviderHealth.test.ts
index b75c358ba..2c8efd925 100644
--- a/apps/server/src/provider/Layers/ProviderHealth.test.ts
+++ b/apps/server/src/provider/Layers/ProviderHealth.test.ts
@@ -22,8 +22,8 @@ describe("checkProviderStatusesOnStartup", () => {
if (args.join(" ") === "--version") {
return result({ stdout: "codex 1.0.0\n" });
}
- if (args.join(" ") === "auth status --json") {
- return result({ stdout: '{"authenticated":true}\n' });
+ if (args.join(" ") === "login status") {
+ return result({ stdout: "Logged in\n" });
}
throw new Error(`Unexpected command: ${args.join(" ")}`);
});
@@ -59,7 +59,7 @@ describe("checkProviderStatusesOnStartup", () => {
if (args.join(" ") === "--version") {
return result({ stdout: "codex 1.0.0\n" });
}
- if (args.join(" ") === "auth status --json") {
+ if (args.join(" ") === "login status") {
return result({
code: 1,
stderr: "Not logged in. Run codex login.",
@@ -79,14 +79,15 @@ describe("checkProviderStatusesOnStartup", () => {
]);
});
- it("returns unauthenticated when auth probe JSON array includes authenticated=false", async () => {
+ it("returns unauthenticated when login status output includes 'not logged in'", async () => {
const status = await checkProviderStatusesOnStartup(async (_command, args) => {
if (args.join(" ") === "--version") {
return result({ stdout: "codex 1.0.0\n" });
}
- if (args.join(" ") === "auth status --json") {
+ if (args.join(" ") === "login status") {
return result({
- stdout: '[{"authenticated":false}]\n',
+ code: 1,
+ stdout: "Not logged in\n",
});
}
throw new Error(`Unexpected command: ${args.join(" ")}`);
@@ -103,41 +104,15 @@ describe("checkProviderStatusesOnStartup", () => {
]);
});
- it("returns warning when auth probe JSON array has no auth marker", async () => {
- const status = await checkProviderStatusesOnStartup(async (_command, args) => {
- if (args.join(" ") === "--version") {
- return result({ stdout: "codex 1.0.0\n" });
- }
- if (args.join(" ") === "auth status --json") {
- return result({
- code: 0,
- stdout: '[{"ok":true}]\n',
- });
- }
- throw new Error(`Unexpected command: ${args.join(" ")}`);
- });
-
- expect(status).toEqual([
- expect.objectContaining({
- provider: "codex",
- status: "warning",
- available: true,
- authStatus: "unknown",
- message:
- "Could not verify Codex authentication status from JSON output (missing auth marker).",
- }),
- ]);
- });
-
- it("returns warning when auth status command is unsupported", async () => {
+ it("returns warning when login status command is unsupported", async () => {
const status = await checkProviderStatusesOnStartup(async (_command, args) => {
if (args.join(" ") === "--version") {
return result({ stdout: "codex 1.0.0\n" });
}
- if (args.join(" ") === "auth status --json") {
+ if (args.join(" ") === "login status") {
return result({
code: 2,
- stderr: "error: unknown command 'auth'",
+ stderr: "error: unknown command 'login'",
});
}
throw new Error(`Unexpected command: ${args.join(" ")}`);
diff --git a/apps/server/src/provider/Layers/ProviderHealth.ts b/apps/server/src/provider/Layers/ProviderHealth.ts
index 3bab83f19..40d75f0af 100644
--- a/apps/server/src/provider/Layers/ProviderHealth.ts
+++ b/apps/server/src/provider/Layers/ProviderHealth.ts
@@ -223,7 +223,7 @@ async function checkCodexProviderStatus(run: CommandRunner): Promise<ServerProvi
}
try {
- const auth = await run("codex", ["auth", "status", "--json"], {
+ const auth = await run("codex", ["login", "status"], {
timeoutMs: DEFAULT_TIMEOUT_MS,
allowNonZeroExit: true,
outputMode: "truncate",
diff --git a/apps/server/src/serverLayers.ts b/apps/server/src/serverLayers.ts
index f91710ea9..cc4f13957 100644
--- a/apps/server/src/serverLayers.ts
+++ b/apps/server/src/serverLayers.ts
@@ -105,7 +105,11 @@ export function makeServerRuntimeServicesLayer() {
);
const terminalLayer = TerminalManagerLive.pipe(
- Layer.provide(typeof Bun !== "undefined" ? BunPtyAdapterLive : NodePtyAdapterLive),
+ Layer.provide(
+ typeof Bun !== "undefined" && process.platform !== "win32"
+ ? BunPtyAdapterLive
+ : NodePtyAdapterLive,
+ ),
);
const gitManagerLayer = GitManagerLive.pipe(