From ab808fd1146f88204d2b099a52c835fb271dcb29 Mon Sep 17 00:00:00 2001 From: diana-jung <104146180+diana-jung@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:38:29 +0900 Subject: [PATCH] fix: Apply suggestions_score_threshold filter to inline code suggestions in dual publishing mode - Added score filtering to push_inline_code_suggestions - Ensured inline suggestions are properly filtered when dual publishing is enabled - High-importance suggestions appear in both table and inline; others only inline --- pr_agent/tools/pr_code_suggestions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 30292074..fcb1d0c5 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -539,7 +539,10 @@ class PRCodeSuggestions: async def push_inline_code_suggestions(self, data): code_suggestions = [] - if not data['code_suggestions']: + score_threshold = max(1, int(get_settings().pr_code_suggestions.suggestions_score_threshold)) + filtered_suggestions = [d for d in data['code_suggestions'] if int(d.get('score', 0)) >= score_threshold] + + if not filtered_suggestions: get_logger().info('No suggestions found to improve this PR.') if self.progress_response: return self.git_provider.edit_comment(self.progress_response, @@ -547,7 +550,7 @@ class PRCodeSuggestions: else: return self.git_provider.publish_comment('No suggestions found to improve this PR.') - for d in data['code_suggestions']: + for d in filtered_suggestions: try: if get_settings().config.verbosity_level >= 2: get_logger().info(f"suggestion: {d}") @@ -941,4 +944,4 @@ class PRCodeSuggestions: except Exception as e: get_logger().info(f"Could not reflect on suggestions, error: {e}") return "" - return response_reflect \ No newline at end of file + return response_reflect