feat(multi-review): add multi-agent parallel code review action#81
Conversation
Introduces a new `multi-review` action that runs multiple reviewer personas (quality, security, performance, architecture) in parallel via Python subprocess, then synthesizes a unified report through a coordinator agent with dedup, cross-validation, and conflict resolution. Key features: - 4 built-in reviewer personas with domain-specific prompts - Parallel execution on a single GitHub Actions runner - Coordinator synthesis with multi-reviewer confirmation markers - Custom personas via YAML config file - Reviewer redundancy (multiple instances of same persona) - Model fallback per reviewer - Read-only enforcement for all agents Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
有条件合并 总结该 PR 新增了一个功能丰富的 multi-review 并行代码审查 action,整体设计合理,代码结构清晰,测试覆盖较好(21/21)。但存在若干需要修复和可改进的问题。 阻塞项
建议项
|
|
发现遗漏 摘要PR 实现了核心并行审查与协调框架,但在关键集成点、输入接线和错误处理上存在遗漏。 CRITICAL1. 最终合成评论(含可折叠详情)未发布到 PR
MEDIUM2.
3. 自定义 YAML 配置文件在 PyYAML 不可用时静默解析失败
LOW4.
|
- Extract _run_opencode() to deduplicate subprocess run pattern between run_reviewer and run_coordinator - Extract _truncate() to deduplicate output truncation logic - Extract _flush() helper in _parse_simple_yaml for cleaner key flushing - Replace 9-line set_env forwarding with data-driven mapping loop - Simplify extra-env parsing to remove intermediate variables - Remove unused imports (glob, Future, json, tempfile, textwrap, MagicMock) All 21 tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
架构有疑虑 该 PR 新增的 阻塞项:无 建议项:
|
|
No linked issues. Extracting requirements from PR body and README. Comparing implementation to spec. 发现遗漏 摘要PR 实现了核心并行审查框架,但存在 1 处关键集成缺口、1 处中等遗漏和 1 处轻微遗漏。 CRITICAL1. 最终格式化合结果(含可折叠详情)未发布到 PR
MEDIUM2.
LOW3.
|
|
架构有疑虑 该 PR 新增的 阻塞项:无 建议项:
|
- Post synthesized comment via `gh pr comment` instead of stdout only; suppress per-agent PR comments by setting USE_GITHUB_TOKEN=false in subprocess env - Wire `model-timeout-seconds` input to MULTI_REVIEW_MODEL_TIMEOUT_SECONDS env var and read it in Python as separate per-model timeout - Add missing `model-timeout-seconds` and `fallback-on-regex` to README inputs table - Fix org name: update all `Svtter/` references to `sun-praise/` in both multi-review README and root README - Isolate env vars in `test_generic_model_always_supported` with clear=True Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ection - Extract shared PR context detection (ref parsing + repo lookup) into _get_pr_context() used by both post_pr_comment and cleanup_error_comments - Remove --paginate from cleanup_error_comments gh api call (avoids multi-page JSON concatenation issue flagged in review) - Rename shadowed `body` variable to `comment_body` in cleanup loop Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
架构有疑虑 架构分析该 PR 新增的 1. 绕过
|
| 功能 | run-github-opencode.py |
run-multi-review.py |
|---|---|---|
| API key 过滤 | supports_model_with_available_key (L33-40) |
_supports_model (L267-274) |
| Error comment 清理 | cleanup_error_comments (L168-243) |
cleanup_error_comments (L395-449) |
| opencode.json 配置 | configure_opencode_json (L71-112) |
内联逻辑 (L514-538) |
| Model fallback 循环 | _main 中的循环 (L377-426) |
run_reviewer 中的循环 (L228-264) |
后续若在单审模式中修复 bug(如改进 fallback 正则匹配、优化 error comment URL 检测、调整 thinking 配置字段),multi-review 必须手动同步,存在维护分歧风险。建议将公共逻辑抽取到 github-run-opencode/shared.py 供两个脚本引用。
2. 输出策略对 USE_GITHUB_TOKEN=false 的行为有脆弱依赖
README 承诺 "The final output is posted as a single PR comment with collapsible sections"。实现中通过在 _run_opencode 设置 env["USE_GITHUB_TOKEN"] = "false"(L197)来抑制各 reviewer 子进程独立发评论,再由 post_pr_comment 统一发布。但若 opencode CLI 在 USE_GITHUB_TOKEN=false 时仍通过自有 GitHub App token 发表评论,PR 上将出现 N+1 条独立原始评论 + 1 条合成评论。这一设计决策将输出完整性建立在底层 CLI 的特定环境变量行为上,缺乏防御性措施。
3. 接口内聚性:run_reviewer 承载过多职责
run_reviewer 函数(L210-265)同时负责:
- 候选模型列表构建与 API key 过滤
- 全局 deadline 与 model timeout 的混合计算
- Fallback 循环与退出条件判断
- 异常处理和结果封装
建议将模型选取策略(candidate composition + timeout computation)与 reviewer 执行逻辑分离,使职责更清晰。
阻塞项:无
建议项:
- 将
_supports_model、cleanup_error_comments、opencode.json 配置、fallback timeout 计算等公共逻辑抽取到github-run-opencode/shared.py,消除 Layer 2 与multi-review之间的维护分歧。 - 在
_run_opencode中增加USE_GITHUB_TOKEN=false失效时的降级策略(如事后清理多余评论,或改用gh api而非opencode github run来避免自动发评论)。 - 将
run_reviewer中的模型选取/超时计算逻辑(L222-238)抽取为独立函数,与 reviewer 执行逻辑解耦。
|
发现遗漏 摘要PR 实现了核心并行审查框架,所有声明的功能均有对应代码。但存在若干中低严重度的缺口。 MEDIUM1.
2. 自定义 YAML 审查者配置在 PyYAML 不可用时静默忽略
LOW3.
4.
5.
6.
|
|
发现遗漏 摘要PR 实现了核心并行审查与协调框架,但在自定义 YAML 配置的降级路径中存在关键功能丢失。 MEDIUM1.
LOW2.
|
|
不可合并 总结PR 实现了 multi-agent 并行代码审查的核心框架,整体设计合理,代码结构清晰。但存在一处运行时崩溃的阻塞 bug: 阻塞项
建议项
|
|
基于对当前代码(HEAD 版本)的全面审查,以下是审核意见。 可合并 总结PR 实现了功能完整的 multi-review 并行审查 action,代码结构清晰,测试覆盖良好(21/21),符合项目既有约定(composite action、Linux-only 检查、version 解析、cache 配置等)。核心逻辑正确:各 reviewer 通过 阻塞项:无 建议项:
|
|
架构有疑虑 该 PR 新增的 阻塞项:无 建议项:
|
- Remove unused `reviewer_timeout` variable (replaced by `model_timeout` in previous fix but assignment was left behind) - Remove `dict[Future, str]` type hint that referenced unimported Future Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
不可合并 总结PR 实现了功能完整的 multi-review 并行审查框架,架构清晰,测试覆盖良好(21/21),符合项目既有规范。但存在一处运行时崩溃的阻塞 bug。 阻塞项1. 建议项
|
|
发现遗漏 摘要PR 实现了核心并行审查框架,所有四个内置审查角色、协调器合成、模型 fallback、审查员冗余等核心特性均已编码实现。存在 2 处中等和 4 处低严重度遗漏。 MEDIUM1. 协调器超时后的降级评论未发布到 PR
2. 自定义 YAML 配置在 PyYAML 不可用时被静默丢弃
LOW3.
4.
5. README 输入表缺少多个 action 特有输入
6.
|
|
架构有疑虑 该 PR 的 阻塞项:无 建议项:
|
- Call post_pr_comment() in the global-timeout-exceeded fallback path (was only printing to stdout) - Remove dead `reviewer-timeout-seconds` input (was mapped to env var but never read by Python; replaced by `model-timeout-seconds`) - Fix duplicate MULTI_REVIEW_MODEL_TIMEOUT_SECONDS env mapping - Sync fallback-on-regex default in Python with action.yml value - Expand README inputs table: add attempts, retry-profile, retry-delay-seconds, use-github-token, extra-env, cleanup-error-comments; remove removed reviewer-timeout-seconds Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Confirmed: 可合并 总结PR 实现了功能完整的 multi-agent 并行代码审查 action,架构清晰,测试覆盖良好(21/21)。对比此前多轮 review 意见,当前 HEAD 已修正了 阻塞项:无 建议项:
|
|
发现遗漏 摘要PR 实现了核心并行审查框架,所有主要特性(四个内置审查角色、协调器合成、模型 fallback、审查员冗余、单评论输出)均已编码。存在 1 处中等和 2 处低严重度实现缺口。 MEDIUM1. 自定义 YAML 配置文件在 PyYAML 不可用时被静默忽略
LOW2.
3. README 输入表未列出多个共享基础设施输入
|
|
架构有疑虑 架构分析该 PR 新增的 但存在以下架构层面的疑虑: 1. 绕过
|
| 功能 | run-github-opencode.py |
run-multi-review.py |
|---|---|---|
| API key 过滤 | supports_model_with_available_key (L33-40) |
_supports_model (L268-275) |
| Error comment 清理 | cleanup_error_comments (L168-243) |
cleanup_error_comments (L399-450) |
| opencode.json 配置 | configure_opencode_json (L71-112) |
内联逻辑 (L516-538) |
| Fallback timeout 计算 | compute_effective_timeout (L146-165) |
内联计算 (L230-238) |
| Fallback 循环 | _main 中的循环 (L377-426) |
run_reviewer 中的循环 (L228-264) |
后续若在单审模式中修复 bug(如新增 model API key 提供商、改进 fallback 正则检测、优化 error comment 识别逻辑),multi-review 需要手动同步,存在维护分歧风险。虽然并行执行模式(ThreadPoolExecutor)决定了无法直接复用 run-github-opencode.py 的顺序编排流程,但上述辅助函数级别的复用完全可行——应抽取为 github-run-opencode/shared.py。
2. _parse_simple_yaml 对嵌套 YAML 结构静默降级
_parse_simple_yaml(L55-92)只能解析 name: / prompt: 扁平的 key-value 对。当 PyYAML 未安装时,自定义配置文件(README 文档中使用了 personas: [...] 和 reviewers: [...] 嵌套列表格式)会被扁平解析处理,custom_data.get("personas", []) 返回空列表。自定义 reviewer persona 定义和 reviewer team 配置被完全静默忽略,无任何错误或警告,用户得到的仍是默认 quality:1,security:1 团队。这是接口声明能力与降级路径实际表现的不匹配。
3. opencode.json 读写模式对 JSONC 格式不兼容
L516-538 使用 json.load 读取 + json.dump 覆写 opencode.json。若原文件含 // 或 /* */ 注释(JSONC 格式,opencode 自身支持),json.load 抛出异常后 config = {},覆写导致原文件内容丢失。此问题与 run-github-opencode.py 中 configure_opencode_json 的行为一致,说明这是项目层面的共性问题,但在 multi-review 中提示了需要更安全的写入策略。
4. env_forward 未映射 OPENCODE_REASONING_EFFORT 和 OPENCODE_ENABLE_THINKING 标准环境变量
L477-490 的 env_forward 字典将 MULTI_REVIEW_REASONING_EFFORT 和 MULTI_REVIEW_ENABLE_THINKING 写入 opencode.json(L525-528),但未映射为标准环境变量名传递给子进程。虽然通过 JSON 配置当前能满足需求,但与 run-github-opencode.py 既有的 OPENCODE_REASONING_EFFORT / OPENCODE_ENABLE_THINKING 转发模式不一致。若 run-opencode.sh 后续版本优先读取环境变量而非 JSON 配置,这两个设置将失效。
阻塞项:无
建议项:
- 将
_supports_model、cleanup_error_comments、configure_opencode_json、compute_effective_timeout等公共辅助函数抽取到github-run-opencode/shared.py,消除multi-review与单审编排层之间的维护分歧。 - 在
_parse_simple_yaml检测到无法解析personas/reviewers等嵌套 key 时,输出stderr警告说明自定义配置将无法生效,并建议安装PyYAML。 - 修改
opencode.json写入策略:json.load失败时不覆写原文件,或先尝试json5/jsonc解析。 - 在
env_forward中补充OPENCODE_REASONING_EFFORT: ("MULTI_REVIEW_REASONING_EFFORT", "")和OPENCODE_ENABLE_THINKING: ("MULTI_REVIEW_ENABLE_THINKING", "true")的映射。

















Summary
multi-reviewaction that runs multiple reviewer personas in parallel (quality, security, performance, architecture) on a single GitHub Actions runnerKey Files
multi-review/action.yml— GitHub Action composite definitionmulti-review/run-multi-review.py— Python orchestrator (parallel subprocess, coordinator synthesis)multi-review/reviewers/*.yaml— Built-in reviewer persona promptsmulti-review/README.md— Usage documentationtests/test_multi_review.py— 21 unit testsDesign Decisions
Test plan
multi-reviewaction🤖 Generated with Claude Code