yardsort

Pull requests

Every pull request of every project, in one place: who opened it, what CI and the reviewers made of it, and a way to merge it, close it or start an agent on it. Open it with Pull requests at the very top of the sidebar, or from the command palette (Mod+K, then Pull requests). It takes over the center panel the way a workflow and Usage do; × in its header closes it, and so does pressing the row again or selecting a workspace.

The Pull requests view: the list on the left, one pull request open on the right with its description, checks and reviewers

The number on the sidebar row is how many pull requests are open across your projects, with a + after it when a repository has more open than the list reads.

It needs the GitHub CLI, installed and logged in, and it is for projects on GitHub. Yardsort still holds no credential of its own: everything here is gh, with the permissions you already have.

This is the view for pull requests you did not open from a workspace — a teammate's, one from another machine, one an agent opened last week. The pull request a workspace opened is also on its own row and toolbar: see Commits & pull requests.

The list

One row per pull request, most recently updated first, from every project whose repository is on GitHub:

  • the project and the number, with a pill that says Open, Draft, Merged or Closed in the colours a workspace's badge uses;
  • the title;
  • who opened it, the checks as passed out of all that reported (✓ 12/12, ● 9/12 while some are running, ✕ 10/12 when any failed — a cancelled check is a failure), how long ago it was opened, the lines +added −removed, and ⚠ conflicts when GitHub says it cannot merge into its base as it is.

A pull request that has a workspace says which under its row; press that to go there.

↑ and ↓ move between rows, Home and End jump to the ends, and Enter opens the one in focus.

Pull requests in other repositories

A pull request a workspace tracks in another repository is listed under the workspace's project, with the repository after the project's name — app · demo/lib — so the project filter finds it and its number is not taken for the project's. The sidebar's count includes the open ones.

Its details show the same header and Summary — description, checks with their links, reviewers and conversation — read by its link. The actions are Go to workspace, Stop tracking, Merge, Close or Reopen, Open on GitHub and Copy link, and the Summary has the reply box. Each is done to it by its link, in its own repository, and each confirmation names it — Close pull request demo/lib#7 — so it is not taken for the project's #7. Start workspace is not offered: its repository is not a project.

Code reads its diff in the project's nested clone of its repository — a folder directly in the project's checkout that is a clone of it — fetching its commits there as a project's own are fetched: into refs of Yardsort's own, with nothing checked out and no branch moved. The comments on its lines show beside them. Without such a clone Code says so, with a link to its diff on GitHub. Note on lines… is for a project's own pull requests.

Request code review… has a second agent review it: it reads the diff, runs the checks in a worktree of the clone of its own, and posts its review on GitHub, and the agent that opened the pull request is told when it is there. It needs the clone. See A pull request in another repository; a trigger on pr.opened can do it for each one tracked. Its fetch leaves the clone's own checkout, branches and FETCH_HEAD as they were, so someone working in it is not disturbed. Stop tracking also deletes the commits fetched for it, once no workspace of the project follows it.

When one cannot be read — a mistyped link, a repository your gh login cannot see, GitHub not answering — a line above the rows says so and why, with Retry and Stop tracking. One that was read before keeps its row, with what was known then: its checks and reviews may be out of date until it reads again.

What is in it

Every open pull request of each repository, up to the 200 most recently updated, and the 50 newest of any state. Past 200 open the view says so — Showing the 200 most recently updated of 1,394 open in api-gateway — with a link to the rest on GitHub. An older merged or closed pull request is not listed; the Merged and Closed tabs show the recent ones.

Filters

FilterWhat it does
StateThe tabs in the header: All, Open, Merged, Closed. It starts on Open; a draft is open.
ProjectsAny number of projects. None chosen means all of them.
AuthorOne author, out of everyone in the list. Me is whoever gh is logged in as.
ReviewsWhere it stands with its reviewers — see below.
SearchTitle, branch or number. #12 and 12 both find number 12.

The review filters:

  • No reviews — nobody has reviewed it yet.
  • Review required, Approved, Changes requested — GitHub's own decision. A repository with no review rule has none, and then the latest reviews decide: any request for changes outranks any approval.
  • Reviewed by you and Not reviewed by you — by your latest review. Your own pull requests are not counted as ones you have not reviewed.
  • Awaiting review from you — a review was asked of you, by name, and you have not given it. A request made of a team you are in is not counted.

The three about you are greyed out until gh has said who you are.

State, projects, author and reviews are remembered across restarts. Search is not. Clear filters appears whenever something is narrowing the list, and puts everything but the tab back.

Filters and search work on the pull requests that are loaded. That is why the view tells you when GitHub has more open than it read, rather than letting a search come up empty.

The details

Press a row and its details open beside the list. At the top: the project, who opened it and when, and what you can do with it. Under that, two tabs: Summary and Code. The tab you are on is kept as you go from one pull request to the next.

The Summary:

  • What it is — number, state and review decision, the title, branch → base, the lines added and removed, whether it conflicts with its base, and when it last changed.
  • Description — what its author wrote, shown as GitHub shows Markdown: headings, lists, tables, task lists, code.
  • Checks — one line that sums them up (All 12 passed, 2 of 12 failed, 3 of 12 still running), then every check with its workflow and how it went, failures first. Press a check to open its run on GitHub. A cancelled check counts as failed.
  • Reviewers — each reviewer's latest word, and everyone a review is still being asked of.
  • Conversation — the comments and reviews, oldest first, each with who, what they did (commented, approved, requested changes) and when. ↗ opens that one on GitHub. A comment GitHub has hidden — as spam, off-topic, outdated — says so and stays hidden here too.

The top of the Summary comes from the list and is there at once; the rest is read when you open the row, and again whenever the list notices the pull request changed — a push, a comment, a review, a check finishing. If it cannot be read, the reason is shown with Retry, and what the list knows stays on screen.

What is shown of other people's words

A description or a comment is written by whoever opened or commented on the pull request, so it is shown with care:

  • No images are loaded. An image is a request to a server of the author's choosing, made the moment you read their words. It appears as a link — [image: the new dialog] ↗ — that opens in your browser if you choose to press it.
  • Links open in your browser, never inside Yardsort. Only web and mail addresses are links.
  • HTML is not rendered: a template's hidden comments disappear, and nothing a page could run is run.
  • The boxes of a task list show what was ticked. They are not ticked from here.

Replying

A box under the conversation posts a comment on it: write, then Comment, or Ctrl+Enter / ⌘Enter. Pressing it is the confirmation; nothing is posted any other way, and the box keeps what you wrote if GitHub refuses. Markdown, as on GitHub. The conversation is read again as soon as it is posted.

Comments on particular lines of the code are not in the conversation: they are under Code, beside the lines they are about. A review that has only such comments reads Left comments on lines of the code here.

Code

The pull request's diff, in the viewer the changes panel uses.

It opens on the files: how many changed and by how many lines, then each file with what happened to it — M modified, A added, D deleted, R renamed — and its lines added and removed. Hover a renamed file for where it came from.

Press a file to read it:

  • the diff, syntax-highlighted, with the stretches that did not change folded away;
  • Side by side / Inline switches between two panes and one. It is the same setting as the changes panel's, and remembered;
  • the Files box and ‹ › go to another file without going back to the list, and ← All files goes back to it;
  • an image is shown before and after; a binary file, or one too large to show, says so.

Nothing is checked out for this. The first time you open Code for a pull request, Yardsort fetches its commits with git and keeps them under names of its own in the project's repository (refs/yardsort/pull/…). No branch of yours moves, no remote-tracking branch moves, and no files appear anywhere. After a push to the pull request they are fetched again; when the pull request leaves the list, what was kept for it is removed.

The diff is what the pull request changes from where it left its base branch, as GitHub shows it. For one merged long ago, that is the base as it was then.

