PR Janitor (nightly cleanup of already-landed pull requests)
Every night the PR Janitor closes the pull requests whose work is **already safely on your main branch**, comments on each one to say why, and starts a session for a pull request stuck on a merge conflict. If it is not sure, it leaves the pull request alone.
What it is
A nightly housekeeping pass over your open GitHub pull requests. It:
- Closes the pull requests whose changes have already fully reached your main branch, commenting on each with a short explanation.
- Leaves open anything it is not sure about, rather than guessing.
- Starts a session for a pull request that is stuck on a merge conflict, so a human or an agent can resolve it.
- Never touches a pull request whose changes are not already safely landed.
The point is to clear the reviewing queue of work that is already in — so what is left in your open pull requests is genuinely open.
Where to find it
Turn the panel on first: Settings → Features → PR Merge Queue. Then open the PR Merge Queue view — the PR Janitor section sits at the top of it, above the list of pull requests.
How it behaves
- The six counts. After each run, six numbers summarise what happened — how many pull requests were closed, and so on across the run's verdicts. They are the run's own tally, not a live count of your open pull requests.
- Run history. Each run is recorded, so you can see what the Janitor did on any past night rather than only the most recent one.
- Pause / Resume. Pausing marks the Janitor as not scheduled and stops the nightly job itself, so nothing runs while it is paused. Resuming turns it back on.
- Dry run. Asks the engine what it would do without closing anything — a rehearsal, useful before trusting it with a busy repository.
- It is the panel that changes the queue; the Janitor records and acts on its own schedule. Reading the run history never closes a pull request on its own.
For agents
- Settings keys:
prMergeQueueEnabled(master gate for the whole panel) andprJanitorPaused(the Pause control's backing flag) —src/shared/types/settings/pr-merge-queue-settings.ts. - The engine's programs, its nightly procedure and the short cron pointer live in
scripts/pr-janitor/.
Related
- pr-merge-queue.md — the full PR Merge Queue view the Janitor sits inside.
Last verified 2026-10-10