open-code-review icon indicating copy to clipboard operation
open-code-review copied to clipboard

BUG重复,文件名错误

Open breakenknife opened this issue 5 months ago • 7 comments

OpenCodeReview Version

1.3.14

Operating System

Windows

Installation Method

GitHub Release binary

LLM Provider

Other OpenAI-compatible endpoint

Bug Description

我的java文件有问题,但是多报了一个json的错,: 模型为: doubao-seed-2.0-code

Image

Steps to Reproduce

D:\Download\ocr.exe review --format json

Expected Behavior

希望修复一下,感谢!

Logs / Error Output


Additional Context

No response

breakenknife avatar Jun 17 '26 03:06 breakenknife

@breakenknife 感谢反馈!

这是一个已知的由模型幻觉(hallucination)导致的问题。在评审指定文件变更时,模型会在检索上下文的过程中拉取相关代码片段,而检索到的内容本身可能也存在问题。模型有时会将这些检索出来的上下文中的问题误认为是当前被评审文件的问题,并错误地调用评审工具来发送评审意见。在您的 case 中,很可能是模型在评审 JSON 文件时检索到了某个 Java 文件的问题片段,将其误判为当前文件的问题后调用了评审工具,而我们在流程上限制评审工具只能将评审意见挂到当前被评审的文件下,所以就出现了 JSON 文件中出现 Java 评审意见的现象。

这一问题偶尔会出现在 agent 能力或 coding 能力较弱的模型上——它们在工具调用和上下文边界判断上不够准确。您可以尝试更换能力更强的模型来规避此问题,一般会有明显改善。

stay-foolish-forever avatar Jun 17 '26 03:06 stay-foolish-forever

@stay-foolish-forever 感谢及时回复! 我感觉这个问题目前是能够修复的,因为doubao-seed-2.0-code算是很强的编程模型了, 平时写代码都没什么问题. 以前我们也用老模型做过类似的代码审查,基本不存在这个问题, 我觉得在审查关联文件的时候,可以把路径一起传过去, 然后可以让模型再核实一遍结果.

因为不懂go,我让AI分析了源码,说有bug,麻烦你们核实一下:

copilot分析结果:

Image

minmax分析结果:

Image

breakenknife avatar Jun 17 '26 07:06 breakenknife

Thanks for the detailed report. I checked this and can confirm it’s a valid issue.

MuoDoo avatar Jun 17 '26 07:06 MuoDoo

请问这个问题有在处理吗?我在用的时候也碰到了类似的问题

lee259 avatar Aug 03 '26 09:08 lee259

@lee259 感谢反馈!这个问题我们一直有在关注。

目前我们已经做了几层防护措施来缓解这个现象:

  1. 路径强制覆盖 — 确保评审意见不会被挂到错误的文件上
  2. 系统提示词中明确约束模型只关注当前文件的 diff
  3. 评审过滤器 — 通过后处理检查过滤掉明显不合理的评论

但坦白说,这个问题的根本原因是大模型在工具调用和上下文边界判断上的随机性,很难做到 100% 消除。尤其在 agent/coding 能力相对较弱的模型上,出现的概率会更高。我们会持续观察并尽力改善。

如果您有好的想法或建议,非常欢迎提出来,也欢迎直接参与贡献 :)

lizhengfeng101 avatar Aug 03 '26 09:08 lizhengfeng101

请问这个问题有在处理吗?我在用的时候也碰到了类似的问题

cc @lee259

lizhengfeng101 avatar Aug 03 '26 09:08 lizhengfeng101

Thanks for reporting this. Starting in v1.9.5, if OCR cannot locate the quoted code in the file named by a review comment but can locate it in exactly one other reviewed file, it moves the comment to that file and updates its line numbers (#921).

We're closing this as completed because that change addresses the file attribution problem. It does not guarantee that a model will never produce a misplaced or duplicate finding. If you see the same Java finding reported against a JSON file on the latest release, please let us know here with the OCR version and a redacted example so we can reopen and investigate.

lizhengfeng101 avatar Dec 01 '26 08:12 lizhengfeng101