Skip to content

fix: enable shell for terminal spawn on Windows#173

Merged
osolmaz merged 2 commits intoopenclaw:mainfrom
Bortlesboat:fix-windows-terminal-shell
Mar 28, 2026
Merged

fix: enable shell for terminal spawn on Windows#173
osolmaz merged 2 commits intoopenclaw:mainfrom
Bortlesboat:fix-windows-terminal-shell

Conversation

@Bortlesboat
Copy link
Copy Markdown
Contributor

Summary

  • Add shell: process.platform === "win32" to buildTerminalSpawnOptions() so terminal commands resolve from PATH on Windows
  • On Windows, child_process.spawn() without shell: true doesn't use cmd.exe for PATH resolution, causing every terminal command to fail with ENOENT
  • Linux/macOS handle this in the kernel during execve(), so shell is only enabled on Windows

Test plan

  • Added test in spawn-options.test.ts verifying shell is always a boolean
  • All existing spawn-options tests pass
  • oxlint, oxfmt, and tsc --noEmit clean
  • Verified on Windows 11 — git, node, and other PATH commands now resolve correctly

Closes #169

@osolmaz
Copy link
Copy Markdown
Contributor

osolmaz commented Mar 28, 2026

Triage result

Human attention: ⚠️ Required
Recommendation: 🏁 escalate to a human
Human decision needed: ready for human landing decision

Quick read

This PR addresses a real Windows bug in ACP terminal spawning. The targeted regression was reproduced and shown fixed, the branch is conflict-clean against origin/main, and CI is green for the current head 0635be71852d1ea0b44697908981f4cfc2e4367b.

Intent

Make ACP terminal commands work on Windows so commands like git, node, and other PATH-resolved executables run normally instead of failing with ENOENT.

Why

The underlying problem is that buildTerminalSpawnOptions() did not enable the Windows shell path needed for PATH/PATHEXT command resolution. That caused Windows terminal executions to fail even when the command existed in PATH.

Codex review

GitHub Codex review data for the current head is empty. The established local Codex review for the refreshed head reports no remaining P0/P1 issues. There is one non-blocking P2 note about case-insensitive PATH/PATHEXT override handling during terminal spawn detection, but it did not rise to a blocking safety issue for continuing.

CI/CD

The current CI workflow run 23673820556 completed successfully, and gh pr checks shows all required jobs passing: scope, Format, Typecheck, Lint, Build, Conformance Smoke, Test, and Docs. An older action_required CI run exists for superseded head 1294310ac8980e2faf212c890458deafb9fecfd9, but it is unrelated to the current branch state. Final conflict check is clean.

Recommendation

Recommendation: 🏁 escalate to a human. This is ready for human landing decision. If the remaining non-blocking P2 is acceptable to defer, the PR is in a good state to land from the current head.

Bortlesboat and others added 2 commits March 28, 2026 11:21
On Windows, Node.js child_process.spawn() without shell:true does not
use cmd.exe to resolve commands from PATH. This causes every terminal
command to fail with ENOENT. Linux/macOS kernels handle PATH resolution
during execve(), so only Windows needs the shell flag.

Closes openclaw#169
@osolmaz osolmaz force-pushed the fix-windows-terminal-shell branch from 0635be7 to d0525df Compare March 28, 2026 10:22
@osolmaz osolmaz merged commit 6e0b939 into openclaw:main Mar 28, 2026
@osolmaz
Copy link
Copy Markdown
Contributor

osolmaz commented Mar 28, 2026

Landed via temp rebase onto main.\n\n- Gate: validation completed for this repo's change scope\n- Land commit: d0525df\n- Merge commit: 6e0b939\n\nThanks @Bortlesboat!

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.

Windows: terminal commands fail with ENOENT because buildTerminalSpawnOptions lacks shell:true

2 participants