fix(copilot): detect copilot.exe on Windows instead of assuming copilot.cmd - #4758
Open
chelsealong wants to merge 1 commit into
Open
chelsealong wants to merge 1 commit into
chelsealong wants to merge 1 commit into
Conversation
…ot.cmd _copilot_executable() hardcoded the npm-shim name copilot.cmd on Windows, so workflow command-step dispatch failed for any Copilot CLI install that puts copilot.exe on PATH instead (standalone installer, winget, scoop). Probe PATH for copilot.exe, then copilot.cmd, before falling back to the historical default. Fixes github#4755 Assisted-by: Claude Code (model: Claude Sonnet 5, autonomous)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4755
Problem
_copilot_executable()insrc/specify_cli/integrations/copilot/__init__.pyhardcoded
copilot.cmdas the Windows executable name, assuming the GitHubCopilot CLI was always installed via an npm global install (which wraps the
binary in a
.cmdshim on Windows). Any other install channel — a standaloneinstaller,
winget,scoop, or a signed native binary — putscopilot.exeon
PATHinstead. Because Spec Kit never probedPATH, workflow/command-stepdispatch to the
copilotintegration failed outright for those installs onWindows (
copilot.cmdnot found), even though a working Copilot CLI waspresent.
Fix
_copilot_executable()now probesPATHon Windows withshutil.which,preferring
copilot.exe, thencopilot.cmd, then falls back to thehistorical
copilot.cmddefault if nothing is found (so the resulting"command not found" error still references the previously expected name).
Non-Windows behavior (
"copilot") is unchanged. The env-var override(
SPECKIT_INTEGRATION_COPILOT_EXECUTABLE) still takes precedence, unchanged.This mirrors the fix suggested in the issue report.
Test evidence
Added three regression tests in
tests/integrations/test_extra_args.pythat monkeypatch
os.nameandshutil.whichto simulate the three Windowsscenarios: only
copilot.exepresent, onlycopilot.cmdpresent, andneither present.
Confirmed the key regression test fails without the fix
(
git checkout HEAD~1 -- src/specify_cli/integrations/copilot/__init__.py,then restored):
With the fix, all three new tests plus the existing Copilot executable/extra-args
tests pass:
Full suite (
.venv/bin/python -m pytest):10 failed, 8582 passed, 13 skipped.The 10 failures are pre-existing
*_python_paritytests (bash/PowerShell vs.Python template-composition parity) unrelated to this change — confirmed by
running the same test files against the unmodified
mainbranch, whichproduces the identical 10 failures.
AI disclosure
Implemented autonomously by an OSS-contribution agent running Claude Code
(Claude Sonnet 5,
claude-sonnet-5), operating without human line-by-linereview before this push. Extent: full code change and test authored by the
agent, based on the fix already suggested in the issue body; issue
investigation, prior-PR/claim search, and test verification (including the
before/after regression check) were also performed by the agent.
🤖 Generated with Claude Code