You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
loopguard: a test run spelled the Windows way, or through py, is not counted as a verification #338
status_of_tests in tokeneconomizer/loopguard/turn.py does not read a test run named the Windows way: with backslashes, a drive letter or .exe (C:\repo\.venv\Scripts\python.exe -m pytest, .venv\Scripts\pytest.exe, python.exe -m pytest), or through the Windows py launcher (py -m pytest, py -3.12 -m pytest). That is how Claude Code's PowerShell tool records a command on Windows. A failing run after the last edit then leaves the turn counted as ended green, and it feeds the envelope.
The micro-skills observer already reads the backslash and .exe forms as test runs; test_a_windows_interpreter_path_is_the_interpreter (from #268) pins that for micro-skills. The py launcher is the default way to start Python on Windows per CPython's "Using Python on Windows" docs ("To launch your default runtime, run python or py", with a -V:<tag> or -3.x option to choose a version).
Issue:#338 — loopguard: a test run spelled the Windows way, or through py, is not counted as a verification
Understanding
status_of_tests (tokeneconomizer/loopguard/turn.py:222) matches VERIFY_RE (line 56), whose path prefixes only accept / and whose Python pattern _PYTHON (line 40) only accepts python[N[.M]]. So C:\repo\.venv\Scripts\python.exe -m pytest, .venv\Scripts\pytest.exe, python.exe -m pytest, and py -3.12 -m pytest return None, and a failing run after the last edit is counted as a green turn. The end state is "own" for all four, matching the micro-skills observer, which already strips the dir and .exe (microskills/observe.py:840). Note that PR #339 is already open against this issue; this plan is the same change, so reviewing or confirming it should not duplicate that work.
Approach
tokeneconomizer/loopguard/turn.py, _PYTHON: let the interpreter name be python\d?(?:\.\d+)? with an optional .exe, or the py launcher with an optional version option (-3, -3.12, -V:3.12, -V:Company/Tag), before the existing option group. Keep it case-insensitive (PY.EXE) and keep py from matching longer words (pytest and pyflakes must not read as the launcher; the existing (?![\w.\-/]) tail and the \s+-m requirement already guard this).
Same file, VERIFY_RE: add a shared path-prefix fragment accepting / or \ separators and an optional drive ([A-Za-z]:), replacing the two (?:~?/)?(?:[\w.\-]+/)* prefixes, and an optional .exe after the bare runners (pytest, py.test, tox, nox, and ideally the other bare runners such as jest, vitest). Keep the final (?![\w.\-/]), extended with \\, so pytest.exe ends the word but pytest.ini and pytest-cov do not.
Same file, _quiet (line 191) and _pieces (line 165): os.path.basename on Linux does not split backslashes, so C:\Windows\System32\grep.exe is not seen as quiet. Optional: reuse the basename helper from observe.py (line 840) without importing across mechanisms in a way that breaks the layout. If it is not shared cleanly, leave it out and say so in the PR.
Tests: add tests/test_loopguard_windows_paths.py in the style of tests/test_loopguard_hatch_test.py. Parametrize the four commands from the issue plus py -V:3.12 -m pytest, PY.EXE -m pytest, and .venv\Scripts\pytest.exe -q against "own". Add negatives (pytest.ini, pyflakes x.py, py script.py, py -m pip install pytest, python.exe -m pytest --collect-only) against None. Add a ... | findstr FAIL case for "hidden". Add a parity test against classify_command for the non-py forms.
No on-disk names, event kinds, or settings change, and no plugin text is touched.
Run the reproduction from the issue and confirm own for all four.
Check recorded sessions: replay any stored Claude Code PowerShell sessions and Linux sessions through loopguard and confirm that turn verdicts are unchanged on Linux and that the Windows ones now count as verified.
Open questions
None
Reply confirm to have scout implement this plan on a scout/issue-338 branch and link a one-click pull request (write access required). Reply /scout to plan again after editing the issue; text after the command is guidance for the new plan.
Generated by Scout for #338 · claude · sonnet55 · ~16 AIC · ⌖ ~16 AIC · ⊞ 2.6K · ◷
Activity
github-actions commentedon Nov 26, 2026
Scout plan
Issue: #338 — loopguard: a test run spelled the Windows way, or through py, is not counted as a verification
Understanding
status_of_tests(tokeneconomizer/loopguard/turn.py:222) matchesVERIFY_RE(line 56), whose path prefixes only accept/and whose Python pattern_PYTHON(line 40) only acceptspython[N[.M]]. SoC:\repo\.venv\Scripts\python.exe -m pytest,.venv\Scripts\pytest.exe,python.exe -m pytest, andpy -3.12 -m pytestreturnNone, and a failing run after the last edit is counted as a green turn. The end state is"own"for all four, matching the micro-skills observer, which already strips the dir and.exe(microskills/observe.py:840). Note that PR #339 is already open against this issue; this plan is the same change, so reviewing or confirming it should not duplicate that work.Approach
tokeneconomizer/loopguard/turn.py,_PYTHON: let the interpreter name bepython\d?(?:\.\d+)?with an optional.exe, or thepylauncher with an optional version option (-3,-3.12,-V:3.12,-V:Company/Tag), before the existing option group. Keep it case-insensitive (PY.EXE) and keeppyfrom matching longer words (pytestandpyflakesmust not read as the launcher; the existing(?![\w.\-/])tail and the\s+-mrequirement already guard this).VERIFY_RE: add a shared path-prefix fragment accepting/or\separators and an optional drive ([A-Za-z]:), replacing the two(?:~?/)?(?:[\w.\-]+/)*prefixes, and an optional.exeafter the bare runners (pytest,py.test,tox,nox, and ideally the other bare runners such asjest,vitest). Keep the final(?![\w.\-/]), extended with\\, sopytest.exeends the word butpytest.iniandpytest-covdo not._quiet(line 191) and_pieces(line 165):os.path.basenameon Linux does not split backslashes, soC:\Windows\System32\grep.exeis not seen as quiet. Optional: reuse the basename helper fromobserve.py(line 840) without importing across mechanisms in a way that breaks the layout. If it is not shared cleanly, leave it out and say so in the PR.tests/test_loopguard_windows_paths.pyin the style oftests/test_loopguard_hatch_test.py. Parametrize the four commands from the issue pluspy -V:3.12 -m pytest,PY.EXE -m pytest, and.venv\Scripts\pytest.exe -qagainst"own". Add negatives (pytest.ini,pyflakes x.py,py script.py,py -m pip install pytest,python.exe -m pytest --collect-only) againstNone. Add a... | findstr FAILcase for"hidden". Add a parity test againstclassify_commandfor the non-pyforms.Verification
python -m pytest tests/test_loopguard_windows_paths.py tests/test_live_core.py tests/test_loopguard_python_runners.py tests/test_loopguard_productive_turns.py -qpython -m pytest tests experiments/testsownfor all four.loopguardand confirm that turn verdicts are unchanged on Linux and that the Windows ones now count as verified.Open questions
None
Reply
confirmto have scout implement this plan on ascout/issue-338branch and link a one-click pull request (write access required). Reply/scoutto plan again after editing the issue; text after the command is guidance for the new plan.