diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 5a1e332d..4c87c038 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -575,7 +575,7 @@ def clip_tokens(text: str, max_tokens: int, add_three_dots=True) -> str: num_output_chars = int(chars_per_token * max_tokens) clipped_text = text[:num_output_chars] if add_three_dots: - clipped_text += " ...(truncated)" + clipped_text += "\n...(truncated)" return clipped_text except Exception as e: get_logger().warning(f"Failed to clip tokens: {e}") diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 4d1739a5..c257c30a 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -357,6 +357,9 @@ class PRReviewer: return True def set_review_labels(self, data): + if not get_settings().config.publish_output: + return + if (get_settings().pr_reviewer.enable_review_labels_security or get_settings().pr_reviewer.enable_review_labels_effort): try: diff --git a/tests/unittest/test_clip_tokens.py b/tests/unittest/test_clip_tokens.py index 2405a06b..a56ff92f 100644 --- a/tests/unittest/test_clip_tokens.py +++ b/tests/unittest/test_clip_tokens.py @@ -15,5 +15,5 @@ class TestClipTokens: max_tokens = 10 result = clip_tokens(text, max_tokens) - expected_results = 'line1\nline2\nline3\nli ...(truncated)' + expected_results = 'line1\nline2\nline3\nli\n...(truncated)' assert result == expected_results