test: copy shim stdin with findstr instead of PowerShell (deflake #407)#423
Merged
Conversation
The fake-codex batch shims copied stdin via PowerShell, whose cold start on a loaded windows-latest runner outlived even the 10s activity deadline (#402's headroom fix) and flaked codex_json_batch_shim_uses_stdin_and_emits_assistant_text again on PR #422 with the same os error 2. findstr is a native always-present binary with no cold start; "^" matches every line, so it copies stdin verbatim until EOF. Applied to both the pty_runner unit shim and the stream_json_integration fixture; the 10s deadline stays as generic startup headroom. Fixes #407 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR deflakes Windows CI by replacing PowerShell-based stdin copying in fake Codex .cmd shims with a faster findstr-based approach, avoiding PowerShell cold-start delays on windows-latest runners.
Changes:
- Update the Windows Codex regression fixture to copy stdin via
findstrinstead of PowerShell. - Update the
pty_runnerWindows unit-test shim to copy stdin viafindstrand keep the existing 10s timeout headroom.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/coven-cli/tests/stream_json_integration.rs | Switch fake codex.cmd fixture stdin capture from PowerShell to findstr to reduce Windows runner flakiness. |
| crates/coven-cli/src/pty_runner.rs | Switch the Windows batch shim used by pty_runner tests from PowerShell stdin copy to findstr to avoid cold-start timeouts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3519
to
3523
| &batch, | ||
| concat!( | ||
| "@echo off\r\n", | ||
| "\"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoProfile -Command \"$inputStream=[Console]::OpenStandardInput(); $outputStream=[IO.File]::Open('stdin.txt',[IO.FileMode]::Create); $inputStream.CopyTo($outputStream); $outputStream.Dispose()\"\r\n", | ||
| "\"%SystemRoot%\\System32\\findstr.exe\" \"^\" > stdin.txt\r\n", | ||
| "echo %* > args.txt\r\n", |
Comment on lines
514
to
518
| "@echo off\r\n", | ||
| "\"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoProfile -Command \"$inputStream=[Console]::OpenStandardInput(); $outputStream=[IO.File]::Open('stdin.txt',[IO.FileMode]::Create); $inputStream.CopyTo($outputStream); $outputStream.Dispose()\"\r\n", | ||
| // findstr copies stdin without PowerShell's multi-second cold | ||
| // start, which flaked the sibling pty_runner test (issue #407). | ||
| "\"%SystemRoot%\\System32\\findstr.exe\" \"^\" > stdin.txt\r\n", | ||
| "echo %* > args.txt\r\n", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #407 (reopened).
The flake recurred on PR #422 (run 29639095135) with the 10s deadline present: the fake-codex batch shims copy stdin via PowerShell, whose cold start on a loaded windows-latest runner can outlive even 10s — the child gets killed before writing
args.txt, and the test dies withos error 2.Fix the mechanism instead of the headroom: copy stdin with
findstr("%SystemRoot%\System32\findstr.exe" "^" > stdin.txt) — a native, always-present binary with effectively zero startup."^"matches every line, so stdin is copied verbatim until EOF. Applied to both shims (pty_runner unit test + stream_json_integration fixture); the 10s deadline stays as generic startup headroom.Testing
cargo fmt --check✓ ·cargo clippy -p coven-cli --all-targets -- -D warnings✓cargo test -p coven-cli pty_runner::✓ (29/29 on unix; both changed shims are Windows-only fixtures — windows-latest CI on this PR is the authoritative check)