PR Babysitter
FeaturedScheduledAbout 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
- 01Reads PR number, title, mergeable state and check results via gh
- 02Triggered on an interval, with no manual restart each time
- 03PRs that cannot be fixed are escalated
- 04Supports Codex and Cursor
Use cases
- 01Several long-lived PRs need ongoing attention
- 02A team wants prompt notice of CI failures or lagging branches
- 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.
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.
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,statusCheckRollupJudge for every PR whether CI is green, whether it needs a rebase and whether it has gone stale.
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.
Supported agents
Coding agents that can run this loop directly.