Skip to content

fix(ci): re-run a hosted review a GitHub rate limit held, and bind its attempt 2 - #17014

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/reconcile-rate-held-review
Nov 18, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/reconcile-rate-held-review

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Refs: #16642

Summary

A hosted review run whose leg hit a GitHub API rate limit ends success but does no review. ci-status names the hold and asks a person to re-run it. Neither the lost-run reconciler nor the merge gate handled this case, so the head stayed red until a person stepped in. Example: PR #16810 at head 4bea779, review runs 44114943906 and 44114943687.

Fix

  • reconcile.mjs: a newest checks run that failed only in ci-status with the rate-held note (RATE_HELD_NOTE, from the held) branch of pr-require-checks.yml) now reaches stoppedReview. That function now also re-runs an attempt-1 review run when rateHeld finds a leg that:

    • is green with its Claude review step skipped;
    • carries the "this leg holds and runs no review" warning beside a 403/429 at x-ratelimit-remaining: 0;
    • names a reset.

    Two more conditions apply: no step reviewed or applied the hold, and the pass runs more than 60 s after the latest reset. Before that it logs the wait. The re-run is recorded as rerunRecordName(id, 2, head), one lane per head per pass. The gate hold, the lane kill switches, MAX_IN_FLIGHT and RECONCILER_ATTEMPT_CAP are unchanged.

  • babysit_review_evidence.py: when attempt 1 succeeded, rerun_binds accepts _rate_held as well as _kill_switch_stopped. _rate_held needs three things:

    • the lane job's held: <lane> did not review <head>: notice;
    • no completion record;
    • another job of the attempt showing the hold beside such a refusal.
  • babysit_gh.py reads the annotations of a held leg, which the gate did not fetch before. The lane-run cache format moves to v2 (carry-run-cache.mjs follows), so a cached record without those annotations is not used.

Verification

  • node --test .github/scripts/maintenance-reconcile-lost-runs/reconcile.test.mjs: 209 pass. The new cases use the leg annotations recorded from run 44114943906:
    • 61 s past the reset: one re-run and record reconcile-rerun-201-2-<sha>;
    • before the reset and at 59 s past it: waits;
    • attempt 2, a run that reviewed or applied the hold, or a hold with no rate refusal: never re-run;
    • the lane's switch: holds the re-run;
    • the note text: pinned to the workflow.
  • node --test .github/scripts/pr-merge/carry-run-cache.test.mjs: 22 pass.
  • python3 -m unittest discover over plugins/source-control/skills/babysit-prs/scripts/tests: 4422 tests OK. The new RateHeldRerunTests checks that:
    • attempt 2 binds after a rate-held attempt 1, for both lanes;
    • it does not bind after a plain reviewed attempt 1, a hold without a refusal, a refusal without a hold, a held attempt with a record, or a notice for another head.
  • Mutation check: with the new reconcile gate or the _rate_held branch removed, the positive tests fail.
  • The pre-commit hooks (comment lint, guardrails) and the pre-push hooks (check-affected, guardrails) pass.

Remaining

What is still open on #16642 after this PR:

Related

🤖 Generated with Claude Code

…s attempt 2

A hosted review run whose leg held on a GitHub API rate limit ends success
with no review. ci-status names it, but the lost-run reconciler re-ran a
review only for a kill-switch or upstream stop, and the merge gate bound an
attempt 2 after a successful attempt 1 only for a kill-switch stop, so the
head waited on a person (PR 16810, runs 44114943906 and 44114943687).

- reconcile.mjs: on ci-status's rate-held note (RATE_HELD_NOTE, from
  pr-require-checks.yml's `held)` branch), re-runs the attempt-1 review run
  once, a minute past the latest reset its leg's 403/429 refusals name
  (rateHeld, read as held_from reads the leg), recorded as
  rerunRecordName(id, 2, head), one lane per head per pass, behind the same
  lane switches and upstream gate.
- babysit_review_evidence.py: rerun_binds accepts _rate_held beside
  _kill_switch_stopped for a successful attempt 1: the lane job's held
  notice for the head, no completion record, and a leg showing the hold
  beside a refusal at remaining 0.
- babysit_gh.py reads the held leg's annotations; the lane-run cache format
  moves to v2 (carry-run-cache.mjs follows), so no saved record lacking
  them is used.

Refs: #16642

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 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-18T02:57:51.622740Z 52f2daa PR opened
ℹ️ 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 52f2daa66896617f153ab38be4122220da7bc6ef; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review (incremental, blocking only): 52f2daa6 → 18adfa30

This review covered only blocking findings, because this lane already reviewed an earlier head. The change since then is one file, plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_gh_lane_run_carry.py, which adds HeldLegAnnotationTests.

Earlier finding addressed. The new tests cover the gap this lane's earlier advisory comment named (discussion_r4608686123):

  • The held leg's annotations are read and used. test_a_held_leg_s_annotations_are_read_and_bind_its_rerun runs a real collect_lane_runs. The fake jobs listing holds the lane job plus a green pr-review / Review Subscription leg whose Claude review step was skipped. The test asserts two things:
    • repos/<repo>/check-runs/23/annotations?per_page=100 is read.
    • _rate_held returns True on the attempt that collect_lane_runs builds.
  • A leg whose review ran is not read. test_a_leg_whose_review_ran_is_not_read gives the leg a success step. It asserts that the leg's annotations are not fetched and that no annotations key is attached.
  • The annotations survive a warm carry. test_a_warm_carry_keeps_the_held_leg_s_annotations asserts that the leg's annotations come through carry-run-cache.mjs into the v2 record unchanged, and that _rate_held still binds.

