Skip to content

test: copy shim stdin with findstr instead of PowerShell (deflake #407)#423

Merged
BunsDev merged 1 commit into
mainfrom
fix/407-shim-findstr
Jul 18, 2026
Merged

test: copy shim stdin with findstr instead of PowerShell (deflake #407)#423
BunsDev merged 1 commit into
mainfrom
fix/407-shim-findstr

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 18, 2026

Copy link
Copy Markdown
Member

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 with os 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)

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>
Copilot AI review requested due to automatic review settings July 18, 2026 09:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 findstr instead of PowerShell.
  • Update the pty_runner Windows unit-test shim to copy stdin via findstr and 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",
@BunsDev
BunsDev merged commit df9b4f4 into main Jul 18, 2026
18 checks passed
@BunsDev
BunsDev deleted the fix/407-shim-findstr branch July 18, 2026 09:54
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.

Flaky on windows-latest CI: pty_runner::tests::codex_json_batch_shim_uses_stdin_and_emits_assistant_text (os error 2)

2 participants