|
| 1 | +# Review queue tracking |
| 2 | + |
| 3 | +Triagebot supports more advanced tracking of reviewers' workload in the `rust-lang` repository. It tracks how many "relevant" pull requests are assigned to each reviewer, and allows reviewers to configure maximum capacity of such PRs, and also if they want to be automatically assigned or not. |
| 4 | + |
| 5 | +This pages describes how the review queue works and how you can interact with `triagebot` on Zulip to configure and examine the review queue. |
| 6 | + |
| 7 | +## Configuration |
| 8 | + |
| 9 | +To enable review queue tracking for a repository, include `[pr-tracking]` table in its `triagebot.toml`. |
| 10 | + |
| 11 | +To take the review queue into account when assigning reviewers on PRs, add a `[assign.review_prefs]` table to `triagebot.toml`. |
| 12 | + |
| 13 | +> Note that this functionality currently only works only for the `rust-lang/rust` repository (it is hardcoded in `triagebot`). Enabling it for more repositories requires additional design and implementation work. |
| 14 | +
|
| 15 | +## Review queue design |
| 16 | + |
| 17 | +The review queue remembers how many "relevant" `rust-lang/rust` PRs are assigned to each reviewer at any given point in time. |
| 18 | +Currently, the heuristic for what makes a PR "relevant" works as follows: |
| 19 | +- The PR must not be blocked (it must not have the `S-blocked` or `S-inactive` labels). |
| 20 | +- The PR must not be a rollup. |
| 21 | +- The PR must be waiting for a reviewer (must have the `S-waiting-on-review` label). |
| 22 | +- The PR must be assigned to someone else than the PR author. |
| 23 | +- The PR must be open and not a draft. |
| 24 | + |
| 25 | +If a PR passes all these checks and it is assigned to reviewer `R`, it will be considered to be in `R`'s review queue. |
| 26 | + |
| 27 | +See the implementation of the [`waits_for_a_review`](https://github.com/rust-lang/triagebot/blob/HEAD/src/handlers/pr_tracking.rs#L289) function in triagebot for more details. |
| 28 | + |
| 29 | +## Review preferences |
| 30 | + |
| 31 | +Reviewers can configure *review preferences* that are taken into account when determining who to assign on a PR: |
| 32 | +- Review queue capacity (`C`) --- if the number of PRs in your review queue is at (or above) `C`, `triagebot` will not assign new pull requests to you. It will also not be possible to `r?` you. |
| 33 | +- Rotation mode (`on` or `off` rotation) --- if you set your rotation mode to be `off`, `triagebot` will not assign new pull requests to you. It will also not be possible to `r?` you. |
| 34 | + - This is an alternative to setting yourself as being ["on vacation"](pr-assignment.md#vacation) which does not require sending a pull request to modify the `triagebot.toml` file. `triagebot` takes both `users_on_vacation` in `triagebot.toml` and the rotation mode into account; if you are marked as being on vacation in either of them, it will not assign PRs to you. |
| 35 | + |
| 36 | +## Usage |
| 37 | + |
| 38 | +You can examine your review queue and configure your review preferences by sending a DM (Direct Message) to the `triagebot` bot account on the [Zulip chat](../platforms/zulip.md). You can open a DM session with the `triagebot` bot by clicking on [this link](https://rust-lang.zulipchat.com/#narrow/dm/261224-triagebot) (requires Zulip login). |
| 39 | + |
| 40 | +You can send a message with one of these commands to `triagebot`: |
| 41 | + |
| 42 | +- `work help` --- Show the available commands. |
| 43 | +- `work show` --- Show the contents of your review queue (in the `rust-lang/rust` repository) and your review preferences. |
| 44 | +- `work set-pr-limit <number>|unlimited` --- Set your review capacity to `<number>` or remove the capacity limit (`unlimited`). |
| 45 | +- `work set-rotation-mode off|on` --- Set your rotation mode to be `on` or `off`. |
| 46 | + |
| 47 | +## Implementation |
| 48 | + |
| 49 | +See [`src/handlers/pr_tracking.rs`](https://github.com/rust-lang/triagebot/blob/HEAD/src/handlers/pr_tracking.rs). |
0 commit comments