Skip to content

fix(lsp): spawn + discover npm/pip language servers on native Windows#35250

Merged
teknium1 merged 3 commits into
mainfrom
hermes/hermes-d628aa9e
May 30, 2026
Merged

fix(lsp): spawn + discover npm/pip language servers on native Windows#35250
teknium1 merged 3 commits into
mainfrom
hermes/hermes-d628aa9e

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

npm-installed language servers now spawn on native Windows instead of dying with WinError 193.

Two complementary fixes, salvaged onto current main:

Both are gated on Windows; no code-path change on Linux/macOS.

Changes

  • agent/lsp/client.py: _win_wrap_cmd() static helper; _spawn() wraps .cmd/.bat under sys.platform == "win32".
  • agent/lsp/install.py: _native_binary_candidates() + Windows-aware _existing_binary(); reused for npm/pip/go install probes.
  • agent/lsp/cli.py: hermes lsp which + bash-language-server warning now go through _existing_binary().
  • tests/agent/lsp/test_install_and_lint_fixes.py: regression tests for staged .cmd wrappers and pip Scripts/*.exe linking.
  • scripts/release.py: AUTHOR_MAP entry for @tuancookiez-hub.

Validation

Before After
npm LSP spawn on Windows WinError 193 wrapped via cmd.exe /c
.exe / posix command runs runs (passthrough)
Linux/macOS unchanged unchanged
tests/agent/lsp/ 145/145 pass

Closes #34864. Supersedes #34865 and #29310 (contributor authorship preserved per-commit via rebase merge).

Infographic

lsp-windows-fixed

Sylw3ster and others added 3 commits May 30, 2026 01:44
asyncio.create_subprocess_exec cannot run .cmd/.bat files on Windows
because CreateProcess expects a valid PE executable. npm-installed LSP
servers (intelephense, typescript-language-server, etc.) ship as .cmd
shims on Windows, causing WinError 193 on spawn.

Detect .cmd/.bat extensions and wrap with cmd.exe /c before spawning.
Gated behind sys.platform == 'win32' — no code path changes elsewhere.

Fixes #34864
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-d628aa9e vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9498 on HEAD, 9498 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4925 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have labels May 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Supersedes #34865 (spawn fix) and #29310 (discovery fix). Combined salvage with contributor authorship preserved.

@teknium1 teknium1 merged commit c9e31a8 into main May 30, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-d628aa9e branch May 30, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP spawn fails on Windows with WinError 193 for npm-installed language servers

4 participants