Skip to content

Commit ddf94c1

Browse files
committed
Add configuration option for PR Code Suggestions to control publishing when no suggestions found
1 parent 069f5eb commit ddf94c1

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

docs/docs/tools/improve.md

+3
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ Note: Chunking is primarily relevant for large PRs. For most PRs (up to 500 line
434434
<td><b>enable_chat_text</b></td>
435435
<td>If set to true, the tool will display a reference to the PR chat in the comment. Default is true.</td>
436436
</tr>
437+
<tr>
438+
<td><b>publish_output_no_suggestions</b></td>
439+
<td>If set to true, the tool will publish a comment even if no suggestions were found. Default is true.</td>
437440
<tr>
438441
<td><b>wiki_page_accepted_suggestions</b></td>
439442
<td>If set to true, the tool will automatically track accepted suggestions in a dedicated wiki page called `.pr_agent_accepted_suggestions`. Default is true.</td>

pr_agent/settings/configuration.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ model_token_count_estimate_factor=0.3 # factor to increase the token count estim
1414
git_provider="github"
1515
publish_output=true
1616
publish_output_progress=true
17-
publish_output_no_suggestions=true
1817
verbosity_level=0 # 0,1,2
1918
use_extra_bad_extensions=false
2019
# Configurations
@@ -130,9 +129,9 @@ focus_only_on_problems=true
130129
extra_instructions = ""
131130
enable_help_text=false
132131
enable_chat_text=false
133-
enable_intro_text=true
134132
persistent_comment=true
135133
max_history_len=4
134+
publish_output_no_suggestions=true
136135
# enable to apply suggestion 💎
137136
apply_suggestions_checkbox=true
138137
# suggestions scoring

pr_agent/tools/pr_code_suggestions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ async def add_self_review_text(self, pr_body):
217217

218218
async def publish_no_suggestions(self):
219219
pr_body = "## PR Code Suggestions ✨\n\nNo code suggestions found for the PR."
220-
if get_settings().config.publish_output and get_settings().config.publish_output_no_suggestions:
220+
if (get_settings().config.publish_output and
221+
get_settings().pr_code_suggestions.get('publish_output_no_suggestions', True)):
221222
get_logger().warning('No code suggestions found for the PR.')
222223
get_logger().debug(f"PR output", artifact=pr_body)
223224
if self.progress_response:
@@ -784,7 +785,7 @@ def generate_summarized_suggestions(self, data: Dict) -> str:
784785
pr_body += "No suggestions found to improve this PR."
785786
return pr_body
786787

787-
if get_settings().pr_code_suggestions.enable_intro_text and get_settings().config.is_auto_command:
788+
if get_settings().config.is_auto_command:
788789
pr_body += "Explore these optional code suggestions:\n\n"
789790

790791
language_extension_map_org = get_settings().language_extension_map_org

0 commit comments

Comments
 (0)