Skip to content

Add status comment lifecycle to agentic-pr-review#36

Merged
wadewinningham merged 14 commits intomainfrom
jm/agentic-pr-review-status-comments
Apr 16, 2026
Merged

Add status comment lifecycle to agentic-pr-review#36
wadewinningham merged 14 commits intomainfrom
jm/agentic-pr-review-status-comments

Conversation

@jonwmarshall
Copy link
Copy Markdown
Contributor

@jonwmarshall jonwmarshall commented Apr 15, 2026

Summary

Adds status comments to agentic-pr-review using thollander/actions-comment-pull-request:

  • Posts an in-progress comment at the start of each review run with a link to the workflow.
  • On success, the comment is automatically deleted (delete-on-completion) so the PR timeline stays clean.
  • On failure, a separate comment is posted with retry guidance and a link to the workflow run.

Changes

File What
action.yml Adds in-progress status comment (via delete-on-completion), failure comment, and renames the post_review step
scripts/process_review.rbscripts/post_review.rb Renamed; adds an explicit failure log message on summary fallback

Design notes

  • Uses delete-on-completion mode so the in-progress comment is removed at job end — zero extra comments on the happy path.
  • The failure comment is a standalone post (no comment-tag) since delete-on-completion would delete a tagged comment regardless of outcome.
  • Both comment steps use a third-party action pinned to a commit SHA (24bffb9b / v3.0.1).

Test plan

  • Trigger a review on a test PR — confirm in-progress comment appears, then is deleted after the review posts
  • Force a failure (e.g. bad API key) — confirm the in-progress comment is deleted and a failure comment appears
  • Run twice on the same PR — confirm no leftover status comments from previous runs

Post an in-progress PR comment at the start of each review run, then
update it on success (with duration and a link to the posted review) or
failure (with the known error surfaced as a blockquote). Each run always
creates a new comment so historical runs are preserved.

The comment body includes invisible HTML-comment metadata (version,
run_id, run_attempt, provider, model, timestamps, duration) for later
data harvesting.

Supporting changes:
- `post_batch_review` / `post_summary_only` now return the API response
  hash (includes `html_url`) instead of `true`
- `process_review.rb` writes `review_url` to GITHUB_OUTPUT and reports
  errors to ERROR_FILE
- `cursor.sh` reports known and unexpected errors to ERROR_FILE
- Both status-update steps use `continue-on-error: true` so a comment
  failure never masks the actual action outcome

Made-with: Cursor
@jonwmarshall jonwmarshall requested a review from a team as a code owner April 15, 2026 21:22
Drop the error blockquote from the visible comment body. The failure
reason is still captured in invisible metadata for harvesting. The
comment now directs users to retry transient errors or reach out in
Nitro Dev Discuss for persistent failures.

Made-with: Cursor
Comment thread agentic-pr-review/action.yml Outdated
Move the status comment logic from a bash script into Ruby to stay
consistent with the rest of the action's scripts:

- GitHubReviewPoster: refactor private `post` → `api_request` with
  HTTP method parameter, add PATCH support, add `create_issue_comment`
  and `update_issue_comment` public methods, make `commit_sha` optional
- StatusCommentBuilder: new class that formats comment bodies (in-
  progress, success, failure) with invisible HTML metadata
- status_comment.rb: CLI script (create/success/failure) that wires
  the builder and poster together, following the process_review.rb
  pattern
- Delete status_comment.sh; action.yml now calls `ruby status_comment.rb`

Specs: 18 for StatusCommentBuilder, 8 for GitHubReviewPoster (5 new),
all 42 passing.

Made-with: Cursor
Drop ERROR_FILE, report_error, fail_with, and failure_reason from
all scripts. The failure comment is a generic message with a link
to the workflow run, retry guidance, and a pointer to Nitro Dev
Discuss — no specific error details surfaced.

Made-with: Cursor
@jonwmarshall
Copy link
Copy Markdown
Contributor Author

Example PR

@benlangfeld
Copy link
Copy Markdown
Member

Since the comment is not updated to include the actual feedback, we now have at least two comments per review run.

Why not just use commit status to indicate progress?

@jonwmarshall
Copy link
Copy Markdown
Contributor Author

@benlangfeld I wanted to modify the primary review comment, but unfortunately you can't add inline comments after the review is posted. People have gotten confused about when the review is or is not happening, despite the action run already showing in the GitHub checks (which I think would be the same experience as using commit status).

What if we deleted the comment on success?

@benlangfeld
Copy link
Copy Markdown
Member

What if we deleted the comment on success?

I think that would work :)

@jonwmarshall

This comment was marked as outdated.

Avoids leaving an extra comment on the PR timeline for every
successful review run. On failure the comment is still updated
with guidance so it remains visible.

Made-with: Cursor
Comment thread agentic-pr-review/scripts/post_review.rb Outdated
Use thollander/actions-comment-pull-request with delete-on-completion
mode to show an in-progress comment that auto-deletes on success. On
failure, upsert overwrites it with guidance. This removes three Ruby
scripts (post_progress_comment, status_comment_builder, and its spec)
and the issue-comment methods from GitHubReviewPoster.

Made-with: Cursor
@jonwmarshall
Copy link
Copy Markdown
Contributor Author

Found an action that better fits what we're trying to do and massively simplifies things.

No longer needed now that the status comment is deleted on success
rather than updated with a link to the review.

Made-with: Cursor
@jonwmarshall jonwmarshall force-pushed the jm/agentic-pr-review-status-comments branch from 95afbb3 to 37f6d9c Compare April 16, 2026 13:31
Comment thread agentic-pr-review/scripts/providers/cursor.sh Outdated
delete-on-completion always deletes the in-progress comment at job
end, so upserting the same tag gets wiped out. Post a standalone
failure comment instead.

Made-with: Cursor
The in-progress comment now shows a checklist with emoji indicators
that updates as each phase completes. delete-on-completion removes
it on success; the standalone failure comment remains for failures.

Made-with: Cursor
Comment thread agentic-pr-review/action.yml
Cool but unnecessary

This reverts commit e241afa.
@jonwmarshall
Copy link
Copy Markdown
Contributor Author

@benlangfeld Alright, this is much better and way simpler. Posts the initial pending comment, which always gets deleted at the end of the workflow. Posts a separate failure comment if something goes wrong.

@wadewinningham wadewinningham merged commit 3f92012 into main Apr 16, 2026
5 checks passed
@wadewinningham wadewinningham deleted the jm/agentic-pr-review-status-comments branch April 16, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants