Skip to content

Discord notify pipe buffer: what to review โ€‹

FieldValue
Branchfeat/admin-and-merchant-portals, draft PR #976: feat(admin): portal navigation, financials and monitoring, plus the agent-process work behind them, not merged
ProjectREADME.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 needNone. There is nothing to click. This is two GitHub Actions workflows
Local originsNot 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.yml and .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 1 became bash parameter expansion, which takes everything before the first newline with no subshell and no second process.
  • jq ... | head -n 50 became jq's own limit(50; ...), which caps the generator inside the process instead of asking head to discard the rest on the far side of a pipe.
  • Three lines in discord-notify.yml had 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 SIGPIPEd printf fails the whole step. Matches exactly.
  • ai-changelog.yml's instance sits inside an if condition, and bash's errexit does 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. pipefail reports the rightmost non-zero exit, so when printf dies (141) and grep -q legitimately matches (0), the pipeline still reports 141 and the if reads 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. โ€‹

A third candidate was deliberately left out of that issue. โ€‹

  • Its grep -oE stage narrows output to a handful of short matching lines before head -1 ever 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.yml and assign-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.yml is 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? โ€‹

PieceIssueState
The original three-line fix#956: bug(ci): Discord notification dies on any squash merge whose commit message exceeds the pipe bufferFixed 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 branchFixed 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 linesOpen, 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

Built with VitePress