Fix flaky SIGPIPE/pipefail false positives in safe-outputs conformance checker - #58768
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix non-deterministic false positives in conformance checker
Fix flaky SIGPIPE/pipefail false positives in safe-outputs conformance checker
Sep 5, 2026
pelikhan
marked this pull request as ready for review
September 5, 2026 08:48
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes consistently remove the identified race without altering the checks’ intended semantics.
Pull request overview
Eliminates SIGPIPE/pipefail races in the safe-outputs conformance checker.
Changes:
- Captures bounded
grepoutput before matching. - Applies the deterministic pattern across seven affected checks.
File summaries
| File | Description |
|---|---|
scripts/check-safe-outputs-conformance.sh |
Removes racy grep pipelines from conformance checks. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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.
scripts/check-safe-outputs-conformance.shproduced non-deterministic MEDIUM failures (e.g. REQ-001) against an unmodified spec file due to a SIGPIPE race underset -o pipefail.Root cause
Several checks piped a bounded
grep -A Ninto agrep -q/grep -qE. When the downstream grep matches and exits early, it can send SIGPIPE to the still-writing upstream grep, which then exits 141 — surfacing as pipeline failure underpipefaileven though the keyword was found.Fix
grep -A N ... | grep -q ...pipeline with a two-step pattern: capture the first grep's output via command substitution ($(... || true)), then match against it withgrep <<< "$var". This runs the first grep to completion before matching, eliminating the race.Verified by running the script 10 consecutive times against the unmodified repo — identical PASS results every run.