mcpField

PR Babysitter

FeaturedScheduled
Continuous IntegrationUp to 20 rounds

About PR Babysitter

This loop checks open PRs labeled codex-watch at a fixed interval. Each round lists them with their mergeable state and check results, judges whether CI is green and whether a rebase or stale handling is needed, then fixes or escalates problem PRs. It runs at most 20 rounds.

Key features

  1. 01Reads PR number, title, mergeable state and check results via gh
  2. 02Triggered on an interval, with no manual restart each time
  3. 03PRs that cannot be fixed are escalated
  4. 04Supports Codex and Cursor

Use cases

  1. 01Several long-lived PRs need ongoing attention
  2. 02A team wants prompt notice of CI failures or lagging branches
  3. 03Confirming PR status ahead of a merge window
Goal
Every open PR labeled codex-watch is healthy: CI green, rebased and not stale.
Exit when
Stop when each watched PR is green and current, or has been escalated.
Between iterations run
gh pr list --label "codex-watch"

Launch prompt

Paste into Codex / Cursor. The agent repeats the steps below until the exit condition is met.

prompt.md
Start the "PR Babysitter" loop.
Goal: Every open PR labeled codex-watch is healthy: CI green, rebased and not stale.
Max iterations: 20.
Step 1: List watched PRs — Run gh pr list --label "codex-watch" --json number,title,mergeable,statusCheckRollup to get each PR's mergeable state and check results. `gh pr list --label "codex-watch" --json number,title,mergeable,statusCheckRollup`
Step 2: Assess each PR — Judge for every PR whether CI is green, whether it needs a rebase and whether it has gone stale.
Step 3: Fix or escalate — Handle PRs that can be repaired and escalate those that cannot. If all PRs are healthy or escalated the loop ends; otherwise it waits for the next round.
Between iterations run: `gh pr list --label "codex-watch"`
Exit when: Stop when each watched PR is green and current, or has been escalated.

Steps

Each round runs in order; if the exit condition isn’t met, another round starts, up to 20.

01
List watched PRs

Run gh pr list --label "codex-watch" --json number,title,mergeable,statusCheckRollup to get each PR's mergeable state and check results.

$gh pr list --label "codex-watch" --json number,title,mergeable,statusCheckRollup
02
Assess each PR

Judge for every PR whether CI is green, whether it needs a rebase and whether it has gone stale.

03
Fix or escalate

Handle PRs that can be repaired and escalate those that cannot. If all PRs are healthy or escalated the loop ends; otherwise it waits for the next round.

Not met → next roundExits when met

Supported agents

Coding agents that can run this loop directly.

Codex
Cursor

Comments

Markdown supported