Skip to content

fix(workspace): launch opencode/pi from the frontend on Windows#287

Merged
luokerenx4 merged 1 commit into
masterfrom
feat/win-cli-launch
Jun 8, 2026
Merged

fix(workspace): launch opencode/pi from the frontend on Windows#287
luokerenx4 merged 1 commit into
masterfrom
feat/win-cli-launch

Conversation

@luokerenx4

Copy link
Copy Markdown
Contributor

Summary

  • Fixes: opencode/pi can't be launched from the frontend on Windows. ConPTY's CreateProcess only appends .exe when resolving a bare command name from PATH — it never tries .cmd/.bat. claude/codex ship native .exes (resolved fine, which masked the bug); opencode/pi install as npm shims (only a .cmd/.ps1 exists, no .exe) → spawned by bare name they ENOENT and the workspace never launches. Community-reported on Windows.
  • Adds resolveLaunchCommand (src/workspaces/win-command.ts): on win32, do the PATH × PATHEXT lookup ourselves — native .exe spawned directly, .cmd/.bat shim wrapped through cmd.exe /d /c. No-op off Windows.
  • Wired into both node-pty spawn sites (persistent-session interactive, probe agent-detection), where args are flags + a uuid so the shell wrap is injection-safe.
  • Headless dispatch gets the same resolution: native-exe agents (claude/codex) now run headless on win32 too. .cmd-shim agents stay headless-unsupported on Windows — the task prompt is the trailing arg and routing it through cmd.exe would re-parse shell metacharacters (a real injection surface) — but now fail with a clear, recorded reason instead of a silent ENOENT.

Test plan

  • npx tsc --noEmit clean
  • pnpm test passes (1844)
  • New win-command.spec.ts — 10 cases, deterministically drives the win32 branch (exe direct / cmd wrap / exe-preferred-over-cmd / multi-PATH / PATHEXT fallback / passthrough)
  • mac boot smoke (pnpm test:smoke) HARD checks pass
  • Real Windows launch — NOT covered by CI. The dev-smoke Windows job boots the guardian stack (tsx/pnpm shims), not workspace agent CLIs, so it neither caught this nor verifies the fix. The unit test verifies the resolution logic cross-platform but not real ConPTY spawn. Needs a manual check on a Windows box with opencode/pi installed. Follow-up option: add a real node-pty spawn assertion (temp .cmd) to the windows-latest matrix.

Boundary touch

None — workspace launcher spawn plumbing only; no trading / auth / broker / migration surface.

🤖 Generated with Claude Code

ConPTY's CreateProcess only appends `.exe` when resolving a bare command
name from PATH — it never tries `.cmd`/`.bat`. claude/codex ship native
`.exe`s and resolved fine; opencode/pi install as npm shims (only a
`.cmd`/`.ps1` exists, no `.exe`), so spawning them by bare name ENOENTed
and the workspace never launched. Reported by a community user on Windows.

Add `resolveLaunchCommand` (src/workspaces/win-command.ts): on win32, do
the PATH × PATHEXT lookup ourselves — a native `.exe` is spawned directly,
a `.cmd`/`.bat` shim is wrapped through `cmd.exe /d /c`. No-op off Windows.
Wired into both node-pty spawn sites (interactive `persistent-session`,
agent `probe`), where args are flags + a uuid so the shell wrap is
injection-safe.

Headless dispatch gets the same resolution for native-exe agents
(claude/codex now work headless on win32 too), but `.cmd`-shim agents stay
headless-unsupported on Windows: the task prompt is the trailing arg and
routing it through cmd.exe would re-parse shell metacharacters (a real
injection surface). That now fails with a clear, recorded reason instead
of a silent ENOENT — interactive launch of those agents works.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jun 8, 2026 4:58am

Request Review

@luokerenx4 luokerenx4 merged commit ba4a42d into master Jun 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant