Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5d23555
dash: kill and setsid in one module; config keys max_jobs, notify, model
catalan-adobe Dec 1, 2026
87560af
dash: jobs and their files: states from the exit file, the queue, toa…
catalan-adobe Dec 1, 2026
a9b0e05
dash: r and p run jobs: the loop check, a confirm dialog, the queue, …
catalan-adobe Dec 1, 2026
95bc30c
dash: the Jobs view, the log, dialogs and toasts on screen; job count…
catalan-adobe Dec 1, 2026
a062dc8
dash/README: jobs, their keys and files, dash.max_jobs, dash.notify, …
catalan-adobe Dec 1, 2026
450dea8
dash: a round's toast names the round its job posted: the one posted …
catalan-adobe Dec 1, 2026
d6f2331
dash: the dialog names the account a round posts as, on the PR's host…
catalan-adobe Dec 1, 2026
2c75d7f
dash: a jobs worker owns the jobs folder and the jobs' processes; the…
catalan-adobe Dec 1, 2026
c72fa10
dash: no signal to a job's group unless its leader is still the job's…
catalan-adobe Dec 1, 2026
6d7b334
dash: a job's command runs only once its record is saved: the wrapper…
catalan-adobe Dec 1, 2026
db78394
dash: a quit finishes the stops under way; a stop found at start goes on
catalan-adobe Dec 1, 2026
0c700d1
dash: dashboards that share a jobs folder share dash.max_jobs and the…
catalan-adobe Dec 1, 2026
cd9826c
dash: K asks before it takes a job off the queue, and never stops one…
catalan-adobe Dec 1, 2026
c575a75
dash: toasts wait their turn, and a job's end is marked shown when it…
catalan-adobe Dec 1, 2026
b5d38b0
dash: long log lines wrap; the log scrolls by screen rows
catalan-adobe Dec 1, 2026
53d55b0
dash: a dialog's buttons always show; Start waits until the whole tex…
catalan-adobe Dec 1, 2026
2be7841
dash: c names the jobs it could not clear, and deletes a job's record…
catalan-adobe Dec 1, 2026
915aaf1
dash/README: the confirm and what r posts, the account, the jobs work…
catalan-adobe Dec 1, 2026
1253d10
Merge remote-tracking branch 'origin/main' into dash-d2a-jobs
catalan-adobe Dec 1, 2026
af53662
Merge remote-tracking branch 'origin/main' into dash-d2a-jobs
catalan-adobe Dec 1, 2026
249cc2c
Dashboard: K stops only the jobs this dashboard process started
catalan-adobe Dec 1, 2026
6232d44
Dashboard: no round under a login -u can't name
catalan-adobe Dec 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 102 additions & 11 deletions dash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ It is a thin client: it reads `gh pr-review status --json` and `gh pr-review sho
about reviews itself. The design is in
[docs/superpowers/specs/2026-11-26-review-dashboard-design.md](../docs/superpowers/specs/2026-11-26-review-dashboard-design.md).

This is phase D1: read-only. Running rounds, asking an agent, jobs and the shepherd inbox come in D2 and D3.
This is phase D2a: on top of D1's read-only screens, `r` runs a review round and `p` previews one, as background
jobs, with a Jobs view, each job's log and a toast when one ends. Asking an agent, the worktree, the delta and the
other actions on a PR come next; the shepherd inbox in D3. It runs on Unix (macOS, Linux).

## Install

Expand Down Expand Up @@ -65,6 +67,7 @@ gh-pr-review-dash [--fixtures <dir>] [--ascii] [--theme auto|dark|light]
| `GH_PR_REVIEW_BIN` | The CLI to run. Default `gh pr-review` (`gh pr-review dash` sets the script's path). A path to the script, or a command line |
| `NO_COLOR` | No colors. Symbols, bold and dim still carry the meaning |
| `XDG_CONFIG_HOME` | Where the config lives (below) |
| `GH_PR_REVIEW_STATE`, `XDG_STATE_HOME` | The CLI's state folder, whose `jobs/` holds the jobs' files, read as the CLI reads them |

On start it paints `status --json --cached` at once (the last run's result; nothing when there is none yet), then runs
`status --json` in the background. It refreshes again every `dash.refresh_minutes` and on `R`. A PR's detail comes from
Expand All @@ -78,21 +81,83 @@ process it started. A `status` run that exits 1 because an account failed still
with the account marked `✗`. A file with another `"schema"` major version is refused with a message that names both
versions.

## Jobs

`r` runs a round on the selected PR, `p` a preview (`--no-post`). Each first runs the loop check,
`gh pr-review <PR> --check --json` (as the PR's account, 90 s at most), and shows what it says in a dialog with the
PR, the account and the exact command:

- **run** (or **warn**, with its reason): Start or Cancel.
- **stop** (exit 3): the diagnosis (label, blocking series, reason, suggested move) and Run anyway
(`--force-round`) or Cancel, Cancel selected. Asking an agent instead comes with `a`, in a later version.
- **nothing new** (exit 5): no new commits since the last round; Run anyway (`--force-round`) or Cancel.
- A check that fails shows its error.

`enter` takes the selected button, `tab` moves, `y` takes the first, `esc` or `n` cancels.

A job is one command: `gh pr-review <PR-URL> -y [-u <login>] [--model <id>] [--no-post] [--force-round]`. `-y`
makes a loop-check stop exit 3 instead of asking. It runs as the account that listed the PR (without `-u` when gh
stores no login for it, as for `show`), with the CLI's model unless `dash.model` sets one. At most `dash.max_jobs` run
at once; more wait in a queue, first in first out. A PR has one job at a time: `r` or `p` on a PR whose job is queued
or running says so.

**The inline launcher.** A job runs in a session of its own (`setsid`), with stdin from `/dev/null`, so it outlives
the dashboard and its terminal. Its files are in `<state>/jobs/`, where `<state>` is the CLI's state folder
(`gh pr-review --doctor` prints it: `$GH_PR_REVIEW_STATE`, else `$XDG_STATE_HOME/gh-pr-review`, else
`~/.local/state/gh-pr-review`). The folder is 0700, the files 0600:

| File | Holds |
| --- | --- |
| `<id>.json` | the record, written whole (a temporary file renamed): `id`, `kind` (`round` or `preview`), `pr` (the key), `url`, `account`, `argv` (the exact command), `started_at` (Unix seconds), `pid` and `pgid` (the job's session and group leader), `stop_requested`, `notified` (its end was shown) |
| `<id>.log` | stdout and stderr |
| `<id>.exit` | the exit code, written by a small `sh` wrapper when the command ends (through a temporary file and `mv`) |

**Its end.** The dashboard reads the files on its tick. An `.exit` file ends the job; a job whose process is gone
without one is lost (its wrapper was killed, or the machine restarted). Then it refreshes the status (and so the PR's
detail) and shows a toast above the footer for a few seconds:

| Exit | State | Toast |
| --- | --- | --- |
| 0 | done | `Round 3 posted · #823 · blocking 5 (was 6) · converging`, from the status read after the round (a preview: `Preview of #823 done · see the log`) |
| 3 | stopped by the loop check | `Loop check stopped #813 · churning · see the diagnosis` |
| 5 | nothing to review | `#823 · no new commits since round 2` |
| 6 | failed: rounds changed | `#823 · the rounds changed while it ran · see the log` |
| 1, 4, other | failed (exit N) | `Review of #823 failed · see the log` |
| | stopped (`K`) | `Stopped the round of #823` |
| | lost | `Lost the round of #823: it ended without an exit code · see the log` |

