Skip to content

fix(ci): make backend shell contracts Windows-safe - #10841

Merged
kodjima33 merged 2 commits into
BasedHardware:mainfrom
tianmind-studio:codex/windows-explicit-bash-test-runner
Jul 29, 2026
Merged

kodjima33 merged 2 commits into
BasedHardware:mainfrom
tianmind-studio:codex/windows-explicit-bash-test-runner

Conversation

@tianmind-studio

@tianmind-studio tianmind-studio commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

Resolve shell subprocesses through the active Git for Windows installation instead of invoking a bare bash, which Windows process lookup can resolve to the System32 WSL launcher. A shared testing.shell helper now discovers Git Bash from git --exec-path, converts native paths with cygpath, and keeps command arguments separate from shell source.

Migrate every direct Bash subprocess in the backend test tree to that helper. Tests that inject fake tools now prepend their POSIX path inside Git Bash, and shell-consumed temporary scripts and path lists use LF explicitly. This covers workflow scope rendering, VM startup and reaper contracts, backend test runners, changed-files, gateway deploy probes, and the LC3 replay harness.

Make backend/scripts/needs-typecheck.sh consume inherited stdin directly instead of redirecting /dev/stdin, which Git for Windows does not provide in this environment. This preserves file-list behavior while preventing the Windows pre-push hook from silently skipping backend type checking.

Product invariants affected

none

How it was verified

  • Ordinary PowerShell: backend/.venv/Scripts/python.exe -m pytest across the 9 affected test modules (41 passed)
  • Python AST audit of backend/tests/**/*.py: zero subprocess commands whose executable is a literal bash, /bin/bash, or /usr/bin/bash
  • black --check across the 10 affected Python files
  • ruff 0.4.4 check across the 10 affected Python files
  • Targeted Pyright with the backend venv (0 errors; existing warnings remain in older untyped tests)
  • C:\Program Files\Git\bin\bash.exe -n backend/scripts/needs-typecheck.sh
  • git diff --check
  • The full local PR preflight still stops in check-manifest-contract at the existing main-branch Windows Bash/Python command-resolution boundary; fix(ci): make Windows preflight path-safe #10825 fixes that independent release-guard test issue and is green.

Tests

The focused suites were first run from ordinary PowerShell before the fixes and reproduced the WSL launcher failures, UTF-16/GBK decode warnings, fake-PATH misses, and /dev/stdin failure. The same combined suite now passes through Git Bash selected from the active Git installation. test_windows_bash_resolution_uses_the_active_git_installation also covers discovery without relying on the host installation layout.

Failure class (fixes)

Failure-Class: none

@tianmind-studio
tianmind-studio force-pushed the codex/windows-explicit-bash-test-runner branch from efc94a0 to 28738f1 Compare July 29, 2026 08:52
@tianmind-studio tianmind-studio changed the title fix(ci): resolve Git Bash in backend scope tests fix(ci): make backend shell contracts Windows-safe Jul 29, 2026
@Git-on-my-level Git-on-my-level added workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior needs-maintainer-review Needs a human maintainer to sign off before merge labels Jul 29, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for tightening the Windows shell contract here. I reviewed the diff and ran the affected backend shell-contract/unit tests locally in a clean env with no repo secrets:

cd backend
env -i HOME="$HOME" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PYTHONPATH="$PWD" .venv/bin/python -m pytest \
  tests/test_replay_harness_lc3_frame_timing.py \
  tests/unit/test_agent_vm_reaper.py \
  tests/unit/test_agent_vm_startup.py \
  tests/unit/test_auto_dev_backend_scope.py \
  tests/unit/test_backend_test_runner.py \
  tests/unit/test_backend_typecheck_predicate.py \
  tests/unit/test_backend_unit_ci_runner.py \
  tests/unit/test_changed_files_script.py \
  tests/unit/test_llm_gateway_deploy_contract.py

Result: 41 passed. I also checked python -m py_compile on the touched Python files, bash -n backend/scripts/needs-typecheck.sh, and git diff --check; all passed.

The implementation looks directionally good: resolving Bash through Git for Windows avoids accidentally invoking the WSL launcher, bash_path() keeps Windows paths POSIX-normalized for Git Bash, and the /dev/stdin removal preserves inherited-stdin behavior while avoiding an unavailable Git-for-Windows path.

I’m not formally approving because this touches CI/shell-contract behavior and should still get maintainer review on the workflow impact, but I don’t see a blocker from this pass.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Concrete defect: bare 'bash' resolves to the System32 WSL launcher on Windows, so backend shell contract tests failed with UTF-16/GBK garbage and needs-typecheck.sh silently skipped type checking via the missing /dev/stdin. Shared testing.shell helper is the right seam; 41 tests pass and an AST audit proves no literal bash invocations remain. Green CI.

@kodjima33
kodjima33 merged commit 6187e51 into BasedHardware:main Jul 29, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer-review Needs a human maintainer to sign off before merge workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants