Summary
When a workflow is triggered by a pull_request_review_comment event, the agent's response via add_comment is posted as a top-level PR issue comment rather than as a reply in the inline review thread where the original comment appeared.
Expected behaviour
When the triggering event is a pull_request_review_comment, add_comment (with no explicit item_number) should post the response as a reply to the triggering review comment thread using POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/replies, so the reply appears inline next to the code that was commented on.
Current behaviour
add_comment always posts via POST /repos/{owner}/{repo}/issues/{issue_number}/comments, which creates a top-level PR-level comment. The reply appears disconnected from the inline code review thread that triggered the workflow.
Root cause
The add_comment handler doesn't distinguish between triggering event types. The reply_to_id parameter only handles GitHub Discussion threading and is explicitly documented as "ignored for issue and pull request comments". There is no code path that calls the PR review comment reply endpoint.
Suggested fix
When the triggering event is pull_request_review_comment and no explicit item_number is provided, detect this case in the add_comment handler and post via the review comment reply endpoint instead:
// POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/replies
await octokit.request(
'POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/replies',
{ owner, repo, comment_id: triggeringCommentId, body }
)
This would make the agent's response appear inline in the review thread, matching the user's expectation when they write a /slash-command on a specific line of code.
Filed by Claude Code
Summary
When a workflow is triggered by a
pull_request_review_commentevent, the agent's response viaadd_commentis posted as a top-level PR issue comment rather than as a reply in the inline review thread where the original comment appeared.Expected behaviour
When the triggering event is a
pull_request_review_comment,add_comment(with no explicititem_number) should post the response as a reply to the triggering review comment thread usingPOST /repos/{owner}/{repo}/pulls/comments/{comment_id}/replies, so the reply appears inline next to the code that was commented on.Current behaviour
add_commentalways posts viaPOST /repos/{owner}/{repo}/issues/{issue_number}/comments, which creates a top-level PR-level comment. The reply appears disconnected from the inline code review thread that triggered the workflow.Root cause
The
add_commenthandler doesn't distinguish between triggering event types. Thereply_to_idparameter only handles GitHub Discussion threading and is explicitly documented as "ignored for issue and pull request comments". There is no code path that calls the PR review comment reply endpoint.Suggested fix
When the triggering event is
pull_request_review_commentand no explicititem_numberis provided, detect this case in theadd_commenthandler and post via the review comment reply endpoint instead:This would make the agent's response appear inline in the review thread, matching the user's expectation when they write a
/slash-commandon a specific line of code.Filed by Claude Code