Skip to content

feat: deduplicate issues across review runs to avoid repeated feedback#264

Open
Sarthak-commits wants to merge 3 commits into
Nayjest:mainfrom
Sarthak-commits:fix/deduplicate-review-issues
Open

feat: deduplicate issues across review runs to avoid repeated feedback#264
Sarthak-commits wants to merge 3 commits into
Nayjest:mainfrom
Sarthak-commits:fix/deduplicate-review-issues

Conversation

@Sarthak-commits

@Sarthak-commits Sarthak-commits commented May 29, 2026

Copy link
Copy Markdown
Contributor

Implements the feature request from #231 — Gito now deduplicates issues across review runs.

Problem: When Gito reviews a PR, the user addresses some issues, and then Gito re-reviews, it reports all the same issues again — including ones already fixed.

Solution: Before posting a new review comment, Gito now:

  1. Fetches previous review comments on the PR (identified by the HTML_CR_COMMENT_MARKER)
  2. Extracts issue titles from the previous review (parsing ## #N <title> sections)
  3. Compares against the new review and filters out any issues whose titles match
  4. If all issues are duplicates, posts a "✅ No new issues found" message instead

Changes to gito/commands/gh_post_review_comment.py:

  • _extract_issue_titles() — parses issue titles from markdown review body
  • _filter_duplicate_issues() — orchestrates fetching previous reviews and filtering
  • _remove_duplicate_sections() — removes matched issue sections from the new review

All logic is wrapped in try/except so failure to fetch previous reviews is non-fatal (falls through to posting the full review).

Closes #231

When reviewing a PR, the description and existing comments are now
fetched via the GitHub API and passed to the LLM as additional context.
This lets the reviewer understand what the PR is about and what issues
have already been raised by other reviewers.

- gito/pr_context.py: New module that fetches PR data from GitHub
- gito/core.py: review() and answer() now pass pr_context to prompts
- gito/config.toml: Prompt template updated with pr_context section
- gito/project_config.py: Added include_pr_context config option (default true)
- tests/test_pr_context.py: 5 tests covering fetch logic

Users can disable this with include_pr_context = false in their
.gito/config.toml to save on token usage.

Closes Nayjest#230
The <img> tag was nested inside an <h2> tag which breaks GitHub's
markdown rendering. Moved the icon to its own line above the heading.
When Gito re-reviews a PR, it now checks for previous review comments
by extracting issue titles, and filters out any issues that were already
reported. This prevents the same feedback from appearing repeatedly
when some issues have been addressed and others haven't.

- _extract_issue_titles(): parses issue titles from review markdown
- _filter_duplicate_issues(): fetches previous reviews and filters duplicates
- _remove_duplicate_sections(): removes matching issue sections from the
  new review body, with a fallback message when all issues are duplicates
@github-actions

Copy link
Copy Markdown
Contributor

I've Reviewed the Code

The logging statement incorrectly reports the total number of previously seen issue titles instead of the actual number of duplicates removed from the current review body.

⚠️ 1 issue found across 6 files

#1 Incorrect count logged for filtered duplicate issues

gito/commands/gh_post_review_comment.py L117-L123

The log message reports len(previous_titles) as the number of filtered duplicates, but this is the total number of titles found in all previous reviews, not the number of issues actually removed from the current body. For example, if previous reviews contained 10 unique titles but only 2 matched the current review, the log would incorrectly say "Filtered 10 duplicate issue(s)".
Tags: bug
Affected code:

117:         filtered_body = _remove_duplicate_sections(body, previous_titles)
118: 
119:         if filtered_body != body:
120:             logging.info(
121:                 "Filtered %d duplicate issue(s) from previous review",
122:                 len(previous_titles),
123:             )

Proposed change:

        filtered_body = _remove_duplicate_sections(body, previous_titles)

        if filtered_body != body:
            current_titles = _extract_issue_titles(body)
            filtered_titles = _extract_issue_titles(filtered_body)
            removed_count = len(current_titles) - len(filtered_titles)
            logging.info(
                "Filtered %d duplicate issue(s) from previous review",
                removed_count,
            )

@Nayjest Nayjest added the todo label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't report the same issue repeatedly.

2 participants