Repository navigation
Description
Problem
Reviewing a pull request means leaving the editor: a Pull Requests row only opens the forge page in the browser. Builder work already has a far better review surface in the Builders group (changed-file list, native diff, file-to-file navigation). Pull requests from other contributors, which have no local builder or worktree, get none of it.
What to build (lane 1 of 2: read-only)
Make each row in the Pull Requests sidebar group expandable into the pull request's changed files, opening the same native diff editor the Builders group uses.
- Expandable PR rows. A PR row expands to its changed files. A collapsed row costs no git and no forge call, the same rule as builder rows.
- File list parity with the Builders group. Flat list or folder tree following the existing view-as-tree setting, file-type icons, the coloured status letter (added, modified, deleted, renamed), rename source shown, binary files handled.
- Click a file to open a diff. Left side is the merge-base of the PR's base branch and its head; right side is the PR's head commit. Both sides are read-only snapshots. This is the diff the forge shows, not the state of any working tree.
- No checkout, no worktree. The head commit's objects are fetched into the main checkout under a hidden ref namespace owned by Codev, so they stay reachable without creating a local branch. The ref is removed once the PR is no longer open. Nothing from the PR is ever checked out or executed, which matters for PRs from forks.
- Keyboard navigation. The existing next file, previous file and first file commands work in a PR diff, in the visible list order, wrapping at the ends.
- Sidebar follows the editor. When the active PR diff file changes, the matching row is revealed and selected without taking focus, honouring the existing auto-reveal setting.
- Freshness. When the PR's head commit moves, the file list and any newly opened diff reflect the new head. An already-open diff is not silently swapped under the reader.
- Existing row actions stay. Open in Browser and Reference in Architect remain reachable. A row click now toggles expansion, so Open in Browser needs an explicit affordance.
Constraints
- Reuse, do not fork. The diff cache, resource planning, content provider, tree items, decoration provider and navigation already exist for builders. Generalise them to a second diff source (two commits) instead of copying them. Builder behaviour must not change.
- A PR is not a builder. PR rows carry no builder linkage and none of the builder-only surfaces (forward-to-builder lenses, comment-for-builder, the pending review queue) may appear on a PR diff.
- Forge-neutral. The extension gets PR metadata through Tower and the SDK as it does today. It must not call a forge CLI directly. How the head commit is fetched must not hardcode one forge's ref layout in extension code; if a forge-specific ref is needed, surface that as a contract item.
- Contract item for architect main (types are main's): the PR lookup already returns the head commit id from the forge concept, but the wire type does not declare it. Lane 1 needs it declared (optional, so forges that do not emit it degrade to a row that explains why it cannot expand). Confirm the shape with main before coding.
- Failure states are visible rows, not silence: fetch failed, base branch missing, shallow clone, forge unavailable, diff too large.
- Engine floor stays at the current pinned value.
Out of scope (lane 2, separate issue)
Commenting, existing review threads, review submission, verdicts, the Codev panel's Code Review body. Lane 1 must not block them: keep each side's document identity (PR, commit, path, side) recoverable from its URI so lane 2 can anchor comments to it.
Acceptance
- Expanding a PR from another contributor (including one from a fork) lists its files and opens correct diffs, with no new local branch, no worktree and no change to
git status. - The file list and diff content match what the forge shows for the same PR head.
- Builders group behaviour is unchanged (existing tests stay green, plus coverage for the new source).
- Verified by the owner running the extension in the dev host against real open PRs.
Activity
amrmelsayed commentedon Nov 27, 2026
On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).
[PIR #2008] Plan draft
[PIR #2008] types: declare optional PRView.headRefOid
[PIR #2008] Generalise the builder diff stack to a pull-request diff …
[PIR #2008] Pull Requests rows expand into changed files with read-on…
[PIR #2008] Tests: real-git PR ref lifecycle and diff source, PR rows…