Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(windows): skip the per-spawn codex launcher write where shared identity is gated off

review3356c88c1140
diff --git a/src/core/codex-identity-proxy.test.ts b/src/core/codex-identity-proxy.test.ts
index 8425710d5..e7b308e5a 100644
--- a/src/core/codex-identity-proxy.test.ts
+++ b/src/core/codex-identity-proxy.test.ts
@@ -114,6 +114,17 @@ describe('codex thread identity store', () => {
expect(codexLauncherPathDir('win32')).toBeNull()
})
+ it('pty-manager gates BOTH launcher sites (the per-create rewrite and the PATH prepend) on it', () => {
+ // Source-level pin: a create() is too heavy to drive here, and the docs promise "no launcher
+ // write" on Windows — the per-spawn installCodexLauncher() call used to skip the gate.
+ const src = fs.readFileSync(path.join(__dirname, 'pty-manager.ts'), 'utf8')
+ const calls = [...src.matchAll(/installCodexLauncher\(\)/g)]
+ expect(calls.length).toBe(1)
+ const before = src.slice(Math.max(0, calls[0].index! - 400), calls[0].index!)
+ expect(before).toContain('codexLauncherPathDir() !== null')
+ expect(src).toMatch(/\?\s*codexLauncherPathDir\(\)\s*:\s*null/)
+ })
+
it('round-trips a record and resolves its owning node', () => {
writeCodexThreadIdentity('thread-1', 'node-1', '/data/hook-endpoint.env', recordsRoot)
expect(resolveCodexThreadNodeIdentity('thread-1', recordsRoot)).toBe('node-1')
diff --git a/src/core/pty-manager.ts b/src/core/pty-manager.ts
index 2ff535ecf..41579a1f8 100644
--- a/src/core/pty-manager.ts
+++ b/src/core/pty-manager.ts
@@ -2696,7 +2696,14 @@ export class PtyManager {
// Rewrite the launcher on every create: it is generated, so an app upgrade must not leave an
// old copy behind. Failure is not fatal — `installCodexLauncher` answers null, the caps probe
// says "no shared identity", and the launch line the renderer already chose is the bare CLI.
- if (options.agentId && hasSharedIdentity(options.agentId as AgentId) && !options.sshRemote) {
+ // Not on Windows (`codexLauncherPathDir()` null): shared identity is gated off there, and an sh
+ // launcher nothing can resolve is a file we would only be rewriting on every codex spawn.
+ if (
+ options.agentId &&
+ hasSharedIdentity(options.agentId as AgentId) &&
+ !options.sshRemote &&
+ codexLauncherPathDir() !== null
+ ) {
installCodexLauncher()
}
// Resolved HERE rather than inside `spawnSession` because that function is synchronous. Its