Fix partner-impact Slack notice crashing when a PR changes more than 20 partner files#8891
Merged
Merged
Conversation
…20 partner files head -20 exits after 20 lines; GNU sed flushes output in 4KB chunks, so with enough changed files its next write hits the closed pipe and fails (exit 4 under the Actions runner's ignored SIGPIPE), which set -euo pipefail promotes to a job failure. Replace the head pipeline with an awk consumer that reads all input to EOF, keeping the same top-20 truncation. Also make the list heading accurate when 20 or fewer files change. First triggered by PolicyEngine#8890 (172 changed partner files), which therefore got no Slack notice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
The
partner-api-impact-notice.yamlworkflow (Slack notice when partner contract tests change) crashes on any PR that changes more than 20 partner files — first triggered by #8890 (172 changed partner files), which consequently got no Slack notice.Root cause
file_list=$(printf '%s\n' "${CHANGED_FILES}" | sed '/^$/d' | head -20 | sed 's/^/- /')head -20exits after emitting 20 lines, closing the pipe's read end. GNU sed flushes its output in ~4KB chunks, so with enough files its nextwrite()hits the closed pipe. The Actions runner ignores SIGPIPE, so sed gets EPIPE, printssed: couldn't write 114 items to stdout: Broken pipe, and exits 4 — whichset -euo pipefailpromotes to a job failure. Reproduced deterministically: a producer still writing after the consumer exits fails with 141/4 underpipefail; the awk form below cannot fail this way because awk always reads to EOF.Fix
head -20pipeline withawk 'NF && ++n <= 20 { print "- " $0 }'— identical output (blank lines dropped, first 20 files,-prefix), but the consumer reads all input, so no producer ever receives SIGPIPE.Showing first 20:only when the list is actually truncated,Changed files:otherwise.Message rendering dry-run against #8890's real 172-file list produces the expected notice (
Changed partner files: 172, first 20 listed,...and 152 more).Note: this workflow runs on
pull_request_target, so the fix only takes effect after merging tomain; #8890's red check clears on its next event after that.Test plan
🤖 Generated with Claude Code