# Pull requests

> Read, review and merge pull requests, and follow CI runs from GitHub or GitLab.

Rexa reads pull requests, issues and CI runs through the GitHub CLI (`gh`) or the GitLab CLI (`glab`). It never stores a token; your CLI login is used.

## Connect

<Steps>

### Install the CLI

```bash [Terminal]
brew install gh     # GitHub
brew install glab   # GitLab
```

### Sign in

```bash [Terminal]
gh auth login
```

For a self-hosted host, add `--hostname <host>`.

### Open the Forge sidebar

Press <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>U</Kbd>. Rexa picks the host from the `origin` remote. If something is missing, the sidebar shows the command that fixes it.

</Steps>

## Forge sidebar

The sidebar has three tabs: **Issues**, **Pull requests** and **Actions** (merge requests and pipelines on GitLab). Each tab shows its open count. Click a row to open it as a center tab.

Lists show up to 50 open pull requests, 100 open issues and 30 runs. A list read in the last five minutes is reused; the refresh button always re-reads.

From the palette, **github: open pull requests** and **github: open issues** run a live search you can edit with qualifiers such as `author:@me` or `is:merged`.

## Pull request page

The header shows the state, title and number, with a **Conversation | Changes** switch. A summary strip shows files and line totals, checks, review decision, mergeability and the head commit.

### Conversation

- **Timeline:** comments, reviews, commits and state changes. Resolved review threads fold away.
- **Comment box:** Write and Preview tabs. <Kbd>⌘</Kbd> <Kbd>↵</Kbd> posts.
- **Each comment's `…` menu:** copy link, copy Markdown, quote reply, edit where the host allows it, and **Mention** to hand it to an agent.

### Checks

Checks are listed under a headline, open while any check fails or runs. A check's `…` menu opens its log in Rexa or in the browser. Skipped checks never count as passed.

### Merge

Choose **Merge**, **Squash and merge** or **Rebase and merge**. Rexa asks first, naming the head, base, commit and check state.

The merge is pinned to the commit you reviewed: if the pull request moved since, the merge fails instead of landing unreviewed code. Auto-merge, merge queues and branch deletion are not available.

## Review changes

The **Changes** side shows the pull request's diff, split or inline.

<Steps>

### Comment on lines

Select lines and press <Kbd>⌘</Kbd> <Kbd>I</Kbd>, click the chip, or right-click → **Comment on line N**.

### Add to a review, or post now

| Shortcut                                     | Does                                      |
| -------------------------------------------- | ----------------------------------------- |
| <Kbd>⌘</Kbd> <Kbd>↵</Kbd>                    | Start a review, then add to it.           |
| <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>↵</Kbd>       | Post the comment on its own, now.         |
| <Kbd>Esc</Kbd>                               | Cancel.                                   |

Pending comments carry a **Pending** tag and survive a relaunch.

### Finish the review

Click **Review changes** in the header, write a note, and pick **Comment**, **Approve** or **Request changes**. On your own pull request, only Comment is offered.

</Steps>

On existing threads you can reply, resolve or unresolve, edit, and delete. Delete asks first. Changes show at once, marked **Sending…** until the host confirms.

## Issues

Issue pages show the description and comments. Comment and edit work as on a pull request. Closing, labels and assignees are not available.

## CI runs

A run page shows the jobs as a graph, annotations and artifacts.

- **Job logs** list each step with its duration. Failed steps open on their own; **Search logs** filters lines.
- **Re-run** failed jobs or all jobs on a finished GitHub run.
- **Download an artifact** to `~/Downloads`. Deleting an artifact asks first.

GitHub publishes job logs only after the whole run finishes.

## Hand work to an agent

Drag a pull request, issue, run, comment, check or log step onto an agent's terminal. The agent gets a short brief with the link. Dropped on a plain shell, the same row writes a command such as `gh pr checkout 5` or `gh run view 812 --log-failed`.

**Mention** in any `…` menu does the same through the agent picker. Nothing is sent until you press Enter in the agent's terminal.

## Not supported

- Checking out a pull request into a new worktree from its page. Drag the row onto a shell for `gh pr checkout`.
- Reactions, labels, assignees and reviewer requests.
- Suggestion blocks in review comments.
- Cancelling a run or re-running a single job.
- Forge settings. GitLab support is tested against fixtures only.
