Skip to content

fix(srp): resolve bash via PATH so adapters run on Windows - #137

Merged
danielvm-git merged 1 commit into
danielvm-git:mainfrom
panesofglass:fix/windows-adapter-bash-resolution
Oct 25, 2026
Merged

danielvm-git merged 1 commit into
danielvm-git:mainfrom
panesofglass:fix/windows-adapter-bash-resolution

Conversation

@panesofglass

Copy link
Copy Markdown
Contributor

Fixes #136.

What / why

scripts/lib/srp-engine.py dispatches adapters with subprocess.Popen(['bash', adapter_path], ...). On Windows the CreateProcess search order checks C:\Windows\System32 before PATH, so it finds System32\bash.exe — the WSL launcher stub — even when the host has no WSL distribution installed. The stub prints Windows Subsystem for Linux has no installed distributions and exits 1, aborting distribution for every adapter (Error: adapter agy failed with exit code 1). On a Windows host without WSL, bare bash falls through to Git Bash and the same command works, which is why the failure is machine-dependent.

Resolve the interpreter through PATH rather than relying on CreateProcess:

def resolve_bash():
    return os.environ.get("BIGPOWERS_BASH") or shutil.which("bash") or "bash"

BIGPOWERS_BASH is an explicit override; the bare name is a last-resort fallback preserving prior behavior.

Changes

  • scripts/lib/srp-engine.py — add resolve_bash(); dispatch_to_adapter passes the resolved path to Popen.
  • tests/test_srp_engine.py — unit tests for resolve_bash() (env override, PATH resolution, fallback) and for dispatch passing the resolved path to Popen.

How to verify

python3 tests/test_srp_engine.py -v     # 24 tests, OK
bash tests/test-srp-engine.sh           # PASS

Before the fix on a WSL-stub host, python3 scripts/lib/srp-engine.py skills/<skill>/SKILL.md --target cursor exits 1 with the WSL message; after it exits 0 and writes the target artifact.

Notes

Independent of #135 (Windows symlink fallback): #135 changes scripts/lib/install-helpers.js, this changes scripts/lib/srp-engine.py, so the two can land in either order without conflict.

subprocess(['bash', ...]) on Windows goes through the CreateProcess
search order, which checks C:\Windows\System32 before PATH. On a host
with the WSL launcher but no installed distro that finds the stub
(System32\bash.exe), aborts with 'Windows Subsystem for Linux has no
installed distributions', and every adapter dispatch fails (agy first,
alphabetically). Resolve bash with shutil.which() so Git Bash is used,
with BIGPOWERS_BASH as an override and a bare-name fallback.

Adds unit coverage for resolve_bash() and for dispatch passing the
resolved path to Popen.

(cherry picked from commit 7daaddfeeca4d6a3e3f85631b3c91c9c9707fc1c)
@danielvm-git

Copy link
Copy Markdown
Owner

The resolve_bash() + BIGPOWERS_BASH escape hatch is a clean, safe fix. The root cause explanation (CreateProcess search order vs PATH) is exactly the kind of investigation note that saves the next person 30 minutes. Thank you.

@danielvm-git
danielvm-git merged commit c89f4f5 into danielvm-git:main Oct 25, 2026
github-actions Bot pushed a commit that referenced this pull request Oct 25, 2026
## [2.88.10](v2.88.9...v2.88.10) (2026-10-25)

### Bug Fixes

* **install:** support Windows without symlink privilege ([#135](#135)) ([c47e3c5](c47e3c5)), closes [#134](#134)
* **srp:** resolve bash via PATH so adapters run on Windows ([#137](#137)) ([c89f4f5](c89f4f5))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.88.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

danielvm-git added a commit that referenced this pull request Oct 25, 2026
Fixes #138.

before: 1,539 bash + ~4,600 jq  →  after: 19 bash + 0 jq

Rebased on top of fix/srp-engine-bash-path (#137): render_all() uses
resolve_bash() rather than inlining the same PATH-resolution logic.

Co-authored-by: panesofglass <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Oct 25, 2026
## [2.88.11](v2.88.10...v2.88.11) (2026-10-25)

### Bug Fixes

* **guard:** resolve git branch per command target, not process cwd ([#154](#154)) ([07c7498](07c7498))
* **lockfile:** add missing slash in skill path + self-contained resolve_repo_root ([#156](#156)) ([04bda15](04bda15))
* **omp-hooks:** inGitRepo bail-early, accept type!(scope) form, echo subject ([#157](#157)) ([9e1b11a](9e1b11a)), closes [#147](#147) [#151](#151) [#151](#151)

### Performance Improvements

* **sync:** render all skills in one bash process per adapter ([#155](#155)) ([1b56463](1b56463)), closes [#137](#137)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: setup aborts at adapter dispatch — bare bash resolves to the WSL launcher stub, not Git Bash

2 participants