feat: add severity classification for review comments#79
Open
hellomypastor wants to merge 2 commits into
Open
Conversation
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>
- 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>
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
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:
internal/model/review.go): NewSeveritytype with 4 constants,Rank()method for ordering, andValidSeverity()validation helper.internal/config/toolsconfig/tools.json): Addedseverityenum parameter tocode_commenttool, marked as required.internal/tool/code_comment.go): Extracts and validates severity from tool call arguments.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.cmd/opencodereview/flags.go): New--min-severityflag to filter comments below a threshold.cmd/opencodereview/review_cmd.go): Applies severity filtering after line number resolution.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
How Has This Been Tested?
make testpasses locallyNew unit tests added:
internal/model/review_test.go— Severity rank ordering,ValidSeverity()for valid/invalid inputscmd/opencodereview/output_test.go—filterBySeverity()with all threshold levels, empty input, and comments without severityChecklist
go fmt,go vet)Related Issues
None.