mcpField

PR Watch Loop

FeaturedScheduled

About PR Watch Loop

This loop runs at a fixed interval. Each round uses gh to list PRs labelled codex-watch together with their status check results. The agent finds PRs that are blocked or failing, deals with what it can, and produces a status report for every watched PR.

Key features

  1. 01Triggered automatically on an interval
  2. 02Reads PR number, title, state and check rollup
  3. 03Limited to PRs labelled codex-watch
  4. 04Works with Codex and Cursor

Use cases

  1. 01Keeping an eye on CI for a set of priority PRs
  2. 02Catching PRs blocked by failing checks early
  3. 03Giving the team regular updates on PRs in review
Goal
PRs labelled codex-watch stay healthy and unblocked.
Exit when
Stop when a status report has been delivered for every watched PR.
Between iterations run
gh pr list --label codex-watch --json number,title,state,statusCheckRollup

Launch prompt

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

prompt.md
Start the "PR Watch Loop" loop.
Goal: PRs labelled codex-watch stay healthy and unblocked.
Step 1: List watched PRs — Run gh pr list to fetch the number, title, state and check rollup of each PR labelled codex-watch. `gh pr list --label codex-watch --json number,title,state,statusCheckRollup`
Step 2: Assess health — Use statusCheckRollup and the PR state to separate passing, failing and pending PRs and spot the blocked ones.
Step 3: Handle blockers — Work on problems the agent can resolve; for those it cannot, note the reason for the report.
Step 4: Write the status report — Record the current state and outstanding items for each watched PR, and confirm none was skipped.
Between iterations run: `gh pr list --label codex-watch --json number,title,state,statusCheckRollup`
Exit when: Stop when a status report has been delivered for every watched PR.

Steps

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

01
List watched PRs

Run gh pr list to fetch the number, title, state and check rollup of each PR labelled codex-watch.

$gh pr list --label codex-watch --json number,title,state,statusCheckRollup
02
Assess health

Use statusCheckRollup and the PR state to separate passing, failing and pending PRs and spot the blocked ones.

03
Handle blockers

Work on problems the agent can resolve; for those it cannot, note the reason for the report.

04
Write the status report

Record the current state and outstanding items for each watched PR, and confirm none was skipped.

Not met → next roundExits when met

Supported agents

Coding agents that can run this loop directly.

Codex
Cursor

Comments

Markdown supported