The fetch uses git's own credentials — your SSH key or credential helper, the same as a push — and never asks for anything on screen. If it fails, the tab shows what git said, with Retry and See the diff on GitHub ↗. The Summary does not depend on it.

Comments on lines

Each file in the list says how many comment threads it has. Open the file and each thread sits under the lines it is about — the first comment with its replies, who, when, and ↗ to it on GitHub. A comment on the old text sits under the line the new text has where the old one was; side by side, it sits in the left pane. A comment the diff has moved on from, or one about the file as a whole, is listed under the viewer instead, with where it was. They are read with the diff and again whenever the pull request changes.

The Code tab: a changed file, with a review thread and its reply under the line they are about

A note on lines, for an agent

Select lines in the diff — in either pane — and press Note on lines…. The dialog shows the lines, takes your note, and says before you press anything where it will go:

  • The pull request has a workspace: to the agent there, by the rules the conflict helper uses. Running and quiet, it is typed into that conversation, along with anything you had typed there and not sent. Ended, the conversation is resumed with it. One that cannot be continued gets a new conversation of the same agent, given the note and the workspace's task. A busy agent is never typed into: the dialog says so, and offers GitHub alone.
  • No workspace yet: Start a workspace with it gets the branch ready, as Start workspace does, and opens the composer with the note as the agent's first message. Nothing starts until you press Start there.

The agent is told the pull request, the file, the lines and which side of the diff they are on, the lines themselves, and your note, and asked to act on it in the worktree and commit — never to rebase or force-push. Sending takes you to the workspace.

Also post it on GitHub makes the same note a comment on those lines of the pull request, as well; Post on GitHub only posts it and asks no agent. GitHub goes first, because GitHub can refuse: it takes a comment only on lines the diff touches or shows around a change, and the viewer lets you select any line of the file. A refusal is shown in the dialog before the agent has heard anything, so pressing Send again gives the agent the note once. Should the agent be the one that cannot be reached after GitHub has the comment, the dialog says so, and sending again does not post it twice. Cancelling, or Esc, sends nothing anywhere; while a send is under way the dialog stays until it is done.

Moving around

⇤ in the corner hides the list to give the details the whole panel, and ⇥ brings it back; you can also drag the line between them. × or Esc closes the details and puts the focus back on the row. In a narrow window the two stack, list on top.

What you can do

ButtonOffered whenWhat it does
Go to workspacea workspace already has itSelects that workspace.
Start workspaceit is open and no workspace has itFetches its branch and opens the composer on it.
Merge ▾it is openSquash, merge commit or rebase — after a confirmation.
Closeit is openCloses it without merging — after a confirmation.
Reopenit is closed, not mergedOpens it again — after a confirmation.
Open on GitHub ↗alwaysOpens it in your browser. Copy link is beside it.

Any pull request of a project can be acted on from here, not only your own, so every confirmation says whose it is — grace opened it, not you — along with its number, title and branches. Cancelling does nothing at all.

GitHub decides what you may do. If it refuses — no permission, a required check, a branch protection — its own words appear under the buttons, and the list is read again.

Merge

Merge ▾ offers Squash and merge, Create a merge commit and Rebase and merge. It is greyed out, saying why, for a draft and for a pull request that conflicts with its base.

The confirmation shows the commit it will merge. Yardsort asks GitHub about the pull request again and merges only if it is still open, still not a draft, and still at that commit: if someone pushed in the meantime, nothing is merged and you are asked to look again. No branch is deleted, and nothing is forced past a protection. On a branch that requires a merge queue, gh queues it instead, and the view says the request was sent rather than that it merged.

Close and reopen

Close closes the pull request without merging it. Its branch is kept and no comment is posted. Reopen is confirmed too, for what it sets off rather than for any risk: reviewers are notified, and checks may run again.

From a link… in the header takes a pull request's or an issue's address and opens it here or in Tasks, cloning its repository first when it is not a project yet. It is the same as the Tasks view's, described in Tasks.

Start a workspace from a pull request

