fix: route Forgejo review comment updates to issue comment API

On Forgejo, the tracking comment for pull_request_review_comment events
is always created as a regular issue comment (because Forgejo's webhook
payload lacks the top-level comment object). The MCP server was
incorrectly setting isPullRequestReviewComment=true based on the event
name, causing every update to try pulls.updateReviewComment first —
which 404'd and silently swallowed Claude's responses.

Three fixes:
- MCP server: detect Forgejo and always use issue comment path
- update-comment-link: skip pulls.getReviewComment on Forgejo (saves
  one wasted 404 API call)
- update-claude-comment: expand fallback to also catch 422 (defense
  in depth for Forgejo edge cases)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad MocanuandClaude Opus 4.6 committed 2026-02-26 10:45:09 +02:00
1 parent 821cc86c6e
commit 84cf34ff1f
3 files changed
+26 -8

No files matched your search

+11 -1
View File
@@ -52,8 +52,18 @@ server.tool(
baseUrl: GITHUB_API_URL,
});
// The tracking comment is always created as a regular issue comment on
// Forgejo because Forgejo's pull_request_review_comment payload lacks the
// top-level `comment` object (so createInitialComment falls back to
// issues.createComment). On GitHub, the tracking comment IS a review
// comment reply (created via pulls.createReplyForReviewComment).
//
// Setting this wrong causes every MCP update to first try
// pulls.updateReviewComment (404), and if the fallback doesn't trigger,
// Claude's responses never reach the comment.
const isForgejo = (process.env.GITHUB_API_URL || "").includes("/api/v1");
const isPullRequestReviewComment =
eventName === "pull_request_review_comment";
eventName === "pull_request_review_comment" && !isForgejo;
const sanitizedBody = sanitizeContent(body);