Skip to content

perf(source-control): bound lane-run listing to the PR's lifetime - #9284

Merged
kyle-sexton merged 1 commit into
mainfrom
perf/pr-merge-lane-runs-since-pr
Oct 23, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
perf/pr-merge-lane-runs-since-pr

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: fix for tonight's lanes App rate-limit exhaustion, root-caused by GitHub Support (.work/gh-monitor/research/lanes-app-budget-2026-10-23.md); the owner asked for it fixed ("this cannot be what throttles us").

Summary

collect_lane_runs (babysit_gh.py) listed every pull_request run of each review lane on the PR's head branch, with no date bound. GitHub labels a reused branch's older runs with the PR open on it now, so the release PR on release/plugins (about 2,462 runs) kept about 1,000 review runs, and the gate spent about 4,000 lanes App calls per candidate: pr-merge run 39883357253 took 21.5 min on #9267 while the App's remaining calls fell from 5,001 to 863, and run 39887421299 hit "API rate limit exceeded for installation".

Fix

  • collect_lane_runs takes the PR's created_at and adds created=>=<it> to each listing. Earlier heads of the same PR (after a force-push) are still in range, so incremental review chains still reach their whole review. A value that is not a UTC timestamp leaves the listing unbounded.
  • babysit_merge._lane_evidence passes the REST pull object's created_at.
  • Changelog fragment (source-control, patch).

Runs created before the PR existed cannot hold its reviews, so no evidence the gate needs is dropped.

Verification

  • python3 -m unittest test_babysit_gh test_babysit_merge_unattended test_babysit_review_evidence: 418 tests OK, including two new ones (the bounded listing URL, and an unbounded listing for a value that is not a timestamp).
  • Pre-push check-affected.sh passed.

Related

GitHub Support's ranked list also names: evidence reads on the verify token, one post-merge check per run, ETag reuse, and a per-candidate call cap. Those are separate changes.

🤖 Generated with Claude Code

collect_lane_runs listed every pull_request run on the head branch. On a
reused branch GitHub labels older runs with the pull request open now, so
a release PR's gate read about 1,000 runs and spent about 4,000 lanes App
calls, exhausting its rate limit (pr-merge runs 39883357253, 39887421299).
The listing now passes created>=<PR created_at>; earlier heads of the same
PR stay in range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 23, 2026 02:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T02:57:06.764846Z 57d138e 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

Copy link
Copy Markdown
Contributor

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

No findings.

I read the whole diff (4 files) and the PR context, and checked _lane_evidence in babysit_merge.py. I did not run the tests or the linter, so the PR's "418 tests OK" is author-claimed and unverified by me.

  • Correctness: Runs of the pull_request event only exist after the PR is opened, so the created=>=<created_at> bound drops no evidence the gate needs. The bound is inclusive, so same-second runs stay in range.
  • Input handling: _lane_evidence receives the REST pull object, which carries created_at. The strict ...Z timestamp check keeps a malformed value from reaching the query string. The >= is percent-encoded and the new test asserts the exact URL.
  • Tests: Both new cases fail without the change: the bounded URL, and the unbounded fallback for x&y.
  • Changelog: A patch bump for a ### Fixed entry fits.
  • Manifests: No plugin.json or marketplace.json changed, so there are no manifest <field> lines.
  • Style (not reported as a finding): One docstring line in collect_lane_runs runs well past the other lines' width, and two new test lines are long. I did not check the repository's line-length configuration, so a linter may or may not flag them.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #9284 (head 57d138e)

No security findings.

The PR adds a created=>=<PR creation time> filter to the lane-run listing that feeds the unattended merge gate (babysit_gh.py, babysit_merge.py, tests, changelog fragment).

  • Injection: The only new input is pr.created_at, which comes from the GitHub API. collect_lane_runs accepts it only if it fully matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ, then URL-encodes it with quote(..., safe=''). A value like x&y falls back to no filter, and a test covers that case. gh_json receives the endpoint as one argument, so no extra query parameter or shell string can be injected.
  • Gate integrity: A listing bounded to runs created since the PR opened is a subset of the old one. Every pull_request run for this PR starts after the PR exists, so no real evidence is dropped, including from earlier heads of the same PR. The filter only excludes runs from earlier PRs that GitHub relabels onto a reused branch. Dropping those cannot let a failed or finding-bearing review of this PR slip past, and it cannot stand in for a missing review of this PR. A missing or malformed created_at leaves the listing unbounded, which behaves as before.
  • Instruction surfaces and manifests: The diff changes no instruction surface (CLAUDE.md, rules, skill or agent bodies, hooks) and no plugin manifest, so no manifest <field> lines apply. The protected-class register was not consulted, since nothing in the diff calls for it.

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