ci: fix flaky Xcode 26 selection killed by SIGPIPE under pipefail - #82
Merged
Conversation
The Xcode selection loop tested each candidate with:
xcodebuild -version | grep -q '^Xcode 26'
under `set -euo pipefail`. `grep -q` exits the moment it matches, xcodebuild
then takes SIGPIPE while it is still writing, dies with an uncaught
NSFileHandleOperationException ("Broken pipe", Abort trap: 6), and `pipefail`
propagates that as the exit status of the whole pipeline. The condition
therefore evaluated false for the candidate that actually *was* Xcode 26, the
loop fell through every entry, and the job failed with
"Xcode 26 is required for this CI job."
Whether xcodebuild finished writing before grep closed the pipe is a race, so
this only failed intermittently: of four pull request runs on the same day,
two passed with no abort trap and two failed with four abort traps each.
Capture the version output into a variable and match it with `case` instead, so
no pipe exists and nothing can be signalled mid-write.
There was a problem hiding this comment.
🟢 Approval recommended
The change removes a known race-prone pipeline pattern in CI and replaces it with a deterministic, low-risk string match without affecting build/test behavior beyond Xcode selection.
Pull request overview
This PR fixes a flaky CI failure in the “Select Xcode 26” workflow step by removing a pipefail-sensitive xcodebuild | grep -q pipeline that could intermittently reject the correct Xcode due to SIGPIPE behavior.
Changes:
- Replace
xcodebuild -version | grep -q '^Xcode 26'with capturingxcodebuild -versionoutput into a variable and matching viacase. - Add an in-script rationale explaining the SIGPIPE +
pipefailfailure mode and why the new approach is race-free.
File summaries
| File | Description |
|---|---|
| .github/workflows/ci.yml | Makes Xcode 26 selection deterministic by avoiding a fragile `xcodebuild |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers 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.
Problem
The
Select Xcode 26step tested each candidate with:under
set -euo pipefail.grep -qexits the moment it matches.xcodebuildis then still writing, takes SIGPIPE, and dies with an uncaughtNSFileHandleOperationException(*** -[_NSStdIOFileHandle writeData:]: Broken pipe,Abort trap: 6).pipefailpropagates that as the exit status of the whole pipeline, so the condition evaluated false for the candidate that actually was Xcode 26, the loop fell through every entry, and the job failed withXcode 26 is required for this CI job.Whether xcodebuild finishes writing before grep closes the pipe is a race, which is why this only failed sometimes. Four pull request runs on the same day:
Abort trapoccurrences in the step logNote the failures are entirely inside this step - nothing was ever compiled, so the failures said nothing about the code in those PRs.
Fix
Capture the version output into a variable and match it with
case, so there is no pipe and nothing can be signalled mid-write.Verification
Reproduced the mechanism deterministically with a producer large enough to lose the race every time:
Should be merged before the other open pull requests, so their runs stop failing at random.