Skip to content

fix(wip-limit): avoid sort|head SIGPIPE failing the WIP check when queue >10#61

Merged
saadqbal merged 1 commit into
mainfrom
fix/wip-limit-broken-pipe
Jun 18, 2026
Merged

fix(wip-limit): avoid sort|head SIGPIPE failing the WIP check when queue >10#61
saadqbal merged 1 commit into
mainfrom
fix/wip-limit-broken-pipe

Conversation

@shujaatTracebloc

@shujaatTracebloc shujaatTracebloc commented Jun 17, 2026

Copy link
Copy Markdown

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:

Code review queue depth: 36 (limit: 30)
sort: fflush failed: 'standard output': Broken pipe
sort: write error
##[error]Process completed with exit code 2.

Cause

The over-limit comment path builds its list with:

jq -r '...' /tmp/inreview.txt | sort | head -10

head -10 closes the pipe after 10 lines; sort then hits EPIPE on its next write and exits non-zero. Under set -euo pipefail that non-zero pipe status fails the whole step. It's a size/timing race — small queues let sort flush before head closes (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 head the file — sort never 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; with set -o pipefail, head closing the pipe after 10 lines made sort exit 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 runs head -10 on that file, so sort is 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 why sort | head must not be used here.

Reviewed by Cursor Bugbot for commit fb0dc8a. Bugbot is set up for automated code reviews on this repo. Configure here.

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>
@shujaatTracebloc shujaatTracebloc self-assigned this Jun 17, 2026
@LukasWodka

Copy link
Copy Markdown
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):

  • .github#57 — fix(fr-gate): pass items at or beyond the required stage · author: @aptracebloc · no reviewer assigned
  • .github#60 — feat(security): public-repo PII gate (block customer names + secrets in PRs) · author: @LukasWodka · no reviewer assigned
  • averaging-service#117 — refactor(averaging): per-framework weight-handling seam (WS-B B1) · author: @divyasinghds · no reviewer assigned
  • averaging-service#118 — feat(averaging): trainable-only keyed-dict weight format (WS-C #104) · author: @divyasinghds · no reviewer assigned
  • averaging-service#119 — fix(averaging): exact federated GaussianNB merge — usable + correct (WS-B B2, #112) · author: @divyasinghds · no reviewer assigned
  • backend#815 — chore(deps): bump cryptography from 47.0.0 to 48.0.1 · author: @dependabot · no reviewer assigned
  • backend#829 — feat(#817): failure surfaces a reason end-to-end + stuck-run reaper (WS6 I3/I4/I5/I8) · author: @saadqbal · no reviewer assigned
  • backend#833 — fix(deploy): graceful shutdown + Dockerfile hygiene; drop dead EC2 script · author: @LukasWodka · no reviewer assigned
  • backend#840 — feat(rfc-0001): namespace-slug rule + validation command (#837) · author: @LukasWodka · no reviewer assigned
  • cli#78 — fix(dataset rm): delete staging files from a uid-65532 pod, not jobs-manager (#259) · author: @LukasWodka · no reviewer assigned

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
@saadqbal saadqbal merged commit e7ce01a into main Jun 18, 2026
5 checks passed
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.

3 participants