-
Notifications
You must be signed in to change notification settings - Fork 296
Description
Description
The hide-older-comments: true option on the add-comment safe output does not hide previous comments from the same workflow. The handler runs, searches for previous comments, but finds zero matches — even when prior comments contain the workflow_id in their footer marker.
Reproduction
Workflow source (pr-review.md):
safe-outputs:
add-comment:
max: 1
hide-older-comments: truegh-aw version: v0.50.0 (also tested after upgrading to v0.50.1 — same behavior)
Steps:
- Push to a PR branch to trigger the workflow
- Workflow posts a comment with footer:
<!-- gh-aw-agentic-workflow: PR Review, engine: copilot, id: ..., workflow_id: pr-review, run: ... --> - Push again to trigger a second run
- Second run's
safe_outputsjob logs show:Hide-older-comments is enabled Searching for previous comments with workflow ID: pr-review No previous comments found with matching workflow ID - New comment is created without hiding the previous one
- Result: multiple visible, un-minimized PR Review comments accumulate on the PR
Evidence from logs
From the safe_outputs job of run 22360210304:
Safe Output Handler Manager starting...
Loaded config from GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: {"add_comment":{"hide_older_comments":true,"max":1},...}
Hide-older-comments is enabled
...
Adding comment to issue/PR #1 in dsg-tech/otv-moe-backend
Searching for previous comments with workflow ID: pr-review
No previous comments found with matching workflow ID
Created comment: https://github.com/dsg-tech/otv-moe-backend/pull/1#issuecomment-3953349694
The previous comment (posted at 16:24 UTC by the same workflow) has this footer:
<!-- gh-aw-agentic-workflow: PR Review, engine: copilot, id: 22359671348, workflow_id: pr-review, run: https://github.com/dsg-tech/otv-moe-backend/actions/runs/22359671348 -->So the workflow_id: pr-review value IS present in the comment body, but the search function doesn't match it.
Suspected root cause
The search function in add_comment.cjs (findCommentsWithTrackerId or similar) appears to search for a standalone marker format (e.g., <!-- gh-aw-workflow-id: pr-review -->) rather than parsing the workflow_id field from within the combined <!-- gh-aw-agentic-workflow: ... --> footer marker that add_comment actually writes.
Compiled lock file confirmation
The compiled lock file correctly includes the config at the handler level:
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: {"add_comment":{"hide_older_comments":true,"max":1},...}
So the compiler is propagating the setting correctly — the issue is in the runtime comment matching logic.
Expected behavior
When hide-older-comments: true is set, the handler should find and minimize all previous comments from the same workflow before posting a new one.
Environment
- gh-aw: v0.50.0 and v0.50.1
- Repo: private enterprise repo
- Engine: copilot