Repository navigation
Show which files conflict in the pull request panel #17740
thomas-anst
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
When a pull request conflicts with its base branch, the PR panel shows that it is conflicting and offers Resolve conflicts. It does not show which files conflict, or what conflicts in them. To find out, the user has to check out the branch and merge locally. GitHub does not show this either.
Seeing the conflicts first tells the user how big they are and whether to hand them to an agent or fix them by hand.
Proposal
A Merge conflicts section in the PR panel's summary tab. It sits below Reviewers and Labels, above Description. It shows only while the PR is open and the host reports it as conflicting.
Editing in the panel is out of scope. The editor works on files on disk in a thread's worktree, and the existing Check out + agent flow already covers that.
Approach
GitHub, GitLab and Forgejo expose a conflict flag but no file list, so the server computes it from the project's local checkout:
Two new reads in
packages/contracts:pullRequests.conflictstakes aPullRequestRefand returns{ paths, truncated } | null.pullRequests.conflictFiletakes a ref and a path and returns{ contents } | null.Both are separate from
detail, so the pull request watch never pays for them. The client asks for them only when the detail saysconflicting, and for a file only when it is expanded.The server looks for the checkout remote whose URL matches the PR's repository, so
originbeing a fork is no problem. If no remote matches, nothing is computed.It fetches the base branch and the PR head (
refs/pull/<n>/head, orrefs/merge-requests/<n>/headon GitLab) into private per-PR refs,refs/t3/pull-request-conflicts/<n>/{base,head}. The fetch uses an empty--refmapand never prompts for credentials. The user's remote-tracking branches never move, and concurrent reads cannot swap heads throughFETCH_HEAD.It then runs
git merge-tree --write-tree --name-only --no-messages -z, which needs git ≥ 2.38 and never touches the worktree or index. A file's conflict comes from the merged tree that command writes, and only listed paths can be read. Results are cached for 30 s and capped at 100 paths, and the prompt says when the list is truncated.Any failure (no matching remote, shallow clone, older git, network) returns
nulland is logged. The section then stays hidden, and the host's flag and the existing actions are unchanged.Scope: web and desktop. Mobile has no PR detail view. Bitbucket and Azure keep the section hidden until their head refs are wired. MCP exposure is out of scope for now, but the logic lives in service methods.
Two structural points need your call: two new WebSocket methods in
packages/contracts, and a new dependency fromPullRequestServiceonGitVcsDriver.GitVcsDriveris already provided to it inserver.ts.Status
A working implementation is on
thomas-anst/t3code@feat/pr-panel-merge-conflicts. It has focused tests, including real-git tests for the merge, the private-ref fetch and reading a conflicted file. It has also been checked by hand against real conflicting PRs.If you agree with the direction and scope, I will open the PR with before/after screenshots and link it here. I can also split it into two PRs: the file list first, then viewing and per-file resolve.
Drafted with Claude Code (Claude Opus 5.5).
All reactions