fix(review): comments array entries MUST have line numbers

LLM was putting findings in the comments array WITHOUT line numbers,
creating orphaned PR comments. Clarified: comments array entries MUST
have a valid line. Findings without a mappable diff line go in body.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wenshao 2026-04-09 09:31:42 +08:00
parent d510a77a28
commit 76a66a2671

View file

@ -402,7 +402,7 @@ Use the **pre-autofix HEAD commit SHA** captured in Step 1. If not captured, fal
**Before posting**, check for existing Qwen Code review comments: `gh api repos/{owner}/{repo}/pulls/{pr_number}/comments --jq '.[] | select(.body | test("via Qwen Code /review")) | .id'`. If found, inform the user and let them decide whether to proceed.
⚠️ **Findings go in the `comments` array, NOT in `body`.** The `body` field is for the review summary (usually empty). Do NOT put findings in `body` — that creates a summary comment instead of inline comments.
⚠️ **Findings that can be mapped to a diff line → go in `comments` array (with `line` field). Findings that CANNOT be mapped to a specific diff line → go in `body` field.** Every entry in the `comments` array MUST have a valid `line` number. Do NOT put a comment in the `comments` array without a `line` — it creates an orphaned comment with no code reference.
**Build the review JSON** with `write_file` to create `/tmp/qwen-review-{target}-review.json`. Every high-confidence Critical/Suggestion finding that can be mapped to a diff line MUST be an entry in the `comments` array: