Skip to content

feat: multi-agent parallel code review#4

Merged
Svtter merged 4 commits into
mainfrom
ci/add-opencode-review
May 19, 2026
Merged

feat: multi-agent parallel code review#4
Svtter merged 4 commits into
mainfrom
ci/add-opencode-review

Conversation

@Svtter
Copy link
Copy Markdown
Contributor

@Svtter Svtter commented May 19, 2026

Summary

  • Add parallel review mode with dimension-based sub-agents (code-quality, security, performance, testing, documentation)
  • Add orchestrator prompt that dispatches sub-agents, collects results, and produces a unified report
  • Add parallel config option (default: true) to toggle between single-agent and multi-agent modes
  • Include bilingual dimension prompts (zh/en) with structured output format

Test plan

  • Verify parallel: true spawns dimension sub-agents correctly
  • Verify parallel: false falls back to single-agent review
  • Test with different dimensions and language config combinations
  • Confirm unified report merges results by severity

🤖 Generated with Claude Code

Svtter and others added 2 commits May 19, 2026 18:03
Add parallel review mode that dispatches specialized dimension sub-agents
(code-quality, security, performance, testing, documentation) and collects
results into a unified report. Includes dimension prompt templates with
bilingual support (zh/en) and orchestrator prompt for coordinating sub-agents.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Merge origin/main into ci/add-opencode-review, combining toggle-auto-review
and parallel dimension sub-agent imports.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

可合并

PR 实现了多代理并行代码审查功能,架构清晰(orchestrator + dimension sub-agents),双语 prompt 设计合理,与现有代码风格一致。

阻塞项:无

建议项:

  1. src/index.ts:11getDimensionPrompts(config)parallel=false 时也被无条件调用,可移入第 55 行的 if (config.parallel) 块内避免冗余计算
  2. src/dimensions/index.ts:132config.dimensions 中未在 DIMENSIONS 中定义的维度被静默忽略(filter 过滤),建议添加 console.warn 提示用户配置了未知维度名
  3. src/index.ts:60 — 维度子代理的 steps: 15 对于完整代码审查可能偏少(每个子代理需 read 文件、review_changes、分析),建议增至 20-25 或改为可配置
  4. src/config.ts:32parallel 默认值为 true 是对原有单代理行为的 breaking change,建议在 README/CHANGELOG 中注明,或考虑默认 false 以保持向后兼容
  5. 未包含任何测试文件(UT/e2e),对于 257 行新增功能代码建议补充基础单元测试

New%20session%20-%202026-05-19T10%3A06%3A53.171Z
opencode session  |  github run

Svtter and others added 2 commits May 19, 2026 18:21
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bun shell template literals don't support variable command interpolation,
causing "undefined is not a function" errors. Wrap all git commands in
`bash -c ${cmd}` to avoid the issue.

Also dedup dimension config with Set and extract shared report format
constants in agent.ts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

可合并

PR 实现了多代理并行代码审查功能,架构设计合理(orchestrator + dimension sub-agents),双语 prompt 覆盖完整,与现有代码风格一致,无明显逻辑错误或安全问题。

阻塞项:无

建议项:

  1. src/dimensions/index.ts:132 — 未知维度名被 .filter() 静默忽略,应添加 console.warn 提示用户配置错误
  2. src/index.ts:11getDimensionPrompts(config)parallel=false 时也被无条件调用,可移入第 55 行的 if (config.parallel) 块内避免冗余
  3. src/config.ts:32parallel 默认 true 将改变已有用户的单代理行为(breaking change),建议 CHANGELOG/README 注明或默认 false 以保持向后兼容
  4. src/index.ts:57-68 — 维度子代理配置中没有显式启用 read/grep/glob 工具,若框架非默认启用则子代理无法按 prompt 指令读取代码,建议与 review:fixer 保持一致,显式允许这些工具

New%20session%20-%202026-05-19T10%3A23%3A11.449Z
opencode session  |  github run

@github-actions
Copy link
Copy Markdown

可合并

PR 实现了多代理并行代码审查功能,架构设计合理(orchestrator + dimension sub-agents),双语 prompt 覆盖完整,与现有代码风格一致,无明显逻辑错误或安全问题。

阻塞项:无

建议项:

  1. src/dimensions/index.ts:132config.dimensions 中未在 DIMENSIONS 中定义的维度被 .filter() 静默丢弃,建议添加 console.warn 提示用户配置了未知维度名
  2. src/agent.ts:104 / src/index.ts:11getDimensionPrompts(config) 在模块顶层和 buildParallelPrompt 内被重复调用(当 parallel: true 时调用两次),建议只在顶层缓存一次,或移入 if (config.parallel) 块内
  3. src/agent.ts:4 定义的 DIMENSION_LABELSsrc/dimensions/index.ts:9 定义的 DIMENSIONS 维护相同维度键集合,两者可能不同步,建议统一为一个数据源
  4. src/config.ts:32parallel 默认 true 对已有用户构成 breaking change(行为从单代理变为多代理),建议在 CHANGELOG/README 中注明
  5. src/index.ts:61-65 — 维度子代理未显式启用 read/grep/glob 工具,而其 prompt 中的审查要点隐含了阅读上下文的能力,建议与 review:fixer(第 48-50 行)保持一致显式允许这些工具
  6. design.md Decision 4 要求"每个维度一个文件"(如 security.tscode-quality.ts),但实际实现将全部内容放在 src/dimensions/index.ts 中,建议要么拆分文件对齐设计,要么更新设计文档
  7. 未包含任何测试文件,对于 138 行新增维度模块和 108 行 agent 重构建议补充基础单元测试(如 getDimensionPrompts 过滤逻辑、buildAgentPrompt 分支选择)

New%20session%20-%202026-05-19T10%3A25%3A36.857Z
opencode session  |  github run

@Svtter Svtter merged commit 879fa2d into main May 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant