Discord notify pipe buffer: what to review โ
| Field | Value |
|---|---|
| Branch | feat/admin-and-merchant-portals, draft PR #976: feat(admin): portal navigation, financials and monitoring, plus the agent-process work behind them, not merged |
| Project | README.md |
| Issues | #956: bug(ci): Discord notification dies on any squash merge whose commit message exceeds the pipe buffer and #966: bug(ci): the #956 pipe-buffer SIGPIPE shape also lives in ai-changelog.yml and a discord-notify.yml fallback branch |
| Servers you need | None. There is nothing to click. This is two GitHub Actions workflows |
| Local origins | Not applicable |
Is there anything to look at? โ
Two files, and one real-world proof you will get for free when this branch merges. โ
- The files are
.github/workflows/discord-notify.ymland.github/workflows/ai-changelog.yml. - The proof: this branch's squash-merge commit message will be enormous, 200-plus commits concatenated. That is exactly the payload that killed the notification last time. If Discord posts on merge, the fix held.
- The bug that produced this project was a 94,631-byte, 1,978-line squash-merge commit message.
What changed here? โ
head does not wait for a large writer once it has what it wants. โ
- Its early exit sends the writer SIGPIPE, the step runs under
set -Eeuo pipefail, and that SIGPIPE takes the whole step down with no output at all. - Symptom in CI: died in 0.2s, no error output.
The fix removes the pipe rather than raising the limit. โ
printf ... | head -n 1became bash parameter expansion, which takes everything before the first newline with no subshell and no second process.jq ... | head -n 50became jq's ownlimit(50; ...), which caps the generator inside the process instead of askingheadto discard the rest on the far side of a pipe.- Three lines in
discord-notify.ymlhad the identical shape. All three were fixed, not just the one the crash report pointed at.
The two follow-up instances turned out to fail in DIFFERENT ways, and only one matched the prediction. โ
discord-notify.yml's fallback branch is a plain assignment, so a SIGPIPEdprintffails the whole step. Matches exactly.ai-changelog.yml's instance sits inside anifcondition, and bash'serrexitdoes not fire on a command whose status is being tested. So the step survived, every time.- That difference uncovered a worse, silent bug the "does it crash" framing would have missed.
pipefailreports the rightmost non-zero exit, so whenprintfdies (141) andgrep -qlegitimately matches (0), the pipeline still reports 141 and theifreads false even though the skip tag really was on line 1. A false negative with no error and no visible symptom. - The same fix eliminates it, because there is no longer a second process to race against.
What is deliberately NOT done? โ
Two more genuinely exposed instances were found and filed rather than fixed here. โ
#968: bug(ci): the #956/#966 pipe-buffer SIGPIPE shape also lives in ai-changelog.yml's PR-body head -c 500 lines, the "Generate changelog with AI" step, which pipes a PR body throughhead -c 500inside a plain assignment. GitHub allows PR bodies up to 65,536 characters. Open.
A third candidate was deliberately left out of that issue. โ
- Its
grep -oEstage narrows output to a handful of short matching lines beforehead -1ever sees it, regardless of how large the upstream data is, so it is not meaningfully exposed. - Same reasoning for structurally identical pairs in
issue-triage.ymlandassign-milestone.yml.
What open findings touch this project? โ
- Nothing from
../merchant-and-venue-dashboards/branch-review-0828.md. The reviewer checked the three workflow quoting fixes and listed them under what was found clean. - One thing worth knowing for the merge itself: the em dash count on
discord-notify.ymlis 2 before and 2 after, both pre-existing and outside the touched lines. Neither was added by this fix.
What issue does each piece close? โ
| Piece | Issue | State |
|---|---|---|
| The original three-line fix | #956: bug(ci): Discord notification dies on any squash merge whose commit message exceeds the pipe buffer | Fixed on branch, proven against the real 94,631-byte message |
| The two follow-up instances | #966: bug(ci): the #956 pipe-buffer SIGPIPE shape also lives in ai-changelog.yml and a discord-notify.yml fallback branch | Fixed on branch |
| The two remaining instances | #968: bug(ci): the #956/#966 pipe-buffer SIGPIPE shape also lives in ai-changelog.yml's PR-body head -c 500 lines | Open, filed not fixed |
| The subject-only skip rule this fix preserves | #348: ai-changelog + discord-notify: skip-logic refinements (subject-only matching, empty-AI guard) | Closed, behaviour verified unchanged |