fix(gitea): route PR conversation comments to handlePrComment#251
Open
SingularityKChen wants to merge 1 commit into
Open
fix(gitea): route PR conversation comments to handlePrComment#251SingularityKChen wants to merge 1 commit into
SingularityKChen wants to merge 1 commit into
Conversation
Gitea delivers a comment posted in a pull request's conversation as an issue_comment webhook whose PR-ness is signalled only by the nested issue.pull_request field, not a top-level pull_request object. GiteaWebhookHandler routed on the top-level field alone, so @-mentions on a PR fell through to handleIssueComment -- which is gated behind the bot's agent feature -- and were dropped with "Agent feature disabled, ignoring issue comment" whenever the agent was disabled. Treat either signal (top-level pull_request or nested issue.pull_request) as a PR comment so mentions reach handlePrComment (code review / slash commands) regardless of the agent setting. Promote the nested marker to a minimal top-level PullRequest first, because handlePrComment dereferences payload.getPullRequest().getNumber(). Add a regression test for the issue_comment-with-nested-PR payload. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Route Gitea PR-conversation comments to
handlePrCommenteven when the webhook payload carries the PR marker only in the nestedissue.pull_requestfield.Fixes #250.
Why
Gitea delivers a comment posted in a pull request's conversation as an
issue_commentwebhook whose PR-ness is signalled byissue.pull_request, not a top-levelpull_request.GiteaWebhookHandlerrouted on the top-level field alone, so@-mentions on a PR fell through tohandleIssueComment— which is gated behind the bot's agent feature — and were dropped with "Agent feature disabled, ignoring issue comment" when the agent was off.How
pull_requestor nestedissue.pull_request) as a PR comment.PullRequest(number/title/body/author copied from the issue — for PRs in Gitea these mirror the PR) before delegating, becausehandlePrCommentdereferencespayload.getPullRequest().getNumber().Tests
GiteaWebhookHandlerTest#prConversationComment_withoutTopLevelPullRequest_routesToHandlePrComment: anissue_commentpayload withissue.pull_requestset and no top-levelpull_requestnow routes tohandlePrCommentand carries a promoted top-level PR (asserts number == issue number). Written test-first (red → green).mvn -Dtest=GiteaWebhookHandlerTest test→ green (20 tests, 0 failures).Targets
developper CONTRIBUTING.md.🤖 Generated with Claude Code