Share one PR facts read between the two hosted review lanes

Offen
#19,247 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
20/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
github-actions, javascript, python, shell

Rechercherichtung

Start by reading .github/workflows/pr-review-hosted.yml, .github/workflows/pr-review-security-hosted.yml, and the referenced owner decision rows 311 and 444. Then trace the lane readers, ci-status, reconcile, and babysit evidence paths named in the issue; the acceptance criteria define the checks, including fallback tests and measured API-call savings. This spans two phases, many files, and unresolved design choices.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

session-owned

Context

Owner row 311 of melodic-software/architecture docs/owner-decisions.md (line 311), verbatim:

The review-lane trigger change recorded just above is revised: nothing is built now. The Wait For Refine poll stays (about 4 GITHUB_TOKEN calls per waiting run, at most about 1,120 a day); refine cannot fire workflow_run, because runs started by GITHUB_TOKEN fire no events except dispatch, and a dispatched review would move the trust boundary and lose the pull_request run that ci-status requires. The shared start check (about 1,430 calls a day, needing both lanes in one workflow and a ci-status and reconcile rewrite) comes next only if the GITHUB_TOKEN pool still runs dry after melodic-software/claude-code-plugins#18017 and #18025 (GitHub Optimization), 2026-11-21 by ~20:5xZ (3:5x PM EST), answered in the GitHub Optimization session in melodic-software/claude-code-plugins and relayed to the hub through GitHub Work. Question (as relayed): "keep the Wait For Refine poll, build nothing now; the shared start check is next only if the GITHUB_TOKEN pool still runs dry after #18017 and #18025". Answer: the owner invoked /session-flow:go-with-recommendations.

The condition holds: #18017 and #18025 merged on 2026-11-21, and on 2026-11-25 the kill-switch defer gate held both review lanes on 7 or more heads.

Measured in #19233 (2026-11-26 00:00-01:00Z): each lane's PR Review / Review Subscription and PR Review Security / Review Subscription job spends 7.2 core calls per run, 9.4 per head for the two (4.4% of the window). The reads are the same in both lanes. Per run, over 5 samples: compare 2.6, pulls/{n}/files 1.8 (with the page-2 calls), issues/{n}/comments 1, pulls/{n} 1, contents 0.8. They come from ci-workflows resolve-review-scope/scope.cjs (listComments, listFiles, pulls.get, compareCommitsWithBasehead), build-review-diff, and the Find executables and archives step of pr-review-cli.yml.

Constraint, owner row 444 (line 444): the two hosted review lanes keep their gate-only Check Kill Switch jobs. The kill-switch gate's steps, its proceed formula, its defer behavior (defer: "true", defer-job: review) and its fail-closed outcomes (the Report the kill switch notice, and the Stop on upstream status failure) stay exactly as they are.

Why one workflow: a read can be shared only inside one workflow run. The model jobs run with cache-mode: none (pr-review-cli.yml:151), so they share no Actions cache. Downloading an artifact from another run would need a run lookup, and it would trust an artifact that any workflow on a pull request branch could upload.

Proposed work

Phase 1, ci-workflows (one PR):

  • A new composite action, read-pr-facts, run in a job that holds no model credential and runs no head code. It reads once: pulls.get (live head, changed_files), listFiles (filename, previous_filename, status, patch), every github-actions[bot] comment that starts with a lane marker, and the <base_ref>...<head> merge base. It writes them to pr-facts.json with the head SHA it read for, and uploads that through scan-upload.
  • A new optional pr-facts-artifact input on pr-review-cli.yml. When it is set, the generated key, subscription and fallback jobs download the artifact. scope.cjs, build-review-diff and the executables step then read from it instead of the API. A missing or unparseable file, or one written for another head, falls back to today's API reads. A fallback never adds a skip.
  • scope.cjs keeps its rule that the file list and the live-head check come from one snapshot. A skip still trusts the list only when the snapshot's live head is the run's head.

Phase 2, claude-code-plugins (one PR, or two if pr-size requires it):

  • Fold pr-review-security-hosted.yml into pr-review-hosted.yml, and keep the path of the code lane, which most readers already key on. Jobs:
    • check-kill-switch: unchanged.
    • check-kill-switch-security: the security lane's gate, steps unchanged, display name to be decided (open question 1).
    • read-pr-facts: has no needs, so it runs in parallel with the gates and adds no queue step before a review.
    • pr-review: needs [check-kill-switch, read-pr-facts].
    • pr-review-security: needs [check-kill-switch-security, read-pr-facts].
    • The caller job display names stay PR Review and PR Review Security, so the check names PR Review / ... and PR Review Security / ... stay the same.
  • Keep the workflow-level concurrency group, so a round's facts are read only after both lanes' previous round has published its markers.
  • Change each reader from a one-lane-per-workflow map to one keyed by workflow and job:
    • .github/lane-registry.json: the footer moves per caller job.
    • .github/scripts/lib/lane-binding.mjs, plugins/review/lib/lane-binding.mjs, plugins/work-items/lib/lane-binding.mjs.
    • .github/source-control-settings.json (caller=) and the marker's caller= line. The first round after the switch reviews in full, a one-time cost.
    • pr-require-checks.yml ci-status lanes= and lane_run / lane_at: lane state is read from the lane's own jobs, never from the run's status or conclusion.
    • merge-holds.mjs (the cost-hold and status-name maps).
    • rerun-ci-status.sh: there is no sibling workflow left to wait for.
    • pr-dispatch-feedback.yml: the workflow_run list drops PR Review Security Hosted.
    • resolve-config/lane-rules.json, lane-funding.json, pr-run-activity-*.yml, pr-unblock/feedback-dispatch.mjs, pr-merge/clear-escalations.mjs, scripts/sync-hold-floor.py (hold-paths), upstream-apply-changelog.mjs and scripts/lane-transcripts/pull.mjs.
    • The docs under docs/conventions/pr-pipeline/ and docs/contracts/loop-lane/posting-lanes.md.
  • Reconcile and reset-tick (maintenance-reconcile-lost-runs/reconcile.mjs REVIEW_SWITCHES, GATE_JOBS, REVIEW_JOB_PREFIXES, and the whole-run re-run of a kill-switch-stopped review): re-run one lane through POST /actions/jobs/{job_id}/rerun on that lane's gate job. GitHub's docs say this re-runs "a job and its dependent jobs" (docs), so the other lane and read-pr-facts are not re-run. A whole-run re-run would review the other lane a second time.
  • babysit_review_evidence.py (_bind attempt and conclusion rules, _lane_job, _kill_switch_stopped, _caller_skipped), with babysit_merge_policy.py and babysit_gh.py lane-run listing. Today a lane binds only when the run concluded success at run attempt 1 or 2. In one run, the other lane's failure or re-run would change both. The rules move to the lane's own jobs: their conclusion, and how many times that lane's gate job ran.

Expected saving: the second lane's reads go, about 4.8 of its 7.2 core calls per run. At 0.65 lane runs per head, that is about 3.1 core calls per head. One Rerun CI Status per review round also goes (1.2 calls a run, about 0.8 per head). Total about 3.9 of the 9.4 calls per head, about 90 calls in a busy hour of 23 heads (about 1.8% of the window). Row 311's own estimate is about 1,430 a day.

Open questions (rows 311 and 444 do not settle them):

  1. Row 444 keeps both Check Kill Switch jobs. In one workflow the second one needs a different display name (for example Check Kill Switch Security), and ci-status, reconcile and babysit read the gate by that name. Recommended: allow the rename and keep the steps byte for byte the same. Alternative: keep two workflow files, which leaves no shared read at all.
  2. The cost found in this design was not in row 311's wording: the merge gate's evidence binding ties a review to the run's attempt number and conclusion, and so does ci-status's run_status. Both need a per-lane rewrite, a change to merge-gate evidence. Recommended: decide before phase 2 whether to build all of it, or first cut the duplicate pulls.get and comments reads inside each lane. That smaller cut touches only ci-workflows scope.cjs and saves about 2.6 calls per head; phase 2 would then come only if the pool still runs dry.

Acceptance criteria

  • On one pull request head, the hosted review workflow's API-call notices show the PR facts read once: read-pr-facts reads them, and neither lane's review job lists pulls/{n}/files, pulls/{n} or issues/{n}/comments.
  • Both lanes' Check Kill Switch jobs have unchanged steps, proceed formula, defer settings and fail-closed outcomes (diff against main shows only the job id or display name).
  • A lane with its facts artifact deleted or corrupted reviews as it does today: the API fallback, never a skip. A test proves it.
  • With one lane's switch set (CLAUDE_SECURITY_REVIEW_DISABLED=true), the other lane reviews, and ci-status reports the stopped lane as stopped and the other from its own jobs.
  • The reconciler re-runs only the deferred lane's gate job and its dependents. The other lane's review job keeps its attempt-1 run. A test covers it, and one live re-run is observed.
  • The babysit merge gate binds a lane that passed when the other lane failed or was re-run, and still refuses a lane past its allowed re-runs.
  • No job that holds a model credential gains a permission, a cache, or a head-code execution step. read-pr-facts has contents: read and pull-requests: read only.
  • On a later busy hour, the measured core calls per head for the review lanes fall by at least 3, with the numbers in the closing PR.

References

  • Refs: #19233
  • Owner rows 311 and 444 (links above). Row 310 is the trigger change that row 311 revises.
  • ci-workflows#1235 and #19243 change the same review-lane files. This work starts after they merge.
  • ci-workflows .github/workflows/pr-review-cli.yml, .github/actions/resolve-review-scope/scope.cjs.
  • .github/workflows/pr-review-hosted.yml, .github/workflows/pr-review-security-hosted.yml, .github/workflows/pr-require-checks.yml, .github/scripts/maintenance-reconcile-lost-runs/reconcile.mjs, plugins/source-control/skills/babysit-prs/scripts/babysit_review_evidence.py.
Vorherrschende Sprache
Shell
Sterne
22
Forks
2
Ø Merge
2 Std.
Gemergte PRs (30 T.)
960

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus melodic-software/claude-code-plugins

Alle Issues in melodic-software/claude-code-plugins

Ähnliche Issues

Weitere Issues zu Shell/Bash

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.