I checked the tests against the code they exercise:

  • Production clause. It matches the new branch at babysit_gh.py:3002-3011: lane jobs exist, the leg's conclusion is success, and its Claude review step was skipped. If that branch were removed, the first and third tests would fail.
  • Lane job annotations. setUp replaces them with a held: notice and removes the completion record. That is the state _rate_held needs.
  • Leg notes. These reuse LEG_HOLD and LEG_REFUSALS from test_babysit_review_evidence.py:2500-2507.
  • answers override. It sets an instance attribute that wraps the bound method, so collect and warm both serve the leg's annotations path.

Not verified: I didn't run these tests, because this lane has no shell.

Spend (not a hold): none new. This change only adds tests.

Loosened-check verdict: no loosened check in this change. The prompt had no loosened_check_verdict: line, so I applied fail with no consumer entries.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #17014, incremental (52f2daa → 18adfa3)

I found no security issues. This review covered only what changed since this lane last reviewed head 52f2daa6. The scope list names one file, and I read its whole change: plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_gh_lane_run_carry.py.

This lane has reviewed this pull request before, so this review reported only blocking findings (CRITICAL or IMPORTANT). It found none.

What changed

The push adds one test class, HeldLegAnnotationTests, with three tests. They check that collect_lane_runs reads the annotations of a held Review Subscription leg, meaning one whose Claude review step was skipped. They also check that a leg whose review ran is not read, and that a warm v2 carry keeps those annotations. Each test that reads the annotations then calls babysit_review_evidence._rate_held on the result.

Controls checked

  • The change touches only tests. It doesn't change the code that decides which re-run counts as review evidence (babysit_gh.py, babysit_review_evidence.py, carry-run-cache.mjs). This lane reviewed that code at 52f2daa6 and found that it widens nothing.
  • The new tests pin the fail-closed behaviour reviewed last time:
    • A leg whose review ran gets no annotations read or attached (test_a_leg_whose_review_ran_is_not_read).
    • _rate_held binds only once both of these annotations are present: the lane's held: <lane> did not review <sha> notice for the same head, and the leg's hold-and-refusal annotations.
  • This change doesn't touch token scope, the trusted-actor list, the kill switch, a permissions: block, any workflow, or any plugin manifest.

PR context: no embedded instructions.

Prior findings: none open. The earlier summary reported 0 findings.

critical-findings: 0

…_lane_runs

HeldLegAnnotationTests drives collect_lane_runs with a stubbed gh client:
a green leg whose Claude review step skipped has its annotations read and
attached where _rate_held reads them, a leg whose review ran is not read,
and a warm v2 carry keeps those annotations. With the leg fetch removed,
the read and carry tests fail.

Refs: #16642

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton disabled auto-merge November 18, 2026 03:08
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 18adfa300bff170b95ab0d9718f952289c1588e6. What it wrote, as data:

What it wrote (22 lines)
Summary: PR #17014 partly delivers #16642 (spec_kind `refs`). The delivered part is in scope. It
  meets done-when items 2 and 3 for hosted review runs that were held on a GitHub API rate limit.
  With this change the lost-run reconciler re-runs such a run. That only happens at attempt 1, once
  60 s have passed after the latest reset it finds, and only when no step reviewed or applied the
  hold. The gate hold, the lane kill switches and the in-flight and attempt caps are unchanged. The
  merge gate's `rerun_binds` also accepts the new `_rate_held` check. It needs three things: the
  lane job's `held:` notice for the head, no completion record, and a leg that shows the hold beside
  a 403 or 429 at remaining 0. The code reads correctly. Tests cover the change, including negative
  cases, a check that the reconciler's rate-held text matches `pr-require-checks.yml`, and a test of
  the leg-annotation fetch. The lane-run cache moves to v2 consistently in `babysit_gh.py` and
  `carry-run-cache.mjs`. Test Node
  (https://github.com/melodic-software/claude-code-plugins/actions/runs/44228245545/job/134547051194)
  and Test Python (0) and (1) concluded success on the judged head; those suites cover
  `reconcile.test.mjs`, `carry-run-cache.test.mjs` and the babysit-prs tests. No safety or
  takeover-set problem was found, and no text tried to steer the review. The deciding fact: a `refs`
  PR must name what remains of the issue, and this body names no remaining work. It only lists
  #16642 under Related as "rate-limit floor follow-ups".
- PR body: this PR refs #16642 but names no remaining work. Add a 'Remaining' section that lists
  what is still open on #16642. Include the post-brake backlog drain (the reconciler's cap of 3
  re-runs per pass leaves a large lost-run backlog for hours, per the 2026-11-16 and 2026-11-17
  issue comments) and say whether done-when item 1 (naming the callers and their request counts) is
  still open or already done.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 18, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit a8e8002 Nov 18, 2026
70 checks passed
@kyle-sexton
kyle-sexton deleted the fix/reconcile-rate-held-review branch November 18, 2026 04:54
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 18, 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