Skip to content

Commit befcc0d

Browse files
Copilotpelikhan
andauthored
Add LOW_QUALITY support to comment minimization reasons across safe outputs (#27397)
* feat: add LOW_QUALITY support for hide_comment reasons Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8ada22c3-9cef-4ad6-9c14-56b0a96dbc07 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * fix: address follow-up review comments for low_quality reasons Agent-Logs-Url: https://github.com/github/gh-aw/sessions/932321fa-7ac4-4180-a18b-b3bae4f4959b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 03be7f5 commit befcc0d

11 files changed

Lines changed: 31 additions & 19 deletions

File tree

.github/workflows/ai-moderator.lock.yml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-codex.lock.yml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/setup/js/hide_comment.test.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ describe("hide_comment.cjs", () => {
8989
expect(mockGithub.graphql).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({ classifier: "ABUSE" }));
9090
});
9191

92+
it("should pass through LOW_QUALITY reason", async () => {
93+
const { main } = await loadModule();
94+
const handler = await main();
95+
96+
await handler({ comment_id: "IC_kwDOABCD123456", reason: "low_quality" }, {});
97+
98+
expect(mockGithub.graphql).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({ classifier: "LOW_QUALITY" }));
99+
});
100+
92101
it("should fail when comment_id is missing", async () => {
93102
const { main } = await loadModule();
94103
const handler = await main();

actions/setup/js/safe_outputs_tools.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@
10241024
},
10251025
{
10261026
"name": "hide_comment",
1027-
"description": "Hide a comment on a GitHub issue, pull request, or discussion. This collapses the comment and marks it as spam, abuse, off-topic, outdated, or resolved. Use this for inappropriate, off-topic, or outdated comments. The comment_id must be a GraphQL node ID (string like 'IC_kwDOABCD123456'), not a numeric REST API comment ID.",
1027+
"description": "Hide a comment on a GitHub issue, pull request, or discussion. This collapses the comment and marks it as spam, abuse, off-topic, outdated, resolved, or low-quality. Use this for inappropriate, off-topic, or outdated comments. The comment_id must be a GraphQL node ID (string like 'IC_kwDOABCD123456'), not a numeric REST API comment ID.",
10281028
"inputSchema": {
10291029
"type": "object",
10301030
"required": ["comment_id"],
@@ -1035,8 +1035,8 @@
10351035
},
10361036
"reason": {
10371037
"type": "string",
1038-
"enum": ["SPAM", "ABUSE", "OFF_TOPIC", "OUTDATED", "RESOLVED"],
1039-
"description": "Optional reason for hiding the comment. Defaults to SPAM if not provided. Valid values: SPAM (spam content), ABUSE (abusive/harassment content), OFF_TOPIC (not relevant to discussion), OUTDATED (no longer applicable), RESOLVED (issue/question has been resolved)."
1038+
"enum": ["SPAM", "ABUSE", "OFF_TOPIC", "OUTDATED", "RESOLVED", "LOW_QUALITY"],
1039+
"description": "Optional reason for hiding the comment. Defaults to SPAM if not provided. Valid values: SPAM (spam content), ABUSE (abusive/harassment content), OFF_TOPIC (not relevant to discussion), OUTDATED (no longer applicable), RESOLVED (issue/question has been resolved), LOW_QUALITY (low-quality content)."
10401040
},
10411041
"secrecy": {
10421042
"type": "string",

actions/setup/js/types/safe-outputs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ interface HideCommentItem extends BaseSafeOutputItem {
352352
/** GraphQL node ID of the comment to hide (e.g., 'IC_kwDOABCD123456') */
353353
comment_id: string;
354354
/** Optional reason for hiding the comment (default: SPAM) */
355-
reason?: "SPAM" | "ABUSE" | "OFF_TOPIC" | "OUTDATED" | "RESOLVED";
355+
reason?: "SPAM" | "ABUSE" | "OFF_TOPIC" | "OUTDATED" | "RESOLVED" | "LOW_QUALITY";
356356
}
357357

358358
/**

docs/src/content/docs/guides/ephemerals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ safe-outputs:
181181
allowed-reasons: [outdated] # Optional: restrict hiding reasons
182182
```
183183

184-
Before posting, the system finds and minimizes previous comments from the same workflow (identified by `GITHUB_WORKFLOW`). Comments are hidden, not deleted. Use `allowed-reasons` to restrict which minimization reason is applied: `spam`, `abuse`, `off_topic`, `outdated` (default), or `resolved`. Useful for status updates, build notifications, and health checks where only the latest result matters.
184+
Before posting, the system finds and minimizes previous comments from the same workflow (identified by `GITHUB_WORKFLOW`). Comments are hidden, not deleted. Use `allowed-reasons` to restrict which minimization reason is applied: `spam`, `abuse`, `off_topic`, `outdated` (default), `resolved`, or `low_quality`. Useful for status updates, build notifications, and health checks where only the latest result matters.
185185

186186
See [Safe Outputs Reference](/gh-aw/reference/safe-outputs/#hide-older-comments) for complete documentation.
187187

docs/src/content/docs/reference/frontmatter-full.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,7 +3322,7 @@ safe-outputs:
33223322

33233323
# List of allowed reasons for hiding older comments when hide-older-comments is
33243324
# enabled. Default: all reasons allowed (spam, abuse, off_topic, outdated,
3325-
# resolved).
3325+
# resolved, low_quality).
33263326
# (optional)
33273327
allowed-reasons: []
33283328
# Array of strings
@@ -4768,7 +4768,7 @@ safe-outputs:
47684768
target-repo: "example-value"
47694769

47704770
# List of allowed reasons for hiding comments. Default: all reasons allowed (spam,
4771-
# abuse, off_topic, outdated, resolved).
4771+
# abuse, off_topic, outdated, resolved, low_quality).
47724772
# (optional)
47734773
allowed-reasons: []
47744774
# Array of strings

docs/src/content/docs/reference/safe-outputs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ The author of the parent issue, PR, or discussion receiving the comment is autom
243243

244244
#### Hide Older Comments
245245

246-
Set `hide-older-comments: true` to minimize previous comments from the same workflow (identified by `GITHUB_WORKFLOW`) before posting new ones. Useful for status updates. Allowed reasons: `spam`, `abuse`, `off_topic`, `outdated` (default), `resolved`.
246+
Set `hide-older-comments: true` to minimize previous comments from the same workflow (identified by `GITHUB_WORKFLOW`) before posting new ones. Useful for status updates. Allowed reasons: `spam`, `abuse`, `off_topic`, `outdated` (default), `resolved`, `low_quality`.
247247

248248
#### Append-Only Status Comments
249249

@@ -261,7 +261,7 @@ When enabled, the workflow completion notifier creates a new comment instead of
261261

262262
### Hide Comment (`hide-comment:`)
263263

264-
Collapses comments in GitHub UI with reason. Requires GraphQL node IDs (e.g., `IC_kwDOABCD123456`), not REST numeric IDs. Reasons: `spam`, `abuse`, `off_topic`, `outdated`, `resolved`.
264+
Collapses comments in GitHub UI with reason. Requires GraphQL node IDs (e.g., `IC_kwDOABCD123456`), not REST numeric IDs. Reasons: `spam`, `abuse`, `off_topic`, `outdated`, `resolved`, `low_quality`.
265265

266266
```yaml wrap
267267
safe-outputs:

pkg/parser/schemas/main_workflow_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5672,10 +5672,10 @@
56725672
},
56735673
"allowed-reasons": {
56745674
"type": "array",
5675-
"description": "List of allowed reasons for hiding older comments when hide-older-comments is enabled. Default: all reasons allowed (spam, abuse, off_topic, outdated, resolved).",
5675+
"description": "List of allowed reasons for hiding older comments when hide-older-comments is enabled. Default: all reasons allowed (spam, abuse, off_topic, outdated, resolved, low_quality).",
56765676
"items": {
56775677
"type": "string",
5678-
"enum": ["spam", "abuse", "off_topic", "outdated", "resolved"]
5678+
"enum": ["spam", "abuse", "off_topic", "outdated", "resolved", "low_quality"]
56795679
}
56805680
},
56815681
"discussions": {
@@ -7215,10 +7215,10 @@
72157215
},
72167216
"allowed-reasons": {
72177217
"type": "array",
7218-
"description": "List of allowed reasons for hiding comments. Default: all reasons allowed (spam, abuse, off_topic, outdated, resolved).",
7218+
"description": "List of allowed reasons for hiding comments. Default: all reasons allowed (spam, abuse, off_topic, outdated, resolved, low_quality).",
72197219
"items": {
72207220
"type": "string",
7221-
"enum": ["spam", "abuse", "off_topic", "outdated", "resolved"]
7221+
"enum": ["spam", "abuse", "off_topic", "outdated", "resolved", "low_quality"]
72227222
}
72237223
},
72247224
"discussions": {

pkg/workflow/js/safe_outputs_tools.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@
11591159
},
11601160
{
11611161
"name": "hide_comment",
1162-
"description": "Hide a comment on a GitHub issue, pull request, or discussion. This collapses the comment and marks it as spam, abuse, off-topic, outdated, or resolved. Use this for inappropriate, off-topic, or outdated comments. The comment_id must be a GraphQL node ID (string like 'IC_kwDOABCD123456'), not a numeric REST API comment ID. NOTE: By default, this tool requires discussions:write permission. If your GitHub App lacks Discussions permission, set 'discussions: false' in the workflow's safe-outputs.hide-comment configuration to exclude this permission.",
1162+
"description": "Hide a comment on a GitHub issue, pull request, or discussion. This collapses the comment and marks it as spam, abuse, off-topic, outdated, resolved, or low-quality. Use this for inappropriate, off-topic, or outdated comments. The comment_id must be a GraphQL node ID (string like 'IC_kwDOABCD123456'), not a numeric REST API comment ID. NOTE: By default, this tool requires discussions:write permission. If your GitHub App lacks Discussions permission, set 'discussions: false' in the workflow's safe-outputs.hide-comment configuration to exclude this permission.",
11631163
"inputSchema": {
11641164
"type": "object",
11651165
"required": [
@@ -1177,9 +1177,10 @@
11771177
"ABUSE",
11781178
"OFF_TOPIC",
11791179
"OUTDATED",
1180-
"RESOLVED"
1180+
"RESOLVED",
1181+
"LOW_QUALITY"
11811182
],
1182-
"description": "Optional reason for hiding the comment. Defaults to SPAM if not provided. Valid values: SPAM (spam content), ABUSE (abusive/harassment content), OFF_TOPIC (not relevant to discussion), OUTDATED (no longer applicable), RESOLVED (issue/question has been resolved)."
1183+
"description": "Optional reason for hiding the comment. Defaults to SPAM if not provided. Valid values: SPAM (spam content), ABUSE (abusive/harassment content), OFF_TOPIC (not relevant to discussion), OUTDATED (no longer applicable), RESOLVED (issue/question has been resolved), LOW_QUALITY (low-quality content)."
11831184
},
11841185
"secrecy": {
11851186
"type": "string",

0 commit comments

Comments
 (0)