Skip to content

Fix llama-cpp-python version detection and run-all.bat nested-quote start commands#8

Open
chainchopper with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-batch-script-issues
Open

Fix llama-cpp-python version detection and run-all.bat nested-quote start commands#8
chainchopper with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-batch-script-issues

Conversation

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Two broken Windows batch script paths: the optional llama-cpp-python install always fell through to the wrong branch, and run-all.bat's cmd /k invocations were structurally malformed.

setup.bat — llama-cpp-python version detection (tokens=2tokens=1)

platform.python_version_tuple()[1] emits a single token (11, 12). tokens=2 never matched, leaving PY_MINOR unset — both version branches were skipped and the fallback --only-binary :all: (which has no cu130 wheels) always ran.

- for /f "tokens=2" %%i in ('"%PYTHON%" -c "import platform; print(platform.python_version_tuple()[1])"') do set PY_MINOR=%%i
+ for /f "tokens=1" %%i in ('"%PYTHON%" -c "import platform; print(platform.python_version_tuple()[1])"') do set PY_MINOR=%%i

run-all.bat — nested double-quotes in cmd /k arguments

cmd /k "call "path\activate.bat" & …" has unescaped inner quotes; cmd.exe closes the string at the first inner " so the activate step is truncated and silently broken on any path with spaces.

- start "NPU-STACK Backend" cmd /k ^
- "call "!ROOT!\.venv\Scripts\activate.bat" & cd /d "!ROOT!\backend" & python main.py"
+ start "NPU-STACK Backend" cmd /k "!ROOT!\run-backend.bat"

- start "NPU-STACK Frontend" cmd /k ^
- "cd /d "!ROOT!\frontend" & npm run dev"
+ start "NPU-STACK Frontend" cmd /k "!ROOT!\run-frontend.bat"

Delegates to the already-committed run-backend.bat / run-frontend.bat, eliminating the nesting entirely.

setup.bat — run-all.bat generation block updated to match

The fallback echo lines that write the start commands (only triggered when run-all.bat is absent) had the same nested-quote bug. Updated to emit the same clean pattern; ^!ROOT^! escaping ensures the generated file receives a literal !ROOT! variable reference rather than a hardcoded path baked in at generation time.

Original prompt

User asks whether the .bat file can be seen in the repository and wants direct correction. Inspect chainchopper/NPU-STACK main branch for Windows batch setup/launcher scripts, identify the failing optional llama-cpp-python install block and run-all.bat issues, and prepare fixes so user can git pull changes.

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…ested-quote start commands

Co-authored-by: chainchopper <36168576+chainchopper@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues with Windows batch setup scripts Fix llama-cpp-python version detection and run-all.bat nested-quote start commands Mar 3, 2026
@chainchopper chainchopper marked this pull request as ready for review March 3, 2026 10:59
Copilot AI review requested due to automatic review settings March 3, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two Windows batch-script issues affecting optional llama-cpp-python installation and launching backend/frontend services on paths containing spaces.

Changes:

  • Fixes Python minor-version detection in setup.bat so the correct llama-cpp-python wheel branch is taken.
  • Fixes run-all.bat start ... cmd /k invocations by delegating to run-backend.bat / run-frontend.bat (avoids broken nested quoting).
  • Updates setup.bat’s run-all.bat generation block to emit the corrected launch commands.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
setup.bat Corrects Python minor version parsing and updates generated run-all.bat launch lines to avoid nested-quote issues.
run-all.bat Replaces inline cmd /k "call ... & ..." with calls to run-backend.bat / run-frontend.bat for robust launching on Windows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI added a commit that referenced this pull request Mar 3, 2026
…ation

- run-all.bat: Replace broken nested-quote START commands with clean
  delegation to run-backend.bat / run-frontend.bat helper scripts
- setup.bat: Fix generated run-all.bat lines to use ^!ROOT^!\run-backend.bat
  and ^!ROOT^!\run-frontend.bat with proper caret-escaped vars
- backend/Dockerfile: Add cmake, migrate llama.cpp build from make to CMake,
  update COPY paths to build/bin/ to match CMake output layout

Supersedes conflicting PRs #8, #9, #10, #11, #12

Co-authored-by: chainchopper <36168576+chainchopper@users.noreply.github.com>
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.

3 participants