Repository navigation
fix(env): put the interpreter's scripts dir on the spawned PATH - #24510
Conversation
|
Local pre-push review note (not a CI lane disposition): the local GPT reviewer flagged that the new layout test could pick up a host-installed |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix adds one folder at the end of the fallback PATH, reads it from Notes
[DESIGN-REVIEWED] c90943b Description read[DESCRIPTION-READ] 544c48e775a96b6e09b6ff882b07564b7e96c844e18f5c868023fa47fe1a047d That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This is a one-line mechanism fix with an issue and a failing-on-base test behind it, and no other place in What this change shipsInventory (4 items) — 4 justifiedIntent: Windows desktop users can start
[FIRST-PRINCIPLES-REVIEWED] c90943b Description read[DESCRIPTION-READ] 546ecee38e3226119cc19776475da131823f856b3d26a93bbc53671ecae3b212 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
6aba955 to
b323e53
Compare
|
|
CI note: |
b323e53 to
9613088
Compare
|
CI note: |
9613088 to
c90943b
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: a bug fix that appends the interpreter's sysconfig scripts directory after its own directory on the spawned PATH, so bundled console scripts resolve on the Windows desktop layout.
Problem / Motivation
Goal: On the Windows desktop build, sessions find the
uv/uvxthat ship with the backend, so stdio MCP servers launched throughuvxstart without a user-installed uv.The kiro-cli child gets its
PATHfromaugmented_path(), which adds the running interpreter's folder last. The Windows desktop backend is a python-build-standalone tree:python.exesits at the tree root and pip puts console scripts, includinguv.exe/uvx.exe, inkirocrew-backend\Scripts\. That folder is never on the child'sPATH, soshutil.which("uvx", path=augmented_path(PATH))returnsNoneand auvx-launched MCP server fails withconnection closed: initialize response.Why it matters
Every Windows desktop user without their own uv install loses every MCP server that starts through
uvx, including the registrypypientries, and the error does not say why.Not a goal
resolve_uv()already usesuv.find_uv_bin()).website/electron/.PATH: the interpreter folders stay the last-resort entries.What changed (motivation → approach → change)
The interpreter's folder and its console-scripts folder are one folder in a venv and on POSIX, but two folders on the Windows desktop backend.
augmented_path()now appends both, in that order, still afterbase_path. The scripts folder comes fromsysconfig.get_path("scripts"), read once whenenv.pyloads, and is skipped when it is the same folder or not absolute. It is read once becausesysconfigexpands~in its result, andaugmented_pathcallers that pin a specific home must not pick up the process home. The docstring describes both layouts.Backwards compatibility
Compatible: in a venv the scripts folder is the interpreter folder and is not added twice, so the
PATHis unchanged; elsewhere one more folder is appended after every existing entry, so no name resolves differently except one found nowhere else.Removes nothing: no entry, key, function or accepted input is removed.
Tests
In
test/test_env.py(TestAugmentedPath):test_finds_a_console_script_beside_a_root_level_interpreter: lays out the desktop tree (interpreter at the root,uvxinScripts) on disk; the last two entries are the root andScripts, andshutil.which("uvx")finds it. It uses.exenames on Windows.test_a_scripts_dir_that_is_the_interpreter_dir_is_listed_once: a venv's shared folder is listed once and stays last.test_appends_running_interpreter_bin_dir_lastpins the scripts folder, so the existing order check keeps its meaning.The layout test reports every executable outside
tmp_pathas absent, so auvxalready installed on the host cannot answer the lookup.Proof: not provable -- other: prove.py's throwaway checkout errored at collection on the sibling PR; a manual revert of the
augmented_pathchange turnstest_finds_a_console_script_beside_a_root_level_interpreterred and the fix turns it green (head 6aba955)Determinism: the 14
TestAugmentedPathnode ids ran green 20 times at-n0and 10 times at-n 2 --dist loadgroupbesidetest/test_env_homebrew_keg_node.py; the whole oftest/test_env.pyran green in shuffled order (seed 27350).Manual verification
Not run on a Windows desktop install. The test reproduces the reported layout and lookup (
shutil.which("uvx", path=augmented_path(...))). Local gates green on Linux: 552 related tests (test_env.py, ACP spawn/resolution, MCP gateway PATH, Node toolchain, facade guards), black, isort, flake8, mypy, semgrep, flake-pattern ratchet.Related Issues
Closes #24459
Sibling sweep
Swept: git grep -nE "Path(sys.executable).parent" -- src/
Sibling: src/kiro_crew/env.py:942 -- changed here
Sibling: src/kiro_crew/platform/wheel_engine_layout.py:132 -- not affected -- classifies the interpreter tree (also line 196), it does not build a search path
Sibling: src/kiro_crew/service/macos.py:280 -- not affected -- macOS only, where scripts sit beside the interpreter in bin/
Pattern harvest
Not generalizable: one search-path builder assumed the interpreter folder holds the console scripts; it is the only place that builds the spawned child's fallback PATH.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)