Skip to content

ci(pr-pipeline): alert when pr-merge's post-merge check stays unreadable - #11382

Merged
kyle-sexton merged 5 commits into
mainfrom
ci/9170-post-merge-unreadable-signal
Oct 31, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
ci/9170-post-merge-unreadable-signal

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #9170

Summary

When pr-merge's post-merge check exits 3 (unreadable), merges hold and the only output is a ::warning. On 2026-10-30, every post-merge-dispatch sweep from 11:00 to 16:29Z exited 3 ("at the 1000-run search cap"). That held every merge candidate for about 5 hours, and nobody was alerted. Following the owner's 2026-10-26 amendment on #9170, this adds signal 11, post-merge unreadable, to maintenance-monitor-signals. It uses a constant threshold of 4 consecutive sweeps, only notifies, and clears itself. pr-merge is unchanged, and there is no new config key, counter or issue filing.

Fix

  • collect.mjs, new source post-merge reports: reads the pr-merge-post-merge-report artifacts that post-merge-dispatch keeps for each sweep, newest first. Only runs in the trusted pr-merge run set are read (scheduled or manual, on main, own head), so reports from a fork, a PR or an unlisted run are never read. The read stops at the first report that is not exit 3, or after 4 reports. A run that kept no report (not live, or stopped by a rate limit) neither counts toward the streak nor resets it. If no trusted report is newer than 70 minutes, the source records a gap rather than a clear, so an open issue stays open until a sweep reads again. The pr-merge run list is now read once and shared with the budget source.
  • signals.mjs, postMergeUnreadableFindings: fires when all 4 newest reports are exit 3 (POST_MERGE_UNREADABLE_SWEEPS = 4, the owner's constant). The summary names the newest report's reason in inert form. The fingerprint is that reason with its digits masked, so a cause that persists is written once rather than every hour. observedAt is the newest report's time, so a new streak after a clear reopens the same issue.
  • monitor.mjs: while signal 11 fires, each run prints one ::error line. This keeps the owner's 2026-10-22 "emit ::error" requirement, which the 2026-10-26 amendment did not drop. readArtifact can now return named files from an artifact that holds several.
  • issues.mjs: signal 11 is registered in SIGNALS, and the new source maps to it in SOURCES. The signals table in docs/conventions/pr-pipeline/README.md and a pr-pipeline changelog fragment are added.

Per-run GitHub call delta (budget is 250, CALL_BUDGET):

  • When the newest report is readable: +2 calls (one artifact list and one zip download).
  • During a streak: at most +5 calls (the list and 4 downloads).
  • +1 more only when the shared pr-merge run list failed in the budget source and is read again.

Detection latency: the monitor runs hourly at :52, so the issue lands about 1 to 2 hours after a streak starts.

Verification

  • Checked against a real exit-3 report (pr-merge run 41067582241, 2026-10-30 14:03Z):
    • the zip holds post-merge-code (3) and post-merge.json at its root;
    • .reason is unreadable: post-merge-detect-silent-revert.yml push runs: total_count 1239, 1000 returned, at the 1000-run search cap;
    • the test fixtures carry that reason.
  • Red before the fix: with the four source files restored to origin/main, the new tests fail (7 failures; signals.test.mjs fails at import).
  • Green after: node --test .github/scripts/maintenance-monitor-signals/*.test.mjs passes 92 of 92. The tests cover:
    • 3 unreadable sweeps file nothing, and the 4th fires;
    • a readable report of any code among the newest 4 clears it;
    • the fingerprint is stable while the cause holds;
    • reasons reach the issue in inert form;
    • one download per report, and the read stops at the first readable report;
    • fork, PR, unlisted and expired reports are skipped;
    • a stale or missing report is a gap;
    • the pr-merge run list is read once;
    • signal 11 prints one ::error.
  • scripts/check-affected.sh --tests: 11 passed, 5 skipped. scripts/check-line-citations.py rc=0. scripts/check-changelog-fragments.sh --check and --check-required origin/main pass.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgauhM9QMc1vRhujf3L

kyle-sexton and others added 3 commits October 30, 2026 18:42
The monitoring lane gains signal 11, post-merge unreadable. It reads the
pr-merge-post-merge-report artifacts that post-merge-dispatch keeps per
sweep, from trusted scheduled or manual pr-merge runs on main only, newest
first, and fires when the newest 4 all exited 3. The rolling issue names
the newest report's reason, only notifies, and closes on the next
readable report. No report within 70 minutes is a gap, so an open issue
is not cleared without a readable sweep.

The pr-merge run list is now read once and shared with the budget source;
readArtifact can return named files from a multi-file artifact.

Closes #9170

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgauhM9QMc1vRhujf3L
The owner's 2026-10-22 record asks for an ::error beside the issue: each
monitoring run prints one while post-merge unreadable fires. The test
fixtures now carry the reason a real exit-3 report held (pr-merge run
41067582241, 2026-10-30), whose zip layout and post-merge-code text the
reader was checked against.

Refs #9170

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgauhM9QMc1vRhujf3L
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 30, 2026 23:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T23:07:20.355877Z 144f1ce Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 144f1ce627

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed db9b3ae1a7fd7f9fc6a245670999d66fd7037215: 0 finding(s), 0 as inline comments.

No security findings.

critical-findings: 0

I read the whole diff (11 files). Only .github/workflows/maintenance-monitor-signals.yml matches a trusted path, and its change is a comment on an existing actions: read line. The permissions: block is unchanged, so no token scope grows. The lane still uses the job's own GITHUB_TOKEN, with no App token.

Checked:

  • Who can feed the new artifact read. The post-merge reports source (collect.mjs) keeps an artifact only if its workflow_run.id is in the set of runs that pass trustedPrMerge (collect.mjs:117). That check requires a scheduled or manual event, head_branch === "main", and the repository's own head. A fork's artifact under the same name, a pull-request-run artifact and an unlisted run are all dropped. Expired and future-dated artifacts are also skipped. The tests cover each of these cases.
  • What the artifact content can do. post-merge-code is compared to the string "3". post-merge.json is parsed and only .reason is read. readArtifact passes fixed file names to unzip -p through execFileSync with an argument array, so there is no shell and no injection from the artifact. A missing file makes unzip fail and the source records a gap, which never counts as a clear.
  • ::error:: workflow-command injection. errorLines prints ::error::${title}: ${summary}. Both go through finding() → inert() (signals.mjs:27, signals.mjs:47-49), which strips \r, \n and backticks and caps the length. The output is therefore a single line starting with a fixed ::error::, so the reason cannot start a second workflow command. The reason comes from a trusted main-branch run anyway.
  • Issue body. inert() does not strip @mentions or links. The reason comes only from a trusted pr-merge run's own check output, not from PR authors, so an attacker has no path to it. I rate this too low to report.
  • Signal behaviour. The signal only files, reopens or closes the rolling issue. It demotes nothing and changes no merge hold, so pr-merge and its gates are untouched.
  • Fail-closed behaviour. No trusted report in the last 70 minutes records a gap, and SOURCES maps that gap to signal 11 (issues.mjs:124), so an open issue is not auto-closed without a readable sweep.

Spend: the monitor adds 2 to 5 REST calls per hourly run against the CALL_BUDGET of 250. That draws on the API rate limit only, not on any billed resource, so it is not a hold.

No plugin manifest files changed, so there are no manifest <field> lines.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed db9b3ae1a7fd7f9fc6a245670999d66fd7037215: 0 finding(s), 0 as inline comments.

No blocking or advisory findings. I read the whole diff and the code it touches (collect.mjs, signals.mjs's finding and inert, and the pr-merge.yml steps that write the report). I ran no tests; the 92-of-92 pass is the PR author's claim and unverified by me.

Closing issue #9170, as amended by the 2026-10-26 comment

  • The owner replaced the merge: config key and pr-merge-side counter with a signal in maintenance-monitor-signals, using a constant threshold of 4. The change builds that: POST_MERGE_UNREADABLE_SWEEPS = 4 is a constant, and pr-merge is untouched.
  • Four unreadable sweeps in a row produce one rolling issue and one ::error per run. This comes from postMergeUnreadableFindings, ERROR_SIGNALS and errorLines. Tests in signals.test.mjs and monitor.test.mjs fail if the 4th sweep stops firing it or if a 3-sweep streak starts to.
  • A readable sweep clears it, tested for codes 0, 5, 1, 2 and 4 in either of the two newest positions. An isolated unreadable sweep files nothing, tested with 3 reports.
  • The alert never demotes: it only files a finding and prints a line.

Checks against the workflow

  • post-merge.json is always written. The Check earlier lane merges step redirects stdout to it, so the artifact always holds both files readArtifact asks for.
  • The report upload step is gated on steps.post-merge.conclusion == 'success'. The step exits 0 for code 3, so exit-3 reports are kept. Code 75 fails the step, so a rate-limited sweep keeps no report, which matches the "neither counts nor resets" rule.
  • Trust is enforced by joining artifacts to trustedPrMerge runs, so fork, PR and unlisted-run artifacts are never downloaded.
  • The reason text is passed through inert() in finding(), so the issue summary, facts and the ::error line carry no backticks or newlines.
  • A read error mid-streak leaves a gap, and SOURCES maps that gap to signal 11, so an open issue stays open instead of being cleared by missing data.
  • The shared pr-merge run list is fetched once. The budget source now filters status === "completed" client-side, which keeps its previous behaviour.

Cost
This adds 2 to 5 REST calls per hourly monitoring run, within the existing 250-call budget. It is not a cost hold.

Embedded text
The PR context contains no instructions aimed at the reviewer.

kyle-sexton and others added 2 commits October 30, 2026 19:10
… progress

post-merge-dispatch uploads its report before the merge and
enable-auto-merge jobs that need it finish, so the newest report usually
belongs to a run still in progress. The shared pr-merge run list asked
for completed runs only, which left that report out of the trusted set:
four older exit-3 reports could raise signal 11, and a raised alert could
not clear until the whole run completed. The list now takes every status;
the budget source keeps its completed-only filter. No extra call.

Refs #9170

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgauhM9QMc1vRhujf3L
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit ebd9ab5 Oct 31, 2026
48 checks passed
@kyle-sexton
kyle-sexton deleted the ci/9170-post-merge-unreadable-signal branch October 31, 2026 00:42
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/maintenance-monitor-signals/collect.mjs 3 1 0 0 0 0
.github/scripts/maintenance-monitor-signals/signals.mjs 3 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/maintenance-monitor-signals/collect.mjs:307 ROR productive input-gap

The run's summary has the full report.

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.

ci(pr-pipeline): alert when pr-merge's post-merge check stays unreadable

1 participant