Skip to content

fix(dev): workspace-pytest hook crashes on Windows with FileNotFoundError for /dev/stdin and drops backslash paths #1766

Closed

Description

@Kaap10

What's broken

Commit d23116e2 (#1764) updated the workspace-pytest pre-commit hook to selectively test only changed workspace members by piping changed paths to tools/dev/ci-pytest-batches.py --changed-file /dev/stdin --paths.

On Windows (under Git Bash / MSYS2 with native Python), this breaks:

  1. ci-pytest-batches.py fails with FileNotFoundError: [Errno 2] No such file or directory: '\\proc\\self\\fd\\0' because /dev/stdin is a POSIX-only virtual path that native Windows Python cannot open with Win32 APIs, and --changed-file - is not supported.
  2. In ci-pytest-batches.py, path separators in --changed-file are not normalized from \ to /. Any Windows-style paths fail c.startswith(prefixes), causing select() to return [] and silently skip running tests for modified workspace packages.
  3. In run-workspace-check.sh, multi-line output from Windows Python contains CRLF (\r\n). In bash, applicable=$(...) retains \r on intermediate tokens (e.g. tools/agent-guard\r), causing uv run --directory to fail with os error 123 (syntax error in filename).
  4. test_a_change_behind_a_member_symlink_picks_the_member in test_ci_pytest_batches.py fails on Windows with WinError 1314 (privilege not held) because it lacks try/except OSError: pytest.skip(...).

Which layer

  • tools/dev/ci-pytest-batches.py
  • tools/dev/run-workspace-check.sh
  • tools/dev/tests/test_ci_pytest_batches.py

How to reproduce

On Windows, run the workspace check against a modified file:

tools/dev/run-workspace-check.sh pytest "pytest --version" tools/agent-guard/src/agent_guard/__init__.py

Traceback:

Traceback (most recent call last):
  File "tools/dev/ci-pytest-batches.py", line 236, in <module>
    raise SystemExit(main())
  File "tools/dev/ci-pytest-batches.py", line 219, in main
    for line in args.changed_file.read_text(encoding="utf-8").splitlines()
  File "pathlib.py", line 1027, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
FileNotFoundError: [Errno 2] No such file or directory: '\\proc\\self\\fd\\0'

Additionally, running uv run --directory tools/dev --project . python -m pytest tests/test_ci_pytest_batches.py on Windows raises:

FAILED tests/test_ci_pytest_batches.py::test_a_change_behind_a_member_symlink_picks_the_member
OSError: [WinError 1314] A required privilege is not held by the client

Expected vs actual

  • Expected: run-workspace-check.sh and ci-pytest-batches.py should portably accept changed files through stdin (via standard -) across Linux, macOS, and Windows without crashing, normalize backslashes so Windows path separators match package prefixes, strip \r in bash command substitution, and guard symlink tests against missing OS symlink privileges.
  • Actual: Crashes on Windows with FileNotFoundError, silently bypasses tests when backslash paths are passed, breaks bash subshell tokenization with \r, and fails unit tests on unprivileged Windows runners.

Surface area (optional)

Local pre-commit run workspace-pytest, local commit git hooks on Windows, and tools/dev/ci-pytest-batches.py.

Environment (optional)

Windows 10/11, Git Bash / MSYS2, Python 3.12 (native Windows CPython).

Activity

  1. added
    family:ci.github workflows, prek, validators
    capability:reassessRe-run historical issues against current code
    capability:platformFramework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap)
    substrate:framework-devTool substrate: build / validate / eval the framework itself
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    capability:platformFramework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap)capability:reassessRe-run historical issues against current codefamily:ci.github workflows, prek, validatorsfamily:setupsetup-* skillsfamily:toolstools/*substrate:framework-devTool substrate: build / validate / eval the framework itself

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions