pr-address-bot-reviews

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PR Address Bot Reviews

处理PR机器人评审反馈

Triage and resolve bot-generated PR feedback with a consistent workflow.
通过一致的工作流分类并解决机器人生成的PR反馈。

Supported Sources

支持的来源

  • coderabbitai[bot]
  • chatgpt-codex-operator
Add more bot logins when needed.
  • coderabbitai[bot]
  • chatgpt-codex-operator
需要时可添加更多机器人登录账号。

Workflow

工作流

1. Collect Feedback

1. 收集反馈

  • Identify the target PR number (from current branch PR or user input).
  • Fetch PR review data with
    gh
    :
    • reviews
    • review comments
    • issue comments
  • Filter feedback to supported bot authors.
  • 确定目标PR编号(从当前分支PR或用户输入获取)。
  • 使用
    gh
    获取PR评审数据:
    • 评审记录
    • 评审评论
    • 议题评论
  • 筛选出支持的机器人作者的反馈。

2. Normalize and Group

2. 标准化与分组

  • Deduplicate repeated suggestions.
  • Group by file/path and concern type:
    • correctness/bug risk
    • security
    • performance
    • maintainability/style
    • test/documentation gaps
  • 去重重复的建议。
  • 按文件/路径和问题类型分组:
    • 正确性/ bug风险
    • 安全性
    • 性能
    • 可维护性/风格
    • 测试/文档缺失

3. Decide Actionability

3. 判定可执行性

Classify each item into:
  • must-fix
    : clear bug/risk/regression
  • should-fix
    : strong improvement with low downside
  • skip-with-reason
    : incorrect assumption, out-of-scope, or high-cost low-value
  • needs-user-decision
    : product/architecture tradeoff
将每个项分类为:
  • 必须修复
    :明确的bug/风险/回归问题
  • 建议修复
    :提升效果显著且负面影响小
  • 跳过并说明原因
    :假设错误、超出范围或高成本低价值
  • 需用户决策
    :产品/架构权衡问题

4. Implement Needed Changes

4. 实施必要变更

  • Apply
    must-fix
    and agreed
    should-fix
    items.
  • Keep changes scoped to the PR intent.
  • Run relevant checks/tests for touched areas.
  • 应用
    必须修复
    和已确认的
    建议修复
    项。
  • 保持变更范围与PR的初衷一致。
  • 对涉及的区域运行相关检查/测试。

5. Respond on PR

5. 在PR上回复

  • For fixed items: reply with what changed.
  • For skipped items: reply with concise rationale.
  • For tradeoffs: ask explicit decision questions.
  • Reply in the correct channel:
    • Inline review thread: prefer
      skills/pr-address-bot-reviews/scripts/reply-to-review-comment <pr> --login <bot-login> --path <file> [--line <line>] "<response>"
    • Lower-level flow remains available:
      find-review-comment-id
      then
      pr-thread-reply
    • General PR note: use
      gh pr comment
  • 已修复项:回复说明变更内容。
  • 跳过项:回复简洁的理由。
  • 权衡项:提出明确的决策问题。
  • 在正确的渠道回复:
    • 内联评审线程:优先使用
      skills/pr-address-bot-reviews/scripts/reply-to-review-comment <pr> --login <bot-login> --path <file> [--line <line>] "<response>"
    • 仍可使用底层流程:
      find-review-comment-id
      然后
      pr-thread-reply
    • 通用PR备注:使用
      gh pr comment

6. Report Back to User

6. 向用户反馈

  • Summarize by category:
    • fixed
    • skipped (with reason)
    • pending decision
  • Provide changed files and verification commands run.
  • 按类别汇总:
    • 已修复
    • 已跳过(含原因)
    • 待决策
  • 提供变更的文件和运行的验证命令。

Decision Heuristics

决策准则

  • Prefer concrete evidence over bot confidence.
  • Reject suggestions that conflict with project conventions.
  • Reject speculative refactors that increase scope without reducing risk.
  • Escalate when the fix changes behavior, API contract, or data model.
  • 优先依据具体证据而非机器人的置信度。
  • 拒绝与项目惯例冲突的建议。
  • 拒绝增加范围却未降低风险的推测性重构。
  • 当修复会改变行为、API契约或数据模型时,需升级处理。

Minimal Command Sequence

最简命令序列

bash
gh pr view <number> --json number,title,body,reviews,comments,files
gh pr view <number> --comments
bash
gh pr view <number> --json number,title,body,reviews,comments,files
gh pr view <number> --comments

preferred single-command inline review reply flow

推荐的单命令内联评审回复流程

skills/pr-address-bot-reviews/scripts/reply-to-review-comment <number> --login <bot-login> --path <file> [--line <line>] "<response>"
skills/pr-address-bot-reviews/scripts/reply-to-review-comment <number> --login <bot-login> --path <file> [--line <line>] "<response>"

lower-level two-step flow when you want explicit control

需明确控制时使用的两步底层流程

skills/pr-address-bot-reviews/scripts/find-review-comment-id <number> --login <bot-login> --path <file> [--line <line>] skills/pr-address-bot-reviews/scripts/pr-thread-reply <number> <comment_id> "<response>"
skills/pr-address-bot-reviews/scripts/find-review-comment-id <number> --login <bot-login> --path <file> [--line <line>] skills/pr-address-bot-reviews/scripts/pr-thread-reply <number> <comment_id> "<response>"

optional general PR note

可选的通用PR备注

gh pr comment <number> --body "<response>"
gh pr comment <number> --body "<response>"

implement code changes

实施代码变更

git add <files...> git commit -m "<message>" git push
undefined
git add <files...> git commit -m "<message>" git push
undefined

Script Split

脚本拆分

  • scripts/reply-to-review-comment
    : thin entrypoint that resolves the target review comment id and posts the reply
  • scripts/find-review-comment-id
    : resolve a single inline review comment id from
    bot login + path + optional line
  • scripts/pr-thread-reply
    : post a reply to a known inline review comment id
This keeps comment discovery and reply posting separate internally while still exposing a one-command path for routine use.
  • scripts/reply-to-review-comment
    :轻量级入口,用于解析目标评审评论ID并发布回复
  • scripts/find-review-comment-id
    :通过
    机器人登录账号 + 路径 + 可选行号
    解析单个内联评审评论ID
  • scripts/pr-thread-reply
    :向已知的内联评审评论ID发布回复
这种设计在内部将评论发现和回复发布分离,同时仍为日常使用提供了单命令路径。