-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Our organisation follows a forked development strategy and we have been making use of googles Gemini CLI github actions (https://github.com/google-github-actions/run-gemini-cli) for AI powered code review. We have noticed that since a little before the Christmas break the agent has been failing to successfully add line comments to pending reviews for PRs raised from forks using the MCP tool add_comment_to_pending_review.
We see this issue for PRs raised from forks but not for PRs raised from the same repo.
We use a github app token to authenticate the MCP actions, it has pull request write permissions for the target repo but not for forks.
This usage worked fine for us up until ~December including token/permissions settings and our forking model. Repo settings have not been changed. Therefore we think this is a defect either in Github MCP or with Github itself.
Affected version
This affects the hosted Github MCP server and the last several versions of the dockerised server.
Steps to reproduce the behavior
- Create a repo
- Create a fork of the repo
- Create a PR with a change from the fork to the upstream
- Attempt to have an AI agent configured with GitHub MCP submit a code review with line or file comments as part of the review
- Note that these tool calls are rejected
Expected vs actual behavior
It is expected that comments can be added to reviews on fork PRs, whereas this seems to only work for PRs coming from the same repo.
Logs
Actions logs when error:
Failed to add comment to pending review. Possible reasons:\n\t- The line number doesn't exist in the pull request diff\n\t- The file path is incorrect\n\t- The side (LEFT/RIGHT) is invalid for the specified line\n
Note that in this instance the path, line and side are correct and having an agent create the same comment on a PR from the base repo works without issue.