Skip to content

perf(pr-pipeline): run the lost-run reconciler hourly - #17533

Merged
kyle-sexton merged 3 commits into
mainfrom
perf/17460-reconcile-hourly
Nov 19, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
perf/17460-reconcile-hourly

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #17460

Summary

The lost-run reconciler now runs hourly (minute 4) instead of at minutes 4 and 34. Over 24 h the :34 slot spent 1,496 GITHUB_TOKEN calls (~62/h) and the :04 slot 2,931 (the hub's job-calls log). In the 00-08Z hours that tripped the brake, pace.mjs had already cut each :34 tick to 1-2 calls, so most of the saving lands outside the trip hours.

Fix

  • cron 4,34 * * * * -> 4 * * * *; MIN_GAP_MINUTES 30 -> 60, so a dispatch inside an hour of a full pass skips.
  • RERUN_DUE_MINUTES keeps "backoff plus two reconciler ticks" (15 + 2 * 60 = 135): a scheduled run starts late and can defer a head at MAX_IN_FLIGHT, so fix-ci waits two ticks before taking a head the reconciler would still re-run.
  • pr-unblock-dispatch keeps its 9 and 39 ticks; the 9 tick still follows the reconciler's 4. The cron test now asserts every reconciler tick is followed by a dispatcher tick five minutes later.
  • Comments that stated the old cadence are deleted (comment lint, ADR 0110). The workflow's opening summary restated rules reconcile.mjs states in its header: a re-run's attempt number is the record; a pr-verify run whose verdict write started is never re-run, so a head is never judged twice; a pr-verify run with no started job is left to the newer run; pr-review-main is handled the same way. The dispatcher's cron comment also said minutes 9 and 39 are used by no other schedule in that file; that still holds.
  • Cost: lost-run recovery, and the ci-status re-run after the kill switch lifts (pipeline README "Once the switch is lifted"), can now wait up to 60 minutes, about 2 hours on a paced tick. The pool resets at about :46, so the :04 tick still comes about 18 minutes after a reset; the dropped :34 tick fell inside the busy-hour trip window.

Verification

  • node --test over recent-pass, infra-failure, reconcile, jobs-batch, fix-ci-dispatch, workflow-gates: 413 pass.
  • node --test over log-api-budget/pace, check-trusted-trigger, check-kill-switch: 568 pass.
  • Comment lint and pre-push hooks pass.
  • The after-merge calls per hour come from the job-calls log 24 h after merge (Done-when 3).

Remaining

  • Pacing across the hour (Done-when 1): the BRAKE-CLEAR kick is hub-side, not in this repository.
  • pr-merge head-SHA filtering, starting review from Refine's event, gating pr-dispatch-feedback with if: (Done-when 2): not built; head SHA is already used where the semantics allow, the rest needs a gate change or is blocked by design. Per-workflow attribution of pr-merge's listings is in perf(pr-pipeline): keep the workflow file name in api-routes #17531.
  • Before and after per consumer (Done-when 3): after the 24 h window.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd

kyle-sexton and others added 2 commits November 19, 2026 14:57
The reconciler spent about 200 GITHUB_TOKEN calls an hour (53 passes in
24 h at about 91 calls each) against a pool that runs out in busy hours.
Its listings use a fixed 24-hour lookback (LOOKBACK_HOURS), so a pass
costs the same at either cadence and an hourly schedule roughly halves
its spend.

- cron 4,34 -> 4; MIN_GAP_MINUTES 30 -> 60.
- RERUN_DUE_MINUTES stays the reconciler's backoff plus two of its ticks,
  now 15 + 2 * 60: a scheduled run starts late and can defer a head at
  MAX_IN_FLIGHT, so fix-ci waits two ticks before it takes a head the
  reconciler would still re-run.
- pr-unblock-dispatch keeps 9 and 39; its 9 tick still follows the
  reconciler's 4, and the cron test now checks that every reconciler tick
  is followed by a dispatcher tick.
- Comments that stated the old cadence are deleted (comment lint); the
  workflow's opening summary restated the rules reconcile.mjs holds.

Refs: #17460

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 21:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T21:18:47.064513Z e833a99 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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on e833a99c365ed84eeb67e1f0425dcd48eaf504a7; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review (incremental, e833a99 → 746f9c8): perf(pr-pipeline): run the lost-run reconciler hourly

This lane already reviewed an earlier head, so this pass reported blocking findings only. I read all 5 files in the incremental scope. I found nothing new to report.

Both earlier findings are fixed:

  1. Loosened cron check (.github/scripts/pr-unblock/workflow-gates.test.mjs:1081): the test now has assert.deepEqual(dispatcher, [9, 39], ...) in addition to the inclusion loop.
    • It is now stricter than the original exact match. A changed 9,39 schedule fails, and so does an extra tick or a dropped :39 tick.
    • The owner's reply settled this thread, and the lines have not changed since.
  2. Four stale statements of the half-hourly reconciler cadence:
    • docs/outage-posture-audit.md now says "within about an hour (the cron runs at minute 4)".
    • docs/conventions/pr-pipeline/README.md:3357 now says "per hourly pass".
    • The kill-switch comment at .github/workflows/pr-require-checks.yml:6468 now says "per hourly run".
    • The misleading paragraph in the pr-unblock-dispatch.yml header is deleted. The 9,39 cron itself still shows the schedule trigger.

Other "half-hourly" mentions. I searched the repository for the remaining ones. Each is about the dispatcher's own tick, which this PR keeps at 9,39, so none is stale.

Closing issues. The PR context has no closing-issue section; the PR body says Refs: #17460. There were no acceptance criteria to check.

Spend. This change lowers GITHUB_TOKEN calls and Actions minutes (one reconciler run an hour instead of two). There is no billing change, so there is no hold.

Loosened-check verdict: fail (default). The wrapper wrote no loosened_check_verdict: or loosened_check_patterns: line, so there are 0 patterns. It also wrote no loosened_check_decision_record: line, so the citation requirement was not checked. In this increment, the test change tightens the check and does not loosen it.

Not run. This lane has no shell, so I ran nothing. The PR's test results are the author's claim and unverified.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #17533, incremental (e833a99 → 746f9c8)

No security issues found. This was an incremental review of the 5 files changed since e833a99c365ed84eeb67e1f0425dcd48eaf504a7, and I read every hunk of each. This lane already reviewed an earlier head, so the review was blocking only.

What changed:

  • .github/scripts/pr-unblock/workflow-gates.test.mjs: one assertion is added, pinning the dispatcher's cron minutes to exactly [9, 39]. It is a test only and makes the existing cron check stricter.
  • .github/workflows/pr-require-checks.yml (trusted path, ci-status hold step): the only change is the comment word "half-hourly" → "hourly". The step's logic, if: conditions and permissions: are untouched, so the merge hold is not weakened.
  • .github/workflows/pr-unblock-dispatch.yml (trusted path): a nine-line header comment about the half-hourly tick and which triggers the trigger gate accepts is deleted. The on: triggers, the job's GITHUB_TOKEN scope and the trusted-trigger gate are all unchanged; the remaining comment still says hand-started runs and re-runs must come from a listed trusted human. This is a code comment, not a standing instruction (CLAUDE.md, a skill or agent body, or a hook list), so the instruction-surface lens finds nothing removed.
  • docs/conventions/pr-pipeline/README.md and docs/outage-posture-audit.md: only the stated cadence is updated (hourly, minute 4). These are docs only.

Controls checked: the trusted-trigger check, the lane token scope, the kill switch and the merge holds. No diff line touches any of them, so nothing is widened. After the kill switch is lifted, recovery still happens but can take up to an hour, which matches the head the lane already reviewed.

Embedded text: none in the PR context.

Spend: fewer reconciler runs mean fewer GITHUB_TOKEN calls and Actions minutes. Nothing new is billed.

critical-findings: 0

…ourly reconciler notes

Review of #17533: the cron test now pins pr-unblock-dispatch to 9 and 39
as well as checking a dispatcher tick follows each reconciler tick, so it
is stricter than the exact-mirror check it replaced. Three statements of
the reconciler's old 30-minute cadence (outage-posture audit, pipeline
README, pr-require-checks' kill-switch comment) now say hourly. The
dispatcher header paragraph said both its ticks follow a reconciler tick;
it is deleted (comment lint). It also said: a tick runs the same listings
as a push run and starts no fix-docs; heads the dispatch record holds are
not read again; pr-unblock.yml's trigger gate and the broker accept a
dispatcher run started by a push, a schedule or a listed human, and for
pr-refine.yml a pull_request_target run (ADR 0090). The pipeline README
(pr-unblock dispatch section) and request-lane-token's README keep those
rules.

Refs: #17460

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a9ce1bb Nov 19, 2026
70 checks passed
@kyle-sexton
kyle-sexton deleted the perf/17460-reconcile-hourly branch November 19, 2026 22:18
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant