Share one PR facts read between the two hosted review lanes
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- github-actions, javascript, python, shell
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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), everygithub-actions[bot]comment that starts with a lane marker, and the<base_ref>...<head>merge base. It writes them topr-facts.jsonwith the head SHA it read for, and uploads that throughscan-upload. - A new optional
pr-facts-artifactinput onpr-review-cli.yml. When it is set, the generated key, subscription and fallback jobs download the artifact.scope.cjs,build-review-diffand 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.cjskeeps 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.ymlintopr-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 noneeds, 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 ReviewandPR Review Security, so the check namesPR Review / ...andPR 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'scaller=line. The first round after the switch reviews in full, a one-time cost.pr-require-checks.ymlci-statuslanes=andlane_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: theworkflow_runlist dropsPR 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.mjsandscripts/lane-transcripts/pull.mjs.- The docs under
docs/conventions/pr-pipeline/anddocs/contracts/loop-lane/posting-lanes.md.
- Reconcile and reset-tick (
maintenance-reconcile-lost-runs/reconcile.mjsREVIEW_SWITCHES,GATE_JOBS,REVIEW_JOB_PREFIXES, and the whole-run re-run of a kill-switch-stopped review): re-run one lane throughPOST /actions/jobs/{job_id}/rerunon that lane's gate job. GitHub's docs say this re-runs "a job and its dependent jobs" (docs), so the other lane andread-pr-factsare not re-run. A whole-run re-run would review the other lane a second time. babysit_review_evidence.py(_bindattempt and conclusion rules,_lane_job,_kill_switch_stopped,_caller_skipped), withbabysit_merge_policy.pyandbabysit_gh.pylane-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):
- 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. - 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 duplicatepulls.getand comments reads inside each lane. That smaller cut touches only ci-workflowsscope.cjsand 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-factsreads them, and neither lane's review job listspulls/{n}/files,pulls/{n}orissues/{n}/comments. - Both lanes' Check Kill Switch jobs have unchanged steps,
proceedformula, 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 asstoppedand 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-factshascontents: readandpull-requests: readonly. - 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.
- 主要语言
- Shell
- 星标
- 22
- 派生
- 2
- 平均合并
- 2 小时
- 30 天内合并 PR
- 960
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
melodic-software/claude-code-plugins 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
melodic-software/claude-code-plugins#19225 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
melodic-software/claude-code-plugins#17779 · 2 条评论 ·
维护者通常 1 天内回复
-
recurring
难度 4/5 3-5 天 新手友好度 25/100
melodic-software/claude-code-plugins#19274 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
melodic-software/claude-code-plugins#19270 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 53/100
melodic-software/claude-code-plugins#19269 ·
维护者通常 1 天内回复
查看 melodic-software/claude-code-plugins 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
nais/attest-sign#139 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
community-scripts/core#303 ·
维护者通常 1 天内回复
-
severity: low
难度 1/5 1 小时以内 新手友好度 72/100
luainkernel/lunatik#2727 ·
维护者通常 1 天内回复
-
[quality] release publish.mjs integrity guards have no unit test可能已有人在做 @robarnold 今天认领。 未关闭agent/quality stage/040-covered-by-pr testing
难度 2/5 1-3 小时 新手友好度 75/100
marinatedconcrete/config#1155 ·
维护者通常 1 天内回复
-
bug report-to-upstream
难度 1/5 1 小时以内 新手友好度 75/100
flatpark/flatpark#1585 · 1 条评论 ·
维护者通常 1 天内回复