<!-- https://ouijit.com/docs/pull-requests/ · rendered as Markdown for agents and LLMs -->

# Pull requests

An experimental GitHub surface: a pull request inbox, review comments staged locally until you send them, and merging. It drives the `gh` CLI, so `gh auth login` is the only setup.

## Turn it on

Enable **GitHub** under **Project Settings → Experimental**. It needs the [GitHub CLI](https://cli.github.com) 2.48.0 or newer on `PATH`, signed in via `gh auth login`, and an `origin` remote on GitHub. Ouijit never stores a token; every GitHub call goes through `gh` on the host, and sandboxed terminals never see your credentials.

## Work the inbox

The panel lists open pull requests in three groups: **Needs your review**, **Authored**, and **Everything else**, with an issues tab beside them. A pull request opens into **Summary**, **Timeline**, and **Code** tabs: checks, review threads with resolve and reply, and per-file diffs with a **Viewed** state that resets when the head changes. Browsing a pull request never checks anything out.

## Stage a review

Review comments start as local drafts. Nothing reaches GitHub until you press **Comment**, **Approve**, or **Request changes**, which submits the drafts as one review. Drafts re-anchor when the pull request's head moves; one that can no longer be placed is flagged rather than deleted, and blocks submission until you discard or rewrite it, because GitHub would reject the whole review.

Agents stage drafts through the CLI, and each draft shows its origin so you can tell who wrote what before sending:

```
ouijit pr draft add 42 --file src/api.ts --line 88 \
  --origin claude --body "this can throw when the token is missing"
```

See [Agents](https://ouijit.com/docs/agents/) for the full agent review workflow.

## Merge

Open pull requests get a merge menu with **Merge**, **Squash**, and **Rebase**, plus a delete-branch toggle. Unmet requirements are listed; when GitHub grants you admin bypass, a separate **Merge without meeting requirements** entry maps to `gh pr merge --admin`.

## Connect pull requests and tasks

Ouijit links a task to the pull request on its branch automatically, so a PR the agent opened mid-session still shows up on the card. The other direction works too:

-   **Check out as task** creates a task with a worktree at the pull request's head, with the PR body as its prompt and the PR's base branch as its merge target.
-   **Create pull request** on a task card pushes the branch and runs `gh pr create`, so your repository's PR template applies.
-   A task created from an issue links back, and its pull request closes the issue.
