Skip to content

Fix Windows closed-pipe errors in Git source-pin fallback - #4686

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
mihir-s-05:fix/windows-git-batch-closed-pipe
Oct 22, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
mihir-s-05:fix/windows-git-batch-closed-pipe

Conversation

@mihir-s-05

Copy link
Copy Markdown
Contributor

Change and mathematical scope

When the Git --batch -z probe exits before its first stdin write on native Windows, CPython can raise OSError(EINVAL) at flush and again at close. The current reader handles only BrokenPipeError, so the older-Git fallback aborts before reading any pinned source.

Recognize this closed-stdin error only on Windows, at the request and cleanup boundaries. The existing first-request/no-response/exit-129 retry gate, exact blob validation and one-pass iterator remain intact. Other errors still propagate, and a failed legacy reader cannot trigger a third process.

Three files: the small reader fix, six behavioral tests, and a source/evidence note. Tooling only; no changed source pins, frozen packages, selected frontier or new κ.

Task and overlap

Validation

Before: the unchanged native compatibility module reports eight passes, one error and one existing CR/LF-path skip. Its exited-child test produces the real Windows errno-22 failure. The final six new tests against an exact copy of the base reader produce eight error subcases.

After, with -W error -B, both ordinary and optimized -O runs:

Environment Scope Result per mode
Windows / CPython 3.12.0 / Git 2.47.1.windows.1 Git batch, compatibility, new pipe errors, replacement refs, committed bytes, source history 51 passed, one existing CR/LF-path skip
Ubuntu under WSL / CPython 3.12.3 / Git 2.43.0 Git batch, compatibility, new pipe errors 23 passed, no skips

The unchanged registered compatibility hook also passes metadata/pins and all 38 currently discovered Git-reader tests on Linux:

python3 -W error -B scripts/research_package.py --package research/git-batch-compatibility

The new tests cover write/flush/close errors, binary/empty/duplicate blobs, independent object IDs, single iterator consumption, closed streams and reaped children. EIO, POSIX EINVAL, exit 0/7, post-response failure and legacy-reader failure remain rejecting controls. Only option rejection and the injected error variants are simulated; real Git supplies successful fallback bytes. git diff --check passes.

The shared-control planner selects all 2,480 registered packages. Its policy is unchanged; those broader scientific replays were not run locally. An initial broader Windows onboarding run hit existing fixture errors and was stopped; the sparse selected baseline also lacked its complete input closure. No complete onboarding, selected cold replay or hosted CI pass is claimed.

Credit

Nick Petalas (#2752) supplied the fallback and original tests; Douglas Colkitt the runner contracts; Arham Tahir the NUL pin batching; Woklerx the streamed-reader and cleanup lineage. Maxime Fleury's reproducibility work and the original P104/Abhinav Ramachandran reports retain their credit.

Prepared for Mihir Srivastava with substantial OpenAI Codex assistance, one agent. Apache-2.0.

Open next questions

Run the three reader modules against an actual older Git for Windows in a disposable fixture. That binary is not installed here; this repair uses the predecessor's controlled unsupported-option probe. Synchronous pipe-read deadlines and arbitrary Git/Python-version support remain separate obligations.

@Mister-Meeseeks
Mister-Meeseeks merged commit b21331d into CrocSwap:main Oct 22, 2026
382 of 513 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants