Repository navigation
loopguard: read a test run spelled the Windows way, or through the py launcher - #339
Open
Lanre Shittu (Shizoqua) wants to merge 2 commits into
Open
Lanre Shittu (Shizoqua) wants to merge 2 commits into
Lanre Shittu (Shizoqua) wants to merge 2 commits into
Conversation
On Windows a runner is named with backslashes, a drive letter and `.exe`: `C:\repo\.venv\Scripts\python.exe -m pytest`, `.venv\Scripts\pytest.exe`, `python.exe -m pytest`, as Claude Code's PowerShell tool records it. The micro-skills observer reads these as test runs (`test_a_windows_interpreter_path_is_the_interpreter`), but the loop guard's verification pattern did not, so a failing one after the last edit left the turn counted as ended green. Each command is now matched as it reads with forward slashes, no drive letter and no `.exe` (`_posix_spelling`); the patterns themselves are unchanged. `python.exe repro.py`, `.venv\Scripts\python.exe -m pip install x` and `pytest.exe --collect-only` are still not test runs. Over the 5,107 strings in the test suites, only Windows-spelled runs read differently.
`py -m pytest`, `py -3.12 -m pytest` and `py -V:3.12 -m pytest` run the tests through the Windows `py` launcher, which starts the default Python or the one a `-V:<tag>` or `-3.x` option chooses (CPython's "Using Python on Windows"). The loop guard read none of them as a test run. The launcher, by name or path and with its version option, is now read as `python`. `py repro.py`, `py -m pip install pytest`, `py -3.12 --version` and `pyright` are still not test runs, and `py.test` is pytest's own name as before.
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.
On Windows a runner is named with backslashes, a drive letter and
.exe:C:\repo\.venv\Scripts\python.exe -m pytest,.venv\Scripts\pytest.exe,python.exe -m pytest, as Claude Code's PowerShell tool records it. It may also be started through thepylauncher:py -m pytest,py -3.12 -m pytest. The micro-skills observer reads the first forms as test runs (test_a_windows_interpreter_path_is_the_interpreter, from #268), but the loop guard's verification pattern read none of these, so a failing one after the last edit left the turn counted as ended green.Fix: each command is matched as it reads with forward slashes, no drive letter and no
.exe, and with thepylauncher (by name or path, with its-V:<tag>or-3.xoption, per CPython's "Using Python on Windows") read aspython(_as_run, instatus_of_tests). The patterns themselves are unchanged, so the lines other open PRs edit (_PYTHON,VERIFY_RE,_PREFIX_RE,_NOT_A_RUN_RE) are untouched.python.exe repro.py,py -m pip install pytest,py -3.12 --version,pyrightandpytest.exe --collect-onlyare still not test runs, andpy.testis pytest's own name as before. Over the 5,256 strings in the test suites, only Windows-spelled runs read differently.The companion change for micro-skills, reading
pyas the interpreter there too, is a separate PR.Tests, in a new
tests/test_loopguard_windows_runs.py:pylauncher (all fail on main);The skips need Windows, a real agent CLI (Codex, Hermes, opencode) or aider, or a non-root user.
Fixes #338