fix(wip-limit): avoid sort|head SIGPIPE failing the WIP check when queue >10#61
Merged
Conversation
When the Code review queue is over the WIP limit AND has more than 10
PRs, the comment-building pipeline `jq ... | sort | head -10` fails the
step with exit 2: head closes the pipe after 10 lines, sort then gets
EPIPE on its next write ("sort: write error" / "fflush failed: Broken
pipe"), and `set -euo pipefail` propagates that non-zero status.
It's a size/timing race — small queues let sort finish before head
closes, which is why it only surfaced once the queue reached 36/30
(e.g. tracebloc-py-package#237's WIP check). Sort to a temp file, then
head the file, so sort never shares a pipe with a short-circuiting
reader.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
👋 Heads-up — Code review queue is at 32 / 30 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
This was referenced Jun 17, 2026
Merged
saadqbal
approved these changes
Jun 18, 2026
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 reusable WIP limit check (
.github/workflows/wip-limit-check.yml) fails with exit code 2 for any PR when the Code review queue is over the limit and has more than 10 items. Seen on tracebloc-py-package#237 — queue at 36/30:Cause
The over-limit comment path builds its list with:
head -10closes the pipe after 10 lines;sortthen hitsEPIPEon its next write and exits non-zero. Underset -euo pipefailthat non-zero pipe status fails the whole step. It's a size/timing race — small queues letsortflush beforeheadcloses (why cli's check passed earlier at ≤30), so it only surfaced once the queue grew past 10 and over the limit.Fix
Sort to a temp file, then
headthe file —sortnever shares a pipe with a short-circuiting reader, so the broken pipe can't happen regardless of queue size. Output is unchanged (still the 10 oldest, sorted). The over-limit nudge comment now posts and the step exits 0.Impact
This reusable workflow is called by every repo's PR CI, so the fix unblocks the WIP check fleet-wide. tracebloc-py-package#237's check stays red until this merges to
main(its caller pins@main).🤖 Generated with Claude Code
Note
Low Risk
CI-only bash change in the over-limit comment path; no app, auth, or data handling impact.
Overview
When the Code review queue is over the WIP limit and has more than 10 PRs, the reusable WIP limit check workflow could fail the step instead of posting its nudge comment. The over-limit path listed PRs with
jq … | sort | head -10; withset -o pipefail,headclosing the pipe after 10 lines madesortexit on EPIPE, so the job failed (e.g. exit code 2) even though the check is meant to be non-blocking.The workflow now writes the sorted list to
/tmp/inreview_sorted.txt, then runshead -10on that file, sosortis not piped to a short-circuiting reader. Comment content is unchanged (still up to 10 oldest queue entries). A short comment in the YAML documents whysort | headmust not be used here.Reviewed by Cursor Bugbot for commit fb0dc8a. Bugbot is set up for automated code reviews on this repo. Configure here.