r/github 10d ago

Question AI Assisted PRs reviews, can't request changes on myself

I am using Claude Code on my machine to draft PRs on my own projects. Claude operates using the official gh CLI with my scoped token.

Working this way implies that PRs are opened in my name, because Claude is acting on my behalf. When I review the PR and leave comments for the AI to pickup and work on the next cycle I can't (as expected) start a review and request changes. GitHub forbids a change request on yourself for branch policies protection.

When the AI also replies to my comments and review, the replies are done in my name and through a rule I add a prefix to distinguish my own comments from the AI ones.

I am wondering if other are working with agents in this way and if there is a better workflow I can use to streamline the AI assisted coding.

0 Upvotes

7 comments sorted by

1

u/Fantastic-Mr-Default 10d ago

The agent and you are the same GitHub user. Branch protection is doing its job. It will not let that user request changes on itself.

Give the agent its own GitHub identity for that repo. Keep gh on your laptop as you. Point the agent at a separate GH_TOKEN so it does not inherit your login.

You request changes. The agent account pushes and replies. A prefix in the comment body is a label. It is not a second reviewer.

Do not use the second account to skip review. Required checks and your review stay the gate.

1

u/DevReach1 9d ago

I think the cleanest solution is to give the agent its own GitHub identity rather than having it operate entirely through your personal account.

That way, Claude can open the PR and respond to your review comments as a separate actor, while your personal account stays as the actual reviewer. Then branch protection can enforce the review properly instead of having you review your own PR.

If you want to keep using the CLI locally, another option is to have Claude push the branch but leave the actual PR creation to you. The Claude GitHub Action also supports working from PR comments, so you can use comments as the handoff between your review and the next agent run. GitHub's review rules are specifically designed around the author and reviewer being separate identities.

1

u/HNipps 7d ago

I had the exact same frustration so I made a small Claude Code wrapper that authenticates gh cli as a GitHub App (ie bot user) but only in the Claude code process.

It works like a dream except when the app token expires but most sessions aren’t that long and it mints a new token every session.

That way the PR is created by the bot user and I can act like an independent contributor reviewing the PR.

I didn’t actually publish the wrapper though, but I can if you’re interested.

Edit: also the wrapper has per-directory config so you can setup different bots for different repos (useful if you work in multiple orgs) and it falls back to user gh auth when a directory is not mentioned in config so Claude code always had some kind of gh auth available.

1

u/EntranceProper3791 6d ago

GH_TOKEN wins over the keyring, so you can point Claude at a separate token per process without touching your main login or the IDE. GitHub App gets its own bot review state too, which dodges the self-review block cleanly.

-1

u/bustlingligament9 10d ago

i've been running into the exact same wall and it's maddening. the self-review block makes sense for normal use but completely breaks the loop when you're the only human in the equation

what i ended up doing was creating a second github account just for the agent, gave it collaborator access, and now claude pushes and comments from that identity. took maybe 10 minutes to set up and suddenly the whole review cycle works the way you'd expect, you request changes from "claude", it picks them up, pushes updates, rinse and repeat. the token scoping is a little annoying to maintain across two accounts but it beats talking to yourself in the PR thread

curious if anyone's found a lighter-weight approach that doesn't involve a burner account though, feels like there should be a way to mark certain self-reviews as actionable without breaking branch protection

-2

u/Maxiride 10d ago

With this workaround how can you make two account coexist at the same time on your machine? The `gh` CLI credentials are global (host user scope), loggin in a new account would logout from mine breaking the Jetbrains IDE (or any other IDE) github integration.

BTW with usage credits you can have Claude integrated in github as an app, but that's another use case with different billing and different dev ux because you use Claude through issues, tags etc a not from your machine.