# Pull requests

> Track the PRs that need you on the Reviews and My PRs pages, open any PR from its session, and merge, ready or close it without leaving Flow.

Flow keeps your pull requests next to the sessions that make them. Every session on a branch with a PR shows it in its header, one shortcut opens it as a review tab, and the merge, ready, draft, close and auto-merge changes run from the palette. Two queue pages, **Reviews** and **My PRs**, gather the PRs that want something from you across every repository, sorted into sections you define.

This page covers the queue pages, the PR pill and the status changes. Reading a PR, commenting, reviewing, requesting reviewers and review sessions are on [PR review](https://flow.worldbreakstudios.com/docs/features/pr-review.md). To have an agent keep several sessions moving toward a mergeable draft PR, see the `babysit-prs` skill in [Agent skills](https://flow.worldbreakstudios.com/docs/cli/agent-skills.md).

> **Note:** The Reviews and My PRs pages are an experiment (BETA). Turn them on in Settings › Experiments (`features.pull_requests`). While it is off, neither page appears anywhere (the Tools band, the palette's Go to rows) and the queue never fetches. The PR pill, PR review tabs, `⇧⌘G` / `⌥⌘R`, the palette's PR status changes and PR review sessions work with the experiment off.

## Before you start

Flow reads and writes GitHub through the GitHub CLI. Install `gh` and sign in with `gh auth login`.

- Reads go through the read CLI in `git.cli`, by default the bundled `ghx`, a caching client that shows cached data at once and refreshes it in the background. Plain `gh` works too. See [ghx and gitx](https://flow.worldbreakstudios.com/docs/cli/ghx-and-gitx.md).
- Writes (merges, comments, reviews) go through `ghx` while it is the read CLI, which hands them to `gh`; with any other read CLI they run `gh` itself.
- A review tab reads PRs on github.com or on one GitHub Enterprise Cloud tenant (`NAME.ghe.com`). The Reviews and My PRs funnels search github.com only.

## The PR pill

A session whose branch has a pull request shows a **PR pill** at the right of its primary pane's header: the state glyph in the PR colours, `#` and the number, a dim state word (Draft, Open, Merged or Closed) and the checks as passed over total (`✓ 3/4`).

Click the pill to open the pull request:

- With `git.open_pr_in_review` on (the default), it opens as a PR review tab in that session. A review tab already open on that PR is focused instead of opening a second one.
- With it off, or for a PR on a host the review tab can't read, it opens in your browser.

A narrow header drops the PR pill before the branch pill. The pill shows on the Sessions page; a collapsed primary pane has no header.

## Open a pull request

| Action | Default | What it does |
|---|---|---|
| Open pull request | `⇧⌘G` | Opens the session's PR by the PR pill's rule: a review tab while `git.open_pr_in_review` is on, else the browser. |
| Review pull request | `⌥⌘R` | Always opens the session's PR as a review tab. |
| Open PR as session… | unbound | Opens any PR as its own review session. See [PR review sessions](https://flow.worldbreakstudios.com/docs/features/pr-review.md#pr-review-sessions). |

On the Sessions page these act on the active session; on the Dashboard, on the focused card. When Flow has no PR cached for the branch yet (one opened since the last poll), `⇧⌘G` and `⌥⌘R` ask GitHub first and open it when the answer lands.

A review tab opened this way is pinned to the front of its pane's tabs, so `⌘W` keeps it until you unpin it. Turn `git.pin_pr_review_tab` off to open it as an ordinary tab.

## Change a pull request's status

These actions change the session's pull request through `gh`. On the Sessions page they act on the active session, on the Dashboard on the focused card. Each is in the command palette (`⇧⌘P`) and can be bound in Settings › Keyboard.

| Action | Default | Runs | When it applies |
|---|---|---|---|
| Merge pull request | `⇧⌘M` | `gh pr merge N --squash` (the `git.merge_method` strategy) | Open, not a draft, mergeable, no check failing or pending, not blocked or behind its base |
| Mark PR ready for review | unbound | `gh pr ready N` | An open draft |
| Convert PR to draft | unbound | `gh pr ready N --undo` | An open PR that is not a draft |
| Close pull request | unbound | `gh pr close N` | Any open PR |
| Enable auto-merge | unbound | `gh pr merge N --auto --squash` | An open PR that can't merge yet and isn't a draft |
| Disable auto-merge | unbound | `gh pr merge N --disable-auto` | While auto-merge is on |
| Change PR status… | unbound | Opens a picker of the changes above | Any open PR |

- The palette is context-aware: opened beside a session, it lists only the changes that apply to that session's PR, and **Change PR status…** shows the rest dimmed.
- A change that doesn't apply is refused with a toast that says why, for example "Cannot merge pull request: a draft cannot be merged".
- Only one change runs per session at a time. A toast shows the progress ("Merging #12…") and the outcome.
- A merged or closed PR offers no changes; there is no reopen.
- A merge never deletes the branch.

The same changes are in the status selector of a Dashboard card's PR label (see [Dashboard](https://flow.worldbreakstudios.com/docs/workspace/dashboard.md)) and of a review tab's state chip (see [PR review](https://flow.worldbreakstudios.com/docs/features/pr-review.md#identity-row-and-toolbar)).

### Merge method

`git.merge_method` picks the strategy for Merge and Enable auto-merge: `squash` (the default), `merge` or `rebase`. Any other value counts as `squash`. A repository usually allows one strategy, so a team can set it for its repository and your own override still wins. Set it per repository in Settings › Repos; see [Settings scopes](https://flow.worldbreakstudios.com/docs/configuration/settings-scopes.md).

## The Reviews and My PRs pages

- **Reviews** lists the pull requests other people want from you: review requests, re-requests and unreplied @mentions.
- **My PRs** lists the pull requests that are yours: authored by you, assigned to you, or carrying your commits.

Open them from their rows in the sidebar's Tools band, from the palette's **Go to Reviews** and **Go to My PRs** (both unbound), or from a terminal:

```sh
flow-cli page pr_reviews
flow-cli page my_prs
```

Each page has the queue on the left and, on the right, a preview of the selected PR (or the Customize panel). Drag the preview's left edge to resize it (300 to 900 px, one width for both pages); double-click the edge to reset it to 360 px.

### How a PR gets on a page

1. **Funnel.** Each page has a list of GitHub search queries. Their results together are the *watch set*. Everything after this step runs locally.
2. **Mine fingerprint.** A set of clauses, each toggleable, that decide which PRs are yours. My PRs shows what its funnel found plus every watched PR that matches the fingerprint. Reviews never shows a PR that matches it.
3. **Admit** (Reviews only). Of what the Reviews funnel found, only PRs that pass this query are shown. By default that is `review:requested OR mention:unreplied`: a review requested from you or one of your teams, or an @mention you haven't answered. An empty Admit admits nothing.
4. **Sections.** A sieve: in order, each section takes the PRs its query matches that no earlier section took. Whatever is left falls to **Everything else**, which is always last in the sieve.

Within a section, pinned PRs come first in pin order, then the rest by the page's sort: newest activity first by default.

### Refreshing

The queue fetches at launch, every 5 minutes while a page is shown, every 15 minutes while you are elsewhere and the page is in the Tools band (for its badge), and when you enter a page whose last fetch is over a minute old. It also refetches when `ghx` reports a change and a moment after you edit a funnel. The title bar's refresh button reads fresh from GitHub. The last result is saved, so both pages show their PRs at launch before the first fetch.

A fetch error shows as a quiet line in the title bar; only the refresh button raises a toast.

### Rows

Each row shows the PR's state colour, up to three labels, `repo #N`, the author, a reason line, your local tags and pin, the size as `+A −D`, a checks dot and the age. A PR you haven't seen since its last update carries an unread dot where the page shows dots. Leaving a PR selected in the preview for a second marks it seen.

The **reason line** says why the PR is there, first match wins: ignored, snoozed, woke up, @mentioned and unreplied, or draft. Then on My PRs: changes requested, approved, "Yours via" the fingerprint clause that matched (when someone else authored it), or waiting on review. On Reviews: re-requested (with the number of commits since your review), you approved, requested you (turning warmer once the request is over 48 hours old), via a team, or involved.

### Badge and unread dots

Each section has a bell. A belled section counts toward the page's badge in the sidebar; on Reviews it also shows unread dots. The badge counts the PRs in belled sections. My PRs shows no unread dots by default. A muted section is shown dimmed.

### The preview

The preview of the selected PR shows, top to bottom:

- an amber **Needs your reply** callout for an unreplied @mention, with Reply, Resolve and Open thread buttons that open the PR's review session;
- an excerpt of the description;
- the Files, Diff and Threads counts, the checks and the reviewers;
- the **Local** box: Pin, Snooze, your tags and an "Until query…" field (see below);
- the main button: **Start review** on Reviews, **Open PR session** on My PRs, or **Resume review** when a review session on the PR is already open. It opens the PR as a review session; see [PR review sessions](https://flow.worldbreakstudios.com/docs/features/pr-review.md#pr-review-sessions).

### Default sections

| Reviews section | Query | Bell |
|---|---|---|
| Pinned | `local:pinned` | on |
| Needs response | `mention:unreplied` | on |
| This sprint | `tag:this-sprint` | on |
| Re-requested | `review:re-requested` | on |
| Asked me directly | `review:requested-me -review:approved-by-me` | on |
| Quick team reviews | `review:team size:<300` | on |
| Dependency bumps | `author:bot OR label:dependencies` | off |
| Everything else | (whatever is left) | off |
| Waiting on CI | `checks:pending OR checks:fail` | off |
| Drafts | `is:draft` | off |
| Snoozed | `local:snoozed` | off |
| Ignored | `local:ignored` | off |

| My PRs section | Query | Bell |
|---|---|---|
| Pinned | `local:pinned` | on |
| Needs response | `mention:unreplied` | on |
| Changes requested | `review:changes-requested` | on |
| Failing checks | `checks:fail` | on |
| Agent PRs to vet | `author:bot` | on |
| Ready to merge | `review:approved checks:pass` | off |
| Everything else | (whatever is left) | off |
| Drafts | `is:draft` | off |
| Snoozed | `local:snoozed` | off |
| Ignored | `local:ignored` | off |

Both tables are in display order. The sieve order differs: Pinned, Ignored and Snoozed catch first, so a pinned, ignored or snoozed PR lands in that section whatever else it matches.

The default funnels are `is:pr is:open involves:@me` and `is:pr is:open review-requested:@me` for Reviews, and `is:pr is:open author:@me` and `is:pr is:open assignee:@me` for My PRs. The default fingerprint is `author:@me`, `assignee:@me`, `commit-email:@me` and `co-author:@me`, all on, plus a `head:` branch-prefix clause that starts off.

## Pin, snooze, ignore and tag

These annotations live only in Flow and are never sent to GitHub. They are kept in `~/.flow/pr_local.json` and apply on both pages. Right-click a row for Pin and Snooze, or use the preview's Local box.

- **Pin** (`P`) puts the PR at the top of its section, in pin order, and into the Pinned section. Pinning clears a snooze.
- **Snooze for a while**: 1 hour, tomorrow at 9:00, or Monday at 9:00, in your local time. Snoozing unpins.
- **Snooze until…** something happens: new commits (`commits:new`), checks pass (`checks:pass`), re-requested (`review:re-requested`) or @mentioned (`mention:unreplied`). For anything else, type a query in the Local box's "Until query…" field and press `↩`; the PR wakes while that query matches.
- **Forever · ignore** (`E`) moves the PR to Ignored until you stop ignoring it (`E` again, or **Stop ignoring** in the menu).
- A woken PR returns to its normal section with a "Woke up" reason and matches `local:woke`. The snooze stays until you clear it with **Wake now**.
- **Tags** are free words, trimmed and lower-cased. Filter on them with `tag:NAME`, as the default "This sprint" section does with `tag:this-sprint`.

## Keyboard

With no field focused on a queue page:

| Key | Action |
|---|---|
| `↑` / `↓` or `J` / `K` | Move the selection |
| `↩` | Start or resume the selected PR's review session |
| `P` | Pin or unpin |
| `E` | Ignore, or stop ignoring |
| `⌘C` | Copy the PR's link |
| `/` | Focus the search box |
| `Esc` | Close Customize, else clear the search |

In the search box ("Filter by title, repo, author"), `↑` / `↓` still move the selection and `Esc` clears the search, then leaves the box. Other `⌘` chords keep their usual meaning.

## Customize a page

Click **Customize** in a page's toolbar to replace the preview with the editor. Edits save as you type. **Reset to defaults** restores the page's built-in configuration.

- **Funnel · GitHub search**: one GitHub search query per row, `+ Add query` to add one. The queue refetches once you stop typing. Past 100 watched PRs the page suggests narrowing the funnel.
- **Mine fingerprint** (on My PRs): the clauses that make a PR yours; each has an on/off check, and `+ Add clause` adds one. Each clause shows how many open PRs it matches. Reviews uses the same fingerprint to leave your own PRs out.
- **Admit** (on Reviews): the query a funnel PR must pass.
- **Sections**: the **Sieve** tab (what catches) orders the sections for catching, with Catch earlier / Catch later, delete and `+ Add section`. The **Display** tab (what shows first) orders them on the page with Show higher / Show lower. A new section is named "New section", has an empty query (which matches nothing) and starts belled. Click a section's bell to count it toward the badge or not, and its dim toggle to show it dimmed.

Each page's configuration is a JSON value in your settings: `pr.reviews` and `pr.mine`. Besides what Customize edits, it holds `sort` (`updated`, the default: newest activity first; `created`: newest opened first; `size`: smallest first; `age`: oldest opened first) and `dots` (whether the page shows unread dots).

## Query language

Fingerprint clauses, the Admit query, section queries and "Until" snoozes share one local query language. (Funnels are GitHub search strings and use GitHub's syntax.)

- Terms separated by spaces must all match.
- A standalone `OR` (upper case) separates alternatives; any alternative may match.
- A leading `-` negates a term.
- There are no parentheses and no quoting, so a label with a space can't be named.
- An empty query matches nothing.
- A term Flow doesn't know (a bare word, an unknown key or value, a malformed comparison) is flagged as `Unknown term: …` and fails its whole alternative, so a typo never widens a query.

| Term | Values | Matches |
|---|---|---|
| `review:` | `requested` | A live review request from you or one of your teams |
| | `requested-me` | A request from you directly |
| | `team` | A request via a team only |
| | `re-requested` | A live direct request after you submitted a review |
| | `approved`, `changes-requested`, `none` | GitHub's review decision |
| | `approved-by-me` | Your latest review approves |
| `checks:` | `pass`, `fail`, `pending`, `none` | The head commit's checks rollup |
| `author:` | `@me`, `bot`, a login | Who opened the PR |
| `assignee:` | `@me`, a login | Who it is assigned to |
| `commit-email:` | `@me`, an address | The commits' author emails |
| `co-author:` | `@me`, an address | The commits' `Co-authored-by:` trailers |
| `head:` | a branch, or a prefix ending in `*` | The head branch (case-sensitive) |
| `label:` | a label name | A label on the PR |
| `repo:` | `owner/name` or `name` | The repository |
| `tag:` | a local tag | Your Flow tags |
| `is:` | `draft`, `unread` | A draft; changed since you last saw it |
| `commits:` | `new` | New commits since you last saw it (or since your review) |
| `mention:` | `unreplied`, `unresolved`, `any` | Someone else @mentioned you |
| `local:` | `pinned`, `snoozed`, `ignored`, `woke`, `any` | Your annotations |
| `age:` | `>2d`, `<=12h`, `>1w` | Hours since opened (units `h`, `d`, `w`; `h` by default) |
| `size:` | `<300` | Additions plus deletions |
| `threads:` | `>0` | Unresolved review threads |

Keys are case-insensitive. Logins, labels, repositories and emails compare ignoring case; the values of the fixed keys are exact lower-case words. A comparison is an optional `>`, `>=`, `<` or `<=` (none means equal) and digits.

`mention:unreplied` means an unresolved review thread holds someone else's comment mentioning you with no comment of yours after it, or a top-level comment mentioning you that you haven't answered with a later top-level comment. `unresolved` adds mentions in unresolved threads you did answer; `any` is a mention anywhere, the description included.

`@me` in `commit-email:` and `co-author:` means any of your emails: `git config --global user.email` plus the addresses in the `pr.me.emails` setting (a JSON array of strings).

Some examples:

```text
review:requested -review:approved-by-me
checks:fail OR checks:pending
author:bot label:dependencies
size:<300 age:<2d
```

## Settings

| Key | Type | Default | Effect |
|---|---|---|---|
| `features.pull_requests` | boolean | `false` | Shows the Reviews and My PRs pages (Settings › Experiments) |
| `git.open_pr_in_review` | boolean | `true` | `⇧⌘G`, the PR pill and a Dashboard card's PR label open a review tab; off, the browser |
| `git.pin_pr_review_tab` | boolean | `true` | A review tab opened by `⇧⌘G`, the PR pill or `⌥⌘R` is pinned to the front of its pane |
| `git.merge_method` | `squash`, `merge` or `rebase` | `squash` | Strategy for Merge and Enable auto-merge |
| `git.cli` | text | `ghx` | The program that reads PR data; empty means `ghx` |
| `git.async` | boolean | `true` | Serve cached data at once and refresh in the background; not available with plain `gh` |
| `pr.reviews` | JSON object | built-in | The Reviews page's funnel, Admit, sections, sort and dots |
| `pr.mine` | JSON object | built-in | The My PRs page's funnel, fingerprint, sections, sort and dots |
| `pr.me.emails` | array of strings | none | Extra addresses `@me` matches in `commit-email:` and `co-author:` |

The `git.*` toggles are under Settings › General › Pull requests. `git.open_pr_in_review` and `git.pin_pr_review_tab` can differ per repository but are never set by a team file.

## Limits

- The funnels search github.com only; GitHub Enterprise funnels aren't supported.
- Team review requests need your teams. If Flow can't read them (for example a token without `read:org`), every team request counts as yours.
- Mention detection reads each PR's newest 20 review threads and the newest 10 comments in each, so a mention only in an older thread doesn't count as unreplied.
- Flow doesn't create pull requests; open them with `gh pr create` or your agent.
