pr-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

pr-loop

pr-loop

Status: scaffold. Implementation lands in Phase 1 per
docs/specs/2026-04-30-multi-cli-orchestrator-design.md
.
状态:框架搭建中。具体实现将根据
docs/specs/2026-04-30-multi-cli-orchestrator-design.md
在第一阶段完成。

Loop

循环流程

  1. Trigger Codex review (
    @codex review
    comment on the PR or wait for auto-review).
  2. Poll
    gh pr view <n> --json reviews,comments,statusCheckRollup
    until the review completes.
  3. Classify Codex comments:
    • P0/P1 → blocking, must be addressed before merge
    • P2/nit → ignore for merge gating
  4. Round-by-round behavior:
    • Round 1–2: spawn
      pr-fixer
      subagent per blocking comment, push commits.
    • Round 3: route the failing fix to a different worker (OpenCode or Gemini) for a different perspective.
    • Round 4: label PR
      needs-human
      , comment with iteration history, stop.
  5. Stall detection: if the same P0/P1 comment reappears in two consecutive rounds, skip ahead to round 3 (different worker) early.
  1. 触发Codex评审(在PR中添加
    @codex review
    评论,或等待自动评审)。
  2. 轮询
    gh pr view <n> --json reviews,comments,statusCheckRollup
    直到评审完成。
  3. 分类Codex评论:
    • P0/P1 → 阻塞级,合并前必须解决
    • P2/nit → 不影响合并检查,可忽略
  4. 分轮次处理逻辑:
    • 第1-2轮:针对每条阻塞级评论启动
      pr-fixer
      子Agent,推送修复提交。
    • 第3轮:将修复失败的问题转交给其他处理节点(OpenCode或Gemini),获取不同解决方案视角。
    • 第4轮:为PR标记
      needs-human
      标签,添加包含迭代历史的评论,停止循环。
  5. 停滞检测:如果同一P0/P1评论连续两轮重复出现,则提前跳转到第3轮(更换处理节点)。

Merge gates (all must pass)

合并检查项(需全部通过)

  • CI green
  • Tests green
  • Typecheck green
  • Lint green
  • Zero unresolved P0 or P1 Codex comments
  • Branch protection enforced on
    main
When all green: auto-merge, archive the cache directory.
  • CI检查通过
  • 测试用例通过
  • 类型检查通过
  • 代码扫描通过
  • 无未解决的P0或P1级Codex评论
  • main
    分支已启用分支保护
当所有检查项均通过时:自动合并PR,并归档缓存目录。

Subagent

子Agent

agents/claude-code/pr-fixer.md
(Claude Code) and
agents/opencode/pr-fixer.md
(OpenCode) — same role (fix one Codex comment per invocation in isolated context), different frontmatter per CLI. Registered as
pr-loop-pr-fixer
after
scripts/install-agents.sh
runs.
agents/claude-code/pr-fixer.md
(Claude Code)和
agents/opencode/pr-fixer.md
(OpenCode)——两者功能相同(在独立环境中每次调用修复一条Codex评论),仅CLI前置配置不同。执行
scripts/install-agents.sh
后,将注册为
pr-loop-pr-fixer

State

状态存储

.mco-cache/<pr-number>/
(gitignored): per-iteration artifacts — Codex comment dumps, fix summaries, last-known-good diffs.
.mco-cache/<pr-number>/
(已加入git忽略):存储每轮迭代的产物——Codex评论导出文件、修复摘要、上一次有效的差异内容。