Skip to content

OCR 提出的通用 Agent 代码审查三大痛点 #199

Description

@Svtter

背景

alibaba/open-code-review 的 README 对通用 Agent(如 Claude Code + Skills)做代码审查的痛点做了精准总结。这三点对 opencode-actions 同样适用,记录于此作为架构演进的参考。

来源:https://github.com/alibaba/open-code-review#why-open-code-review


痛点 1:Incomplete coverage — 覆盖不全

On larger changesets, agents tend to "cut corners," selectively reviewing only some files and missing others.

大 changeset 时 agent 偷懒,选择性审查,漏文件。

opencode-actions 现状:✅ 基本不受此影响。我们走的是 opencode github run 单次调用,agent 拿到完整 diff。但这更多是依赖 OpenCode 自身的 diff 处理能力,没有独立验证"是否每个文件都被覆盖了"。

风险:当 PR 文件数极多时(50+ files),单次 agent 调用是否真的逐一审查了每个文件?目前没有硬性保障。


痛点 2:Position drift — 位置漂移

Reported issues frequently don't match the actual code location, with line numbers or file references drifting off target.

报告的行号和文件对不上。

opencode-actions 现状:⚠️ 存在此问题。我们的 review 输出是 PR 评论,但行级定位完全依赖 agent 的输出质量。没有独立模块验证 agent 报告的位置是否正确。

OCR 的解法:独立的 comment-positioning 模块 + comment-reflection 模块,工程代码而非 LLM 保证位置精度。


痛点 3:Unstable quality — 质量不稳定

Natural-language-driven Skills are hard to debug, and review quality fluctuates significantly with minor prompt variations.

prompt 微调导致质量波动,难以调试。

opencode-actions 现状:⚠️ 核心问题。我们的 review 完全依赖 prompt + 模型能力:

  • 同一个 prompt,不同模型产出差异大
  • prompt 微调后效果难以量化验证
  • 没有 rule 文件匹配系统来约束 LLM 的关注范围

OCR 的解法:

  • 模板引擎驱动的 rule matching(按文件类型匹配内置规则),比纯 prompt 稳定
  • 场景调优的专用 toolset(从大规模生产数据中提炼)
  • 确定性流水线处理文件选择/分组/定位,LLM 只管理解代码和生成评论

OCR 的核心哲学

纯语言驱动架构缺乏对 review 过程的硬约束。

OCR 的方案是 确定性工程 × Agent 混合:必须不出错的步骤(文件选择、分组、规则匹配、位置定位)用工程代码保证;LLM 只负责动态决策(理解代码、生成评论)。

对 opencode-actions 的启示

痛点 我们是否有 短期可改进
覆盖不全 低风险 可加 diff 文件覆盖率检查
位置漂移 存在 需要 post-processing 验证行号
质量不稳定 核心问题 引入 rule matching 或 prompt 版本化管理

这些问题不一定现在解决,但值得在设计 multi-review 和后续架构演进时持续参考。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentOpenCode agent SDK integrationcliCLI tooling and scriptsproposalRequest for comments / RFCtriagedIssue has been triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions