Repository navigation
fix(tool): report an empty code_comment batch instead of success - #1773
Merged
lizhengfeng101 merged 2 commits intoOct 20, 2026
Merged
Conversation
Every entry of a code_comment batch can be dropped for a missing non-empty 'content' while the parse itself succeeds. The tool then answered 'Successfully commented.', so the model moved on to task_done and the finding was lost with neither side noticing. Return an explicit error from both entry points (the provider and the llmloop tool dispatch) so the model can re-send the entry, and keep the existing tolerance for a partly-bad batch.
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). |
lizhengfeng101
left a comment
Contributor
There was a problem hiding this comment.
Four comment-only cleanup suggestions to keep the explanation concise and avoid repeating the PR description. No behavior changes.
Co-authored-by: Kite <[email protected]>
SaahiilM
added a commit
to SaahiilM/open-code-review
that referenced
this pull request
Oct 20, 2026
fix(tool): report an empty code_comment batch instead of success (alibaba#1773)
SaahiilM
added a commit
to SaahiilM/open-code-review
that referenced
this pull request
Oct 20, 2026
fix(tool): report an empty code_comment batch instead of success (alibaba#1773)
SaahiilM
added a commit
to SaahiilM/open-code-review
that referenced
this pull request
Oct 20, 2026
fix(tool): report an empty code_comment batch instead of success (alibaba#1773)
7 of 8 tasks
This was referenced Oct 26, 2026
ydflow
added a commit
to ydflow/open-code-review
that referenced
this pull request
Oct 31, 2026
A code_comment batch that keeps at least one usable entry parses without error and files normally, so entries skipped for a missing non-empty 'content' or path are discarded with no record anywhere: the model sees a plain success and assumes every finding was saved. The fully unusable batch already takes the CommentNoneUsableMsg failure (alibaba#1773); the partial case was the remaining silent loss. parseCommentsInner now reports how many raw entries it skipped, and the llmloop code_comment path records a comment_entries_dropped run warning carrying the dropped/total count, matching how comment_args_repaired is surfaced for schema violations. A batch with no usable entry still takes the failure path, where the error already names the required fields.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
code_commentcan parse successfully while filing nothing.parseCommentsInnerskips any entry that lacks a non-emptycontent(or a usable path), and a batch made only of such entries returns(nil, nil, ""). The tool then answeredSuccessfully commented.Reproduced on current
main— before the fix, this printedresult="Successfully commented." collected=0:The entry names a path but uses
messagewhere the schema sayscontent, so the only field carrying the finding text is empty (an emptycontentbehaves the same way). The model is told the comment was filed and moves on totask_done; the finding never reaches the collector, and nothing in--format json, the warnings list or the session records shows that it was dropped. The review then reports fewer findings than the model actually produced, with no signal on either side.What this changes
internal/tool/code_comment.go: adds aCommentNoneUsableMsgverdict and returns it fromCodeCommentProvider.Executewhen the parse succeeded but produced no comment.internal/llmloop/loop.go: returns the same verdict from the tool dispatch the agent loop actually uses. It flows through the existing error branch, so the attempt is recorded inToolFailures()/ the session record and the model gets a retryable error naming the two required fields. The existing consecutive-failure escalation still bounds a model that cannot fix its arguments.Deliberately unchanged:
The empty-array case (
"comments": []) already returned an error and is untouched.Type of Change
How Has This Been Tested?
New tests:
internal/tool/code_comment_test.go: an all-dropped batch returnsCommentNoneUsableMsgand collects nothing; a partly-dropped batch still returnsCommentSucceedand files the good entry.internal/llmloop/loop_test.go:TestExecuteToolCall_CodeCommentWithNoUsableEntryIsReported— the dispatch returns the message, collects nothing, and records exactly onecode_commenttool failure.Commands run on this branch (Windows, Go 1.27.0):
TestLazyFileWriter_PreservesSymlinkTargetfails on this machine on the unmodified base commit as well (creating the symlink needs a privilege the shell does not have), so it is unrelated to this change; it is skipped by name above rather than reported as passing.Checklist
go fmt,go vet)AI disclosure: drafted with AI assistance (WorkBuddy) for wording and for navigating the call sites; I reviewed every line of the diff, ran the commands above myself, and will answer maintainers' questions from my own understanding.
Related Issues
No existing issue: this was found while reading the
code_commentdispatch path.