Start workspace gets the pull request's branch into the project's repository and opens the composer with Open existing branch already on it. Pick the agent, say what you want — review this, fix the failing test — and start. Until you press Start no worktree exists; cancelling leaves only the branch.

From a terminal, ys pr checkout does the same in one step: it opens the workspace on the branch and starts nothing in it. ys pr list lists what this view lists, open pull requests only, with the same review filters.

What it does to the repository depends on where the branch is:

  • You already have the branch locally — it is opened exactly as it is. Yardsort never moves a branch of yours: if it is behind the pull request, the composer says by how many commits.
  • The branch is in the project's own remote — it is fetched, and a local branch is made that tracks it, so a push from the workspace updates the pull request.
  • The pull request comes from a fork — see below.
  • Something already has the branch checked out that Yardsort does not know as a workspace — nothing happens, and the message says where. Git allows a branch in one place at a time.

From a fork

A fork's branch is not in your project's remote, so the workspace gets a local branch named pr/<number> at the pull request's head, set to follow it:

  • git pull in the workspace brings in what the author pushes.
  • Yardsort does not push it. The changes panel shows no Push there, and says why: a push would create pr/<number> on your project's remote instead of updating the fork. A plain git push in a terminal is refused by git for the same reason.
  • The pull request still shows on the workspace's row and toolbar, as it would for a branch of your own.
  • Request code review works there too. It finds the pull request by the number the branch follows, not by its name, and the reviewer posts on the pull request in your project's repository, not on the fork.

If you have push access to the fork and want to update the pull request, push by hand from a shell tab to the fork's URL and branch.

How often GitHub is asked

  • When Yardsort starts, every open pull request is read once, so the count is right and the view opens with rows in it.
  • While the view is open: when you open it, when you come back to the window, once a minute, on Refresh, and after anything you do to a pull request.
  • While it is closed, only the newest fifty per project are read, as they always have been for the workspace badges — plus, one at a time, any older open pull request a workspace shows, so its badge does not stay as it was when Yardsort started.
  • For a trigger on one of a workspace's pull request events, that workspace's pull request is read once a minute while the trigger is on, with one question that has its checks, its reviews and its comments, whether this view is open or not.

The open pull requests are read fifty at a time. On a busy repository that is a few seconds a page, which is why the whole list is only kept fresh while you are looking at it.

A pull request's Summary is one more question, about a second, asked when you open it. The answer is reused for half a minute, and asked for again when the list says something about the pull request changed.

Code asks GitHub nothing the list has not already asked: the two commits it reads between are the ones the list names. It asks git, once for each head commit — when you first open the tab for a pull request, and again when the list notices a push to it. Going between files, and coming back to a pull request you have already read, costs no network at all.

When something is missing

The view says why, on a line above the rows, without hiding the projects that are fine:

  • gh is not installed — install the GitHub CLI and run gh auth login.
  • Nobody is logged in — run gh auth login in a terminal, then Refresh.
  • A project is on GitLab or Bitbucket — pull requests are listed for GitHub only. Opening a merge request from a workspace still works.
  • A project has no remote on a forge — there is nowhere to ask.
  • gh failed — what it said, with Retry. HTTP 502 and HTTP 504 are GitHub taking too long, which a busy repository does now and then.
  • Not every open pull request could be read — the ones that arrived are shown, with what went wrong and Retry.
  • One pull request could not be read — its Summary says why, with Retry. The row and everything the list knows about it are still there.
  • Its commits could not be fetched — Code says what git said. Permission denied means git has no credentials for the remote in a place it can use without asking: an SSH key that needs a passphrase typed, most often. The same fetch from a shell tab will say more.

What it does not do

  • Reply to a comment on lines from here: the thread's ↗ opens it on GitHub.
  • Approve or request changes, edit a title, or change labels, assignees or reviewers.
  • Delete a branch, after a merge or ever.
  • List pull requests for GitLab, Bitbucket or Gitea.
  • Search GitHub: search is over what is loaded.