Skip to content

fix(pr-pipeline): hold pr-merge's auto-merge run on a full listing and cap the lane-token retry wait - #12459

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-12292-41494917965-1
Nov 2, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-12292-41494917965-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #12292

Summary

Opened by the work-resolve-issue lane. The run's own summary:

This fixes the issue's pr-merge criterion (#12292, elements 1 and 2). With more than 1000 open pull requests, enable-auto-merge.mjs now holds: it arms, disarms and notes nothing, prints a ::notice:: and a step summary line, and exits 0. Before, it threw and ended red. The request-lane-token action now sends at most 3 broker requests and waits at most 60 s in all, down from 4 requests and 480 s. A github-unavailable retry waits a random 0-20 s, then 0-40 s (full jitter), or a longer Retry-After. A rate-limit wait that does not fit fails at once. The 60 s budget matches the per-client budget the earlier part 2 change gave retry-fetch.mjs. The audit doc's Remaining section records both fixes and drops the pr-merge script row. The other ten criteria in the 2026-11-02 17:00 decision are still open and are listed in remaining. I did not take pr-verify's resolve-pr.mjs: holding it green would also stop the reconciler's re-run, which depends on that run failing (audit element 3 row). That is the same kind of coupling the decision already found for intake-triage and work-unblock.

Remaining work

  • shared, element 1: check-trusted-trigger.mjs waits on the rate latch instead of refusing, with a test
  • shared, elements 1 and 2: rate-guard.mjs waits out a short reset and holds instead of failing the step, with a test
  • work-resolve-issue, elements 2 and 4: report-outcome.mjs --find-prior holds on a failed read, a failed labeler read no longer holds the PR, and stop-routes.json retry-spent no longer fails the issue when every retry was a fault, with tests
  • work-resolve-issue and pr-refine, element 6: handoff-evidence.sh sends etag on the repeated job-listing poll, with a test
  • intake-triage, element 2: apply-verdict.mjs holds green with a notice on an admission or read error, with a test
  • work-unblock, elements 2, 3 and 6: label-unblocked.mjs holds on a failed listing without losing the closes that listing missed (the sweepSince window), drops the stored breaker-trip records, and sends etag on the sweep, with tests
  • pr-refine, elements 1, 2, 3 and 4: handoff-evidence.sh capped backoff with full jitter and green hold on a failed read, fix-docs-dispatch.mjs no longer counts a red outage run as done, and report-check-run decide.mjs no longer posts failure on no verdict, with tests
  • pr-review, pr-review-security and pr-verify, elements 3 and 5: maintenance-reconcile-lost-runs reconcile.mjs drops the status-page gate and the one-time re-run record, with a test
  • pr-verify, elements 2 and 6: resolve-pr.mjs completeness throws hold instead of going red (note: the reconciler's lane re-run depends on that run failing), and check-trusted-trigger.mjs sends etag on the re-run record poll, with tests
  • pr-unblock, elements 2, 3 and 4: dispatch.mjs holds on a non-5xx read failure, limit-stop.mjs's per-head cap stops acting as a stored breaker, and escalation-routes.json files no fail route on a job fault, with tests

Not verified

  • The node test suites (request-lane-token.test.mjs, enable-auto-merge.test.mjs, signals.test.mjs) were not run here: this lane runs no interpreter. They are left to the PR's CI.
  • Tidy skipped: the change touches .github/, a listed shared path, so it is not tidied under the lane's tidy cutoffs.
  • No review-venue.txt in the scratchpad, so the review ran locally in one fresh-context subagent, not in the CI code-review lane.
  • When the budget runs out, the token action still fails red rather than holding the calling job green with a notice (element 2). That needs a change in the calling workflows, which this lane cannot push.
  • Changes left uncommitted in the working tree, as the lane runner instructs; the runner turns them into the patch.

Fix

  • .github/scripts/pr-merge/enable-auto-merge.mjs: new exported ListingFull error thrown by listPulls past MAX_PAGES; main catches only that, prints ::notice title=enable-auto-merge hold::, appends a step summary line and returns 0 before arming, disarming or noting anything
  • .github/scripts/pr-merge/enable-auto-merge.test.mjs: new test: ten full listing pages hold green with the notice and summary line, no ::error, and no call other than the listing query
  • .github/actions/request-lane-token/action.yml: retry loop now uses backoff=(20 40) with full jitter, budget=60 counted as total seconds slept (not elapsed time), so at most 3 requests; rate-limit message reads 'past the 1-minute retry budget'; comment updated (last answer within 5.5 minutes)
  • .github/actions/request-lane-token/request-lane-token.test.mjs: backoff and budget constants updated; tests now expect 3 requests rather than 4, 45 s Retry-After waits, a 61 s Retry-After refusal, an exact 60 s wait with no Retry-After, a 50 s wait with jitter cut to fit, and the new 1-minute messag
  • .github/actions/request-lane-token/README.md: retry rules rewritten for the 3-request, 60 s budget and full-jitter backoff, linked to the audit's element 1
  • .github/scripts/maintenance-monitor-signals/signals.test.mjs: fixture text updated to the new '1-minute retry budget' wording (the signal matches on github-rate-limited, so behavior is unchanged)
  • docs/outage-posture-audit.md: Remaining section lists the two pr-merge fixes and removes the pr-merge script row
  • .changes/pr-pipeline/work-resolve-issue-issue-12292-41494917965-1-80e98024.md: new patch fragment describing both behavior changes

Verification

The runner ran each check from the base copy against b683e29:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changelog-fragments: all 11 fragments valid
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changed-skills: no changed skills, nothing to gate
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: 10 passed, 5 skipped over 8 changed files (run before and after the review fixes)
  • cant-fail-scan --file .github/actions/request-lane-token/request-lane-token.test.mjs --check: PASS, 52 blocks, no gating findings
  • cant-fail-scan --file .github/scripts/pr-merge/enable-auto-merge.test.mjs --check: PASS, no gating findings
  • fresh-context review subagent over the whole diff: no correctness bugs; it traced every edited bash test against $RANDOM's range. Three low findings fixed: a stale test comment, the signals fixture wording, and an audit-doc clause saying the action fails red instead of holding green
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41494917965

Left out: the items under Not verified.

Related

#12292

Lane-Activity: work-resolve-issue/resolve-issue
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head b683e297ee8d38aed8eda1afcf1f08ac4050dcab. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed b683e297ee8d38aed8eda1afcf1f08ac4050dcab: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read all 8 changed files in full. Two of them are on trusted paths: .github/actions/request-lane-token/** and .github/scripts/pr-merge/enable-auto-merge.mjs. I read each of those changes in full and checked what it gates.

enable-auto-merge.mjs (merge-hold control). When listPulls reaches MAX_PAGES it now throws a ListingFull error. main catches only that error, writes a notice and a step-summary line, and returns 0. Every other error is still rethrown.

  • The return happens at the same point where the old code threw, so nothing that ran before is skipped, and arming and disarming still don't happen.
  • No pull request can be armed that the base code would have refused, and no merge hold is removed or narrowed.
  • In pr-merge.yml, the steps after the arm step use always() and don't depend on its result (pr-merge.yml#L2498-L2590).
  • The unarmed-status job runs only when unarmed-statuses is non-empty (pr-merge.yml#L2630). The early return never sets that output, so the job is skipped, just as it was when the script threw.
  • The workflow runs the script from .base (main's copy) (pr-merge.yml#L2492), so no code from a pull request's head runs here.
  • Result: not a widening.

request-lane-token/action.yml (lane-token control). Only the retry loop changed. Retries drop from 4 requests to 3, and the total wait budget drops from 480 s to 60 s.

  • The OIDC request, the broker request body, the token outputs and the token scope are unchanged.
  • The anchored allowlists that keep broker text out of ::error:: and $GITHUB_OUTPUT are unchanged. Only the literal budget wording in rate_limit changed.
  • The rate-limited jitter cap budget - waited - delay can't go negative, because the waited + delay > budget check runs first and breaks out of the loop. sleep therefore always gets a non-negative integer.
  • Result: this narrows retries and widens nothing.

Other files. The README, tests, signals.test.mjs fixture, audit doc and changelog fragment are prose and tests only.

No embedded instructions in the PR context. Owner friction holds: none removed.

Spend: fewer broker retries and shorter waits use slightly fewer Actions minutes. No hold.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed b683e297ee8d38aed8eda1afcf1f08ac4050dcab: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of all 8 changed files. I also read the surrounding code in request-lane-token/action.yml (the retry loop and the failure path), enable-auto-merge.mjs (main and how it ends) and the setup of both test files.

request-lane-token retry budget (element 1)

  • Request count: backoff=(20 40) with the attempt -lt ${#backoff[@]} guard allows at most 3 requests and 2 sleeps.
  • github-unavailable waits: the first wait is RANDOM % 21 and the second is RANDOM % 41. A longer Retry-After replaces the wait, and any wait that would push waited past 60 breaks out to the final-answer path.
  • github-rate-limited waits: the jitter is cut to budget - waited - delay, which is never negative because the -gt check runs first. A wait that doesn't fit sets the "past the 1-minute retry budget" message.
  • Tests: I traced each changed test against these bounds and found no case they don't cover:
    • Every-attempt rate-limited at 20 s: both sleeps are at least 20 and add up to at most 60.
    • No Retry-After: the wait is exactly 60.
    • A second answer that would overrun the budget: 2 requests, then the budget message. The retried de-dup at line 347 keeps the regex anchored at $.
  • Timing comment: "within 5.5 minutes" checks out: 3 × (30 s OIDC + 60 s broker) + 60 s of waiting = 330 s.
  • Old wording: a search of .github/workflows found no workflow comment left that cites the old 8-minute / 9.5-minute numbers for this action. The "9.5 minutes" in pr-merge.yml:427 is about a different step's wait cap.

enable-auto-merge full-listing hold (element 2)

  • What is caught: main catches only ListingFull. Other listing errors still reach the outer ::error path.
  • Early return: the hold returns 0 before the room read and before any arm, disarm or note. Returning early skips writing unarmed-statuses, so the post-unarmed-status job's != '' guard skips it. That matches a run with nothing to report.
  • Skip records: they are not written on a hold, so the next run reads every pull request. That is the same as the old path, which threw.
  • Test: the new test pins ten listing pages, the notice, no ::error, and the step summary line. join, tempDir, PULLS_QUERY, ENV, pull and room are all in scope.

Other files

  • The signals.test.mjs fixture change is wording only.
  • The audit doc row removal and the patch-bump changelog fragment match the code.
  • .claude/rules/cost-claims.md matches docs/outage-posture-audit.md; the changed text makes no cost claim.

Context and scope

  • Closing issue: the PR body says Refs: #12292, not that it closes it, and the PR context file has no closing-issue section, so there were no acceptance criteria to check.
  • Unverified: the author says the node test suites were not run in their lane. I did not run them either (this lane has no shell), so they are unverified until the PR's CI runs.
  • Spend: this change lowers the lane-token step's worst-case wall time (from 8 minutes of retry waits to 60 s). It adds no billed cost.
  • Trusted paths: request-lane-token/** and enable-auto-merge.mjs match the trusted-path globs. I read their whole changes and found no new problem with what they control.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head b683e297ee8d38aed8eda1afcf1f08ac4050dcab.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 2, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Nov 2, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit c3c8b5a Nov 2, 2026
64 of 65 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-12292-41494917965-1 branch November 2, 2026 19:39
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.

1 participant