babysit-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHold one PR until it is merge-ready: poll, classify, fix, push, poll again. Terminal states are merged, closed, needs-user. Nothing else ends the loop, not a push, not a green run, not a report.
守护一个 PR,直到其可以合并:轮询、分类、修复、推送、再轮询。终止状态为 merged、closed、needs-user。除此之外,没有任何其他情况会结束循环:不会因为推送、CI 变绿或报告而结束。
Loop
循环
Each pass:
- Snapshot. . Carry the previous pass's
bash scripts/pr-state.sh <pr> [--since <lastPushAt>]intolastPushAt, so only review items newer than your last push surface.--since - Terminal first. is
stateorMERGED: report it and stop.CLOSED - Review items before CI. A fix commit retriggers CI, so answering review first avoids spending a rerun on a SHA you are about to replace.
- CI. For each check with a failing , run
conclusionbefore touching code.bash scripts/classify-failure.sh <check-url> - Push. Commit on the PR head branch, push, then return to step 1 on the new SHA.
- Wait. blocks until the checks settle, then prints a fresh snapshot. Use it instead of sleeping. Cap it with
bash scripts/watch.sh <pr>, default 60.BABYSIT_MAX_MINUTES
每轮:
- 快照。 运行 。将上一轮的
bash scripts/pr-state.sh <pr> [--since <lastPushAt>]传入lastPushAt,这样只会看到上次推送之后新增的审查项。--since - 先检查终止状态。 如果 是
state或MERGED:报告并停止。CLOSED - 先处理审查项,再处理 CI。 修复提交会重新触发 CI,所以先回应审查可以避免在即将替换的 SHA 上浪费一次 CI 重新运行。
- CI。 对于每个 为失败的检查,在修改代码之前先运行
conclusion。bash scripts/classify-failure.sh <check-url> - 推送。 在 PR 头部分支上提交、推送,然后基于新的 SHA 返回步骤 1。
- 等待。 运行 ,它会阻塞直到检查状态稳定,然后打印一份新的快照。用它代替 sleep。可通过
bash scripts/watch.sh <pr>设置超时,默认 60 分钟。BABYSIT_MAX_MINUTES
Rules
规则
- Published and fresh only. Act on review items whose or
submittedAtis newer thancreatedAt.lastPushAtdropspr-state.shreviews: a reviewer still drafting has not spoken yet. An item answered before the last push stays answered.PENDING - Classify a failure, then act on the class. prints
classify-failure.shorflakyfrom log evidence, then the first 20 failing lines.real: patch the branch.real: rerun it withflaky, budget 3 reruns per failing check; budget spent means needs-user. While a failure readsgh run rerun <run-id> --failed, leave tests, build scripts, CI config and dependency pins as they are. A patch that only silences infra hides the signal for everyone downstream.flaky - Humans get the user's words, not yours. A human reviewer is any that is neither the PR author nor flagged
reviews[].author. Surface their item to the user with a suggested reply, and wait for explicit confirmation before posting anything to GitHub. Bot items you act on and resolve yourself.isBot - Resolve what you fixed. Once the fix is pushed: , using
bash scripts/resolve-thread.sh <threadId>from the snapshot.threads[].id - Merge is the user's call. The sign-off rule (): staged means done, committed means signed off. Stop at green and report. Run
.claude/rules/workflow-sign-off.mdonly when invoked withgh pr merge <pr> --auto --squash, or when the user says merge in this session.--merge - Green is a milestone, not an exit. No failing check, , no unresolved thread: report "ready to merge", then keep polling. Late review items still land while the PR is open.
mergeable: MERGEABLE
- 只处理已发布且新鲜的审查项。 只对 或
submittedAt晚于createdAt的审查项采取行动。lastPushAt会过滤掉pr-state.sh状态的审查:审查者还在起草,尚未发表意见。上次推送前已答复的项保持已答复状态。PENDING - 先归类失败,再按类别行动。 会根据日志证据输出
classify-failure.sh或flaky,以及前 20 行失败日志。如果是real:修复分支。如果是real:使用flaky重新运行;每个失败的检查预算为 3 次重新运行;预算用尽即视为 needs-user。当失败判定为gh run rerun <run-id> --failed时,不要改动测试、构建脚本、CI 配置或依赖锁定。一个仅仅掩盖基础设施问题的补丁会为下游所有人掩盖信号。flaky - 人类审查者看到的是用户的话,而不是你的话。 人类审查者是指既不是 PR 作者、也未被标记为 的
isBot。将他们的审查项连同建议回复展示给用户,在获得用户明确确认后再向 GitHub 发布任何内容。Bot 的审查项由你自行处理并解决。reviews[].author - 解决你已修复的线程。 推送修复后:运行 ,使用快照中的
bash scripts/resolve-thread.sh <threadId>。threads[].id - 合并由用户决定。 签署规则():staged 表示完成,committed 表示已签字。停在绿色状态并报告。只有在用户使用
.claude/rules/workflow-sign-off.md参数调用,或在本会话中明确说 merge 时,才运行--merge。gh pr merge <pr> --auto --squash - 绿色是一个里程碑,而不是出口。 没有失败的检查、、没有未解决的线程:报告"ready to merge",然后继续轮询。在 PR 仍打开时,后期出现的审查项仍然会被处理。
mergeable: MERGEABLE
Reviewer set
审查者集合
pr-state.sh.skilly/config.jsonjson
{ "review": { "bots": ["chatgpt-codex-connector[bot]", "some-reviewer"] } }A login ending in also counts. Missing key or missing file means an empty list, and every reviewer but the PR author reads as human. Read the config each run; keep no login in your head.
[bot]pr-state.sh.skilly/config.jsonjson
{ "review": { "bots": ["chatgpt-codex-connector[bot]", "some-reviewer"] } }以 结尾的登录名也会被识别。如果缺少该键或文件,则视为空列表,除 PR 作者外的所有审查者都会被视为人类。每次运行都读取配置;不要在心里记住任何登录名。
[bot]CI
CI
Checks are whatever the PR reports. The repo's tier in decides the set (the skill explains tiers). is the one check every tier runs, so a red is always a statement about this branch.
.skilly/config.jsonverifyverifyverify检查项就是 PR 所报告的那些项。 中仓库的 tier 决定了检查集合( skill 会解释 tier)。 是所有 tier 都会运行的一项检查,因此红色的 始终是对该分支状态的判定。
.skilly/config.jsonverifyverifyverifyCommits
提交
Conventional commit, prefix by content: when a check was red, for a lint or config nit. Add one body line, so the origin of the change stays greppable:
fix:chore:Babysit-pr: fixes review thread <thread-url>遵循 Conventional Commits 规范,按内容使用前缀:当检查为红色时用 ,对于 lint 或配置小问题用 。添加一行 body,以便变更来源可被 grep 到:
fix:chore:Babysit-pr: fixes review thread <thread-url>Report
报告
Close every pass with: head SHA, check tally, mergeability, what was pushed, reruns spent, what is still open.
每轮结束时报告:head SHA、检查统计、可合并性、推送了什么、消耗的重新运行次数、仍待处理的事项。