`dash.notify` adds the terminal bell (`bell`) or a desktop notification through OSC 9 (`desktop`) to the toast.

**Progress.** The header counts the running and queued jobs, a PR's row is marked `⟳` while its job runs (`◌`
queued), and the detail's Overview has a Job line: the job, how long it has run, and its log's last line.

**The Jobs view** (`J`) lists running, queued and finished jobs: kind, PR, start, duration, state, and the log's last
line. `enter` opens a job's log full screen, following its end while it runs (`F` follow on or off, `G` the end,
`j`/`k` scroll). `K` stops a running job, after a confirm: its process group gets SIGTERM, then SIGKILL; the wrapper
outlives the SIGTERM to record how the command ended. On a queued job, `K` takes it off the queue. `c` clears the
finished jobs and deletes their files.

**Quitting** with jobs running asks first, then leaves them running; queued jobs do not start. The next start reads
the jobs folder: a job that ended meanwhile shows its toast then (once: its record keeps `notified`), a running one
is followed, one whose process is gone without an exit code is lost.

With `--fixtures` there are no jobs.

## Screen

- **Header:** accounts (a red `✗` on one that failed), when the data was generated, a refresh in progress, the count
per group, and the filter.
- **Header:** accounts (a red `✗` on one that failed), when the data was generated, the running and queued jobs, a
refresh in progress, the count per group, and the filter.
- **List:** groups Your turn, Waiting on author, Ready to merge, Others, by the PR's turn; a superseded PR is in
Others whatever its turn, as `status` lists it. Inside a group: Churning, Nit loop, Converging, Early, Unknown,
Ready, New, In review, then superseded PRs (whatever their own label), stale ones and the rest, most recently
updated first. A row: label symbol and name, `repo#N`, rounds, a sparkline of blocking findings per round (a gap for
a Rethink round, `?` for an unknown count; green when the last value is lower than the first, red when not), flags
(`⚑big,stuck`), `→ #N` for a superseded PR, and the title. Superseded and stale rows are dim.
(`⚑big,stuck`), `⟳` while a job runs on it (`◌` queued), `→ #N` for a superseded PR, and the title. Superseded and stale rows are dim.
- **Detail tabs:** 1 Overview, 2 Rounds (date, commit, commits since (`?` when unknown), approach, ready, counts, the
round's loop label, mode, source; Enter shows the round's facts and review), 3 Findings (the last code review's:
Open, New, Regressed, Later, Fixed, Declined; a dropped list says so), 4 Threads (open, outdated, then resolved
folded), 5 Shepherd (the pending count).
- **Footer:** the keys, and on the right the review worktrees `gh pr-review gc` would clean up (`gc: 3 worktrees`;
- **Footer:** the keys (as many as fit), and on the right the review worktrees `gh pr-review gc` would clean up (`gc: 3 worktrees`;
`?` when `status` could not tell; nothing when there are none), when there is room.
- **Layout:** 140 columns or more: list and detail side by side. 100 to 139: detail below the list. Less than 100
columns or 24 rows: the list only; Enter opens the detail full screen and `esc` goes back.
Expand Down Expand Up @@ -129,19 +194,36 @@ versions.
| `:` | Command palette |
| `?` | Help |
| `R` | Refresh now |
| `q` | Quit |
| `r` | Run a round on the selected PR: the loop check, then a confirm dialog (see [Jobs](#jobs)) |
| `p` | Preview a round (`--no-post`): the same |
| `J` | The Jobs view (again, or `esc`: back) |
| `q` | Quit (asks when jobs run: they keep running) |

In the Jobs view and a job's log:

| Key | Does |
| --- | --- |
| `j` `k` `gg` `G` `ctrl+d` `ctrl+u` | Move (in the log: scroll; `G` the end) |
| `enter` | The job's log, full screen |
| `F` | Follow the log on or off |
| `K` | Stop the running job (after a confirm), or take a queued one off the queue |
| `c` | Clear the finished jobs and their files |
| `esc` | Back |

`ctrl+b`, `ctrl+a` and `ctrl+space` are never bound: they are the usual multiplexer prefixes.

## Config

The dashboard reads the `dash` section of `${XDG_CONFIG_HOME:-~/.config}/gh-pr-review/config.json`. The file is
optional and every key has a default. Keys for later phases (`max_jobs`, `agent`, `launcher`, `notify`) are ignored.
optional and every key has a default. Keys for later phases (`agent`, `launcher`) are ignored.

```json
{
"dash": {
"refresh_minutes": 5,
"max_jobs": 3,
"notify": "toast",
"model": "github-copilot/claude-sonnet-5",
"theme": { "mode": "auto", "accent": "cyan" },
"keys": { "move_down": ["j", "down", "n"], "refresh": "ctrl+r" }
}
Expand All @@ -151,6 +233,9 @@ optional and every key has a default. Keys for later phases (`max_jobs`, `agent`
| Key | Default | Does |
| --- | --- | --- |
| `refresh_minutes` | `5` | Minutes between background refreshes |
| `max_jobs` | `3` | Jobs running at once; more wait in a queue |
| `notify` | `toast` | A job's end: `toast` only, `bell` (the terminal bell too) or `desktop` (an OSC 9 desktop notification too, for terminals that support it) |
| `model` | — | `--model` for jobs. Unset: the CLI's default (`GH_PR_REVIEW_MODEL`, else its own) |
| `theme.mode` | `auto` | `dark`, `light`, or `auto` (`COLORFGBG`, else dark) |
| `theme.accent` | `cyan` | A color name, `#rrggbb`, or a 256-color index |
| `keys` | — | Action name → key or list of keys. An entry replaces the action's default keys; a key taken from another action moves |
Expand All @@ -160,10 +245,10 @@ Key syntax: `j`, `G`, `ctrl+d`, `alt+x`, `shift+tab`, `enter`, `esc`, `space`, `

Action names: `move_down`, `move_up`, `first`, `last`, `half_page_down`, `half_page_up`, `prev_group`,
`next_group`, `focus_next`, `focus_prev`, `tab_overview`, `tab_rounds`, `tab_findings`, `tab_threads`,
`tab_shepherd`, `prev_tab`, `next_tab`, `open`, `back`, `filter`, `palette`, `help`, `refresh`, `quit`. The names of
later actions (`run_round`, `preview`, `ask_agent`, `worktree`, `delta`, `edit_finding`, `shepherd`, `open_browser`,
`copy_url`, `mute`, `jobs`, `stop_job`, `inbox`, `approve_draft`, `edit_draft`, `reject_draft`) are accepted and
ignored until their phase ships.
`tab_shepherd`, `prev_tab`, `next_tab`, `open`, `back`, `filter`, `palette`, `help`, `refresh`, `quit`, `run_round`,
`preview`, `jobs`, `stop_job`, `clear_jobs`, `follow_log`. The names of later actions (`ask_agent`, `worktree`,
`delta`, `edit_finding`, `shepherd`, `open_browser`, `copy_url`, `mute`, `inbox`, `approve_draft`, `edit_draft`,
`reject_draft`) are accepted and ignored until their phase ships.

## The JSON it reads

Expand Down Expand Up @@ -287,6 +372,12 @@ dashboard shows, that the labels the CLI prints are the ones the `label` row abo
objects have the keys the CLI prints. It needs bash, jq and the repo around `dash/`; without them `cargo test` skips it,
unless `GH_PR_REVIEW_DASH_CONTRACT=require`, as CI's dash job sets.

`tests/jobs.rs` runs jobs end to end through the real launcher, against `tests/fake-gh-pr-review.sh`: a fake CLI
that prints a status and a loop check, sleeps, writes a log and exits with the code a test chooses. It covers a
round's end (toast and refresh), `--force-round` after a stop, the queue and the one-job-per-PR rule, `K` (nothing of
the job's group is left), a job that outlives the dashboard (its toast shows once on the next start) and a lost job.
`tests/contract.rs` also checks that the dashboard finds the state folder by the CLI's rule (`lib/state.sh`).

Render tests draw the fixtures with Ratatui's `TestBackend` and compare them with the `insta` snapshots in
`tests/snapshots/`. After a deliberate change to the screen, update them with `INSTA_UPDATE=always cargo test` (or
`cargo insta review`) and read the diff.
Loading