Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add severity classification for review comments#79

Open
hellomypastor wants to merge 2 commits into
alibaba:main from
hellomypastor:feat/comment-severity
Open

feat: add severity classification for review comments #79
hellomypastor wants to merge 2 commits into
alibaba:main from
hellomypastor:feat/comment-severity

Conversation

@hellomypastor

@hellomypastor hellomypastor commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

Add a 4-level severity system (critical / warning / suggestion / nitpick) for LLM-generated code review comments. This enables CI pipelines to gate merges based on issue severity and allows users to filter low-priority noise from review output.

Changes across the full stack:

  • Model layer (internal/model/review.go): New Severity type with 4 constants, Rank() method for ordering, and ValidSeverity() validation helper.
  • Tool definition (internal/config/toolsconfig/tools.json): Added severity enum parameter to code_comment tool, marked as required.
  • Tool parser (internal/tool/code_comment.go): Extracts and validates severity from tool call arguments.
  • Prompt engineering (internal/config/template/task_template.json): Added "Severity Classification" section to the MAIN_TASK system prompt, instructing the LLM to assign severity to every comment.
  • CLI (cmd/opencodereview/flags.go): New --min-severity flag to filter comments below a threshold.
  • Review pipeline (cmd/opencodereview/review_cmd.go): Applies severity filtering after line number resolution.
  • Output (cmd/opencodereview/output.go): Color-coded severity badges in terminal output ([critical] red, [warning] yellow, [suggestion] cyan, [nitpick] dim). Severity field included in JSON output.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

New unit tests added:

  • internal/model/review_test.go — Severity rank ordering, ValidSeverity() for valid/invalid inputs
  • cmd/opencodereview/output_test.gofilterBySeverity() with all threshold levels, empty input, and comments without severity

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA

Related Issues

None.

Introduce a 4-level severity system (critical/warning/suggestion/nitpick)
for LLM-generated code review comments, enabling CI pipelines to gate on
issue severity and users to filter noise from review output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ 2 posted as inline comment(s)
  • 📝 0 posted as summary (missing line info)

Comment thread cmd/opencodereview/review_cmd.go
Comment thread internal/model/review.go
- Treat comments without severity (rank 0) as lowest priority, filtered
 out when --min-severity is specified
- Use make([]LlmComment, 0) to ensure JSON output produces [] not null
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /