Repository navigation
Description
Summary
Three end-to-end tests in tests/test_judge.py fail on Windows. Their stub judge runners are sh -c "..." commands, and that breaks in two ways depending on the shell:
- PowerShell (no
shon PATH): the tests crash withFileNotFoundError: [WinError 2]becauseshdoesn't exist. Other test files already guard against this (test_opencode_plugin.pyusesskipUnless(shutil.which("node")),test_always_on_hooks.pyonly runs runtimes it finds), buttest_judge.pydoesn't. - Git Bash (
shavailable): the fixture paths are interpolated unquoted into thesh -cstring, soshtreats the backslashes inC:\Users\...as escapes.catreceivesC:Users...verdict.jsonand fails.
This is a test-fixture bug, not a bug in scripts/judge.py. It's never been caught because CI only runs tests.test_always_on_hooks on windows-latest (.github/workflows/plugin-load-check.yml); test_judge runs on Linux only.
Environment
- Windows 11, Python 3.14.3
- Case 1: Windows PowerShell, no
shon PATH - Case 2: Git for Windows bash 5.2.26 (
x86_64-pc-msys) mainatf3e783b
Reproduction
python -m unittest tests.test_judgeCase 1, PowerShell:
ERROR: test_a_malformed_verdict_skips_its_group_instead_of_killing_the_run (tests.test_judge.EndToEndTest...)
ERROR: test_judging_produces_paired_rows_the_scorer_accepts (tests.test_judge.EndToEndTest...)
ERROR: test_runner_failure_skips_its_group_and_continues (tests.test_judge.EndToEndTest...)
File "...\scripts\judge.py", line 184, in invoke_judge
completed = subprocess.run(
FileNotFoundError: [WinError 2] The system cannot find the file specified
Ran 17 tests in 0.186s
FAILED (errors=3)
Case 2, Git Bash:
cat: 'C:UsersHPAppDataLocalTemptmp4p9mf55ggood.json': No such file or directory
cat: 'C:UsersHPAppDataLocalTemptmpnk2er58qverdict.json': No such file or directory
cat: 'C:UsersHPAppDataLocalTemptmpieep6fceverdict.json': No such file or directory
FAIL: test_a_malformed_verdict_skips_its_group_instead_of_killing_the_run (tests.test_judge.EndToEndTest...)
FAIL: test_judging_produces_paired_rows_the_scorer_accepts (tests.test_judge.EndToEndTest...)
FAIL: test_runner_failure_skips_its_group_and_continues (tests.test_judge.EndToEndTest...)
FAILED (failures=3)
Cause
The affected fixtures (around lines 226, 294 and 390 of tests/test_judge.py):
"command": ["sh", "-c", f"cat > {captured}; cat {payload}"],
...
f" *) cat {good};; esac",
...
f'p=$(cat); case "$p" in *direct-answer*) exit 7;; *) cat {verdict};; esac',Each requires sh, and each {path} is an unquoted pathlib.Path.
Proposed fix
Both changes go in tests/test_judge.py only:
- Skip the stub-runner tests when
shis unavailable, matching the existing pattern:@unittest.skipUnless(shutil.which("sh"), "sh is required for the stub judge runner") - Pass paths as positional arguments so the shell never parses them:
"command": ["sh", "-c", 'cat > "$1"; cat "$2"', "sh", str(captured), str(payload)],
Minimal check of (2) under Git Bash on the same machine:
sh -c f"cat {p}" -> cat: 'C:UsersHPAppDataLocalTemp...verdict.json': No such file or directory
sh -c 'cat "$1"' sh str(p) -> {} (file contents, as expected)
scripts/judge.py runs the command list as given and sends the prompt on stdin, so the extra arguments don't interfere. Behavior on Linux/macOS stays the same. I'm happy to open the PR.
Out of scope: running the full unittest suite on windows-latest in CI would have caught this, but that's a separate workflow change.
Provenance: drafted with Claude Code (Claude Opus 5.5) and reviewed by me. I ran the PowerShell reproduction myself; the Git Bash reproduction and the minimal check were run by the agent on the same machine.
Activity
Teaz7 commentedon Nov 30, 2026
I missed #287 when filing this. It fixes both halves: it runs the stub runners with sys.executable, so the three tests actually run on Windows without sh instead of skipping. #287 should close this issue.