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

fix(action): show warnings in zero-finding PR summaries

Open lizhengfeng101 opened this issue 1 month ago • 2 comments

Description

The GitHub Action drops review warnings when the CLI returns zero findings.

In runPostReviewComments, the comments.length === 0 branch posts a summary using result.message and a ✅ icon, then returns without rendering result.warnings. The branch that handles findings already renders warnings through formatWarnings().

After #1678, a task can reach its review limit, complete successfully in the grace round, and return zero findings with a review_limit_reached warning. The Action currently presents that result as:

✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s).

The warning is present in the CLI JSON but absent from the PR summary, hiding an important qualification of the result.

Update the zero-findings branch to:

  • Render all warnings using the existing formatWarnings() helper, including string and structured warnings.
  • Use ⚠️ instead of ✅ when warnings are present.
  • Preserve result.message when provided. When it is missing and warnings exist, use a neutral fallback such as “No comments generated. See warnings below.”
  • Preserve the existing summary when no warnings are present.

Scope

  • File: scripts/github-actions/post-review-comments.js
  • Tests: scripts/github-actions/post-review-comments.test.js
  • Area: the zero-findings branch of runPostReviewComments.

This is a presentation fix. Do not change CLI exit codes, manifest completion states, budget semantics, or checkpoint advancement rules. A completed task with warnings remains completed.

Resume warning persistence and changes to the nonzero-findings path are out of scope.

Acceptance Criteria

  • [ ] Zero findings with no warnings retains the existing summary and ✅ icon.
  • [ ] Zero findings with warnings displays a ⚠️ icon and the warning details, including file, type, and message when provided.
  • [ ] Both string and structured warnings are supported through formatWarnings(), without special-casing review_limit_reached.
  • [ ] When warnings exist and result.message is missing, the fallback does not say “Looks good to me.”
  • [ ] Regression coverage includes a zero-findings, completed result carrying review_limit_reached.
  • [ ] Both newly created summaries and sticky-summary updates retain the warnings.
  • [ ] Checkpoint behavior remains unchanged: warnings alone do not prevent an otherwise eligible complete result from advancing; partial and failed results remain ineligible.
  • [ ] npm run test:github-actions and make check pass.

Context

Follow-up to https://github.com/alibaba/open-code-review/pull/1678.

A local mock reproduction confirmed that a completed, zero-findings result containing review_limit_reached produces a ✅ summary without the warning. With incremental checkpointing enabled, an otherwise eligible result also advances its checkpoint. Advancing the checkpoint is not the defect; hiding the warning is.

The rendering omission predates #1678, which makes the successful-but-limited result a relevant additional case.

AI disclosure: This issue was drafted with assistance from OpenAI Codex using the gpt-6-astra model and reviewed by the maintainer before submission.

lizhengfeng101 avatar Oct 15 '26 02:10 lizhengfeng101

Hi, I'd like to take this one.

Plan: in the comments.length === 0 branch of runPostReviewComments, append formatWarnings(result.warnings) to the summary, switch the icon to ⚠️ only when warnings are present, keep result.message when it is set, and use a neutral fallback ("No comments generated. See warnings below.") instead of "Looks good to me" when it is missing and warnings exist. No-warning output stays exactly as today, and checkpoint/exit-code behavior is untouched. I'll add regression cases in post-review-comments.test.js for a completed zero-finding result carrying review_limit_reached (string and structured warnings), covering both a new summary and a sticky-summary update, and run npm run test:github-actions.

Per CONTRIBUTING, disclosure: I'll use Grokbuild (Grok) to help, and I'll review every line myself before opening the PR.

Frank-zhu2000 avatar Oct 15 '26 03:10 Frank-zhu2000

2. Hi, I'd like to take this one. Plan: in the comments.length === 0 branch of runPostReviewComments, append formatWarnings(result.warnings) to the summary, switch the icon to ⚠️ only when warnings are present, keep result.message when it is set, and use a neutral fallback ("No comments generated. See warnings below.") instead of "Looks good to me" when it is missing and warnings exist. No-warning output stays exactly as today, and checkpoint/exit-code behavior is untouched. I'll add regression cases in post-review-comments.test.js for a completed zero-finding result carrying review_limit_reached (string and structured warnings), covering both a new summary and a sticky-summary update, and run npm run test:github-actions. Per CONTRIBUTING, disclosure: I'll use Grokbuild (Grok) to help, and I'll review every line myself before opening the PR.

Hi, I noticed you hadn't submitted a PR yet, so I went ahead and fixed the issue myself.

hyy321 avatar Oct 15 '26 11:10 hyy321