Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Problem

When suggestions were skipped because they would duplicate existing suggestions, the detailed debug output showing the draft review comments was missing. This made it difficult to understand what suggestions were generated during re-runs of the action.

Before

Suggestions skipped because they would duplicate existing suggestions: 4
- example.md:1
- example.md:2
- example.md:3-6
- example.md:9
##[debug]Generated suggestions: 0

The debug output showed Generated suggestions: 0 (incorrect) and provided no details about what was actually generated.

After

##[debug]Generated suggestions: 4
##[debug]- Draft review comment:
##[debug]  path: example.md
##[debug]  line: 1
##[debug]  body:
##[debug]  ````suggestion
##[debug]  ## Example 1
##[debug]  
##[debug]  ````
##[debug]- Draft review comment:
##[debug]  path: example.md
##[debug]  line: 2
##[debug]  body:
##[debug]  ````suggestion
##[debug]  Headings should be surrounded by blank lines.
##[debug]  
##[debug]  ````
... (more drafts)
Suggestions skipped because they would duplicate existing suggestions: 4
- example.md:1
- example.md:2
- example.md:3-6
- example.md:9

Now shows the correct count and full details for all generated suggestions, even when they're skipped.

Changes

  • Created logDetailedCommentDebugInfo() helper function to log detailed draft comment information (path, line, start_line, start_side, body)
  • Updated generateReviewComments() to log all generated drafts with detailed debug output before filtering for duplicates
  • Simplified run() by removing duplicate debug logging code (now handled in generateReviewComments())

Benefits

  • ✅ Consistent debug output for both fresh runs and re-runs
  • ✅ Correct suggestion count displayed
  • ✅ Full visibility into what was generated, even when skipped
  • ✅ Easier debugging and troubleshooting

Fixes #122

Original prompt

This section details on the original issue you should resolve

<issue_title>Suggestion debug output missing when comments are skipped</issue_title>
<issue_description>Example debug output on fresh run:

##[debug]Diff output: diff --git a/example.md b/example.md
##[debug]index 83db783..5f3c23d 100644
##[debug]--- a/example.md
##[debug]+++ b/example.md
##[debug]@@ -1,6 +1,8 @@
##[debug] ## Example 1
##[debug]+
##[debug] Headings should be surrounded by blank lines.
##[debug]+
##[debug] ## Example 2
##[debug]-There should not be multiple consecutive blank lines.
##[debug] 
##[debug]+There should not be multiple consecutive blank lines.
##[debug] 
##[debug]@@ -9,2 +11,3 @@ It even works with fenced code blocks!
##[debug] ```
##[debug]+
##[debug] There should be a blank line above this one.
##[debug]
##[debug]Generated suggestions: 4
##[debug]- Draft review comment:
##[debug]  path: example.md
##[debug]  line: 1
##[debug]  body:
##[debug]  ````suggestion
##[debug]  ## Example 1
##[debug]  
##[debug]  ````
##[debug]- Draft review comment:
##[debug]  path: example.md
##[debug]  line: 2
##[debug]  body:
##[debug]  ````suggestion
##[debug]  Headings should be surrounded by blank lines.
##[debug]  
##[debug]  ````
##[debug]- Draft review comment:
##[debug]  path: example.md
##[debug]  line: 6
##[debug]  start_line: 3
##[debug]  start_side: RIGHT
##[debug]  body:
##[debug]  ````suggestion
##[debug]  ## Example 2
##[debug]  
##[debug]  There should not be multiple consecutive blank lines.
##[debug]  
##[debug]  ````
##[debug]- Draft review comment:
##[debug]  path: example.md
##[debug]  line: 9
##[debug]  body:
##[debug]  ````suggestion
##[debug]  ```
##[debug]  
##[debug]  ````
Suggestions to be included in review: 4
- example.md:1
- example.md:2
- example.md:3-6
- example.md:9
##[debug]Batch create succeeded.
##[debug]Node Action run completed with exit code 0
##[debug]Finishing: Run parkerbxyz/suggest-changes@copilot/improve-grouping-algorithm

Example output on re-run:

##[debug]Diff output: diff --git a/example.md b/example.md
##[debug]index 83db783..5f3c23d 100644
##[debug]--- a/example.md
##[debug]+++ b/example.md
##[debug]@@ -1,6 +1,8 @@
##[debug] ## Example 1
##[debug]+
##[debug] Headings should be surrounded by blank lines.
##[debug]+
##[debug] ## Example 2
##[debug]-There should not be multiple consecutive blank lines.
##[debug] 
##[debug]+There should not be multiple consecutive blank lines.
##[debug] 
##[debug]@@ -9,2 +11,3 @@ It even works with fenced code blocks!
##[debug] ```
##[debug]+
##[debug] There should be a blank line above this one.
##[debug]
Suggestions skipped because they would duplicate existing suggestions: 4
- example.md:1
- example.md:2
- example.md:3-6
- example.md:9
##[debug]Generated suggestions: 0
##[debug]Node Action run completed with exit code 0
##[debug]Finishing: Run parkerbxyz/suggest-changes@copilot/improve-grouping-algorithm

The generated suggestions should be included in the debug output, even if they are skipped because they would duplicate existing suggestions.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 24, 2025 16:55
Co-authored-by: parkerbxyz <17183625+parkerbxyz@users.noreply.github.com>
Co-authored-by: parkerbxyz <17183625+parkerbxyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing debug output when comments are skipped fix: add detailed debug output for skipped duplicate suggestions Oct 24, 2025
Copilot AI requested a review from parkerbxyz October 24, 2025 17:00
@parkerbxyz parkerbxyz marked this pull request as ready for review October 25, 2025 17:12
Copilot AI review requested due to automatic review settings October 25, 2025 17:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes missing debug output when suggestions are skipped due to duplicating existing suggestions. Previously, re-runs showed "Generated suggestions: 0" and omitted details about what was generated. Now, all generated suggestions are logged with full details before duplicate filtering, providing consistent debugging information across both initial runs and re-runs.

Key changes:

  • Moves debug logging earlier in the process to capture all generated suggestions before duplicate filtering
  • Extracts duplicated debug logging code into a reusable helper function
  • Ensures debug output is consistent between fresh runs and re-runs

@parkerbxyz parkerbxyz merged commit 03a1bc5 into main Oct 25, 2025
1 check passed
@parkerbxyz parkerbxyz deleted the copilot/fix-debug-output-suggestions branch October 25, 2025 17:13
@parkerbxyz parkerbxyz bot mentioned this pull request Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion debug output missing when comments are skipped

2 participants