PR Watch
Overview
Poll GitHub PR review status. Auto-fix review comments (Critical/Major/Minor by default) using
pr-review-dev. Exit when PR reaches a terminal state: approved, changes_requested_fixed
(all blocking issues resolved), timeout, or capped (max fix cycles reached).
Announce at start: "I'm using the pr-watch skill to monitor reviews for PR #{pr_number}."
Implements: OMN-2524
Quick Start
/pr-watch 123 org/repo
/pr-watch 123 org/repo --timeout-hours 48
/pr-watch 123 org/repo --max-review-cycles 5
/pr-watch 123 org/repo --fix-nits
/pr-watch 123 org/repo --no-auto-fix
Poll Loop
- Fetch PR review state via
gh pr view {pr_number} --repo {repo} --json reviews,reviewDecision - If
reviewDecision == APPROVED: exit withstatus: approved - If
reviewDecision == CHANGES_REQUESTEDandauto_fix=trueand cycles remaining:- Dispatch pr-review-dev agent with review comments
- Increment fix cycle count
- Wait for CI (delegate to ci-watch if needed), then re-request review
- If fix cycles exhausted: exit with
status: capped - If elapsed > timeout_hours: exit with
status: timeout - If all blocking issues resolved but no explicit approval: exit with
status: changes_requested_fixed
Fix Dispatch Contract
Task(
subagent_type="onex:polymorphic-agent",
description="pr-watch: fix review comments for PR #{pr_number} (cycle {N})",
prompt="Invoke: Skill(skill=\"pr-review-dev\", args=\"{pr_number}\")
Review comments:
{review_comments}
Fix all Critical, Major, and Minor issues.{nit_instruction}
Push fixes to branch: {branch_name}
Report: issues fixed, files changed, any issues skipped."
)
Skill Result Output
Write ModelSkillResult to ~/.claude/skill-results/{context_id}/pr-watch.json on exit.
{
"skill": "pr-watch",
"status": "approved",
"pr_number": 123,
"repo": "org/repo",
"fix_cycles_used": 2,
"elapsed_hours": 3.5,
"context_id": "{context_id}"
}
Status values: approved | changes_requested_fixed | timeout | capped | error
Push-Based Notification Support (OMN-2826)
pr-watch supports two notification modes, selected automatically based on infrastructure availability. The push-based mode eliminates polling for CI status checks during the review cycle.
EVENT_BUS+ Mode (preferred)
When Kafka and Valkey are available (ENABLE_REAL_TIME_EVENTS=true):
- Register watch: agent registers interest in
(repo, pr_number)via Valkey watch registry - Wait for inbox: block until a
pr-statusevent arrives in the agent's inbox topic (onex.evt.omniclaude.agent-inbox.{agent_id}.v1) - Process result: on CI completion after a fix cycle, check review status and decide next step
from omniclaude.services.inbox_wait import register_watch, wait_for_pr_status
# Register watch for CI re-runs after pushing fixes
await register_watch(agent_id=agent_id, repo=repo, pr_number=pr_number)
# After pushing a fix, wait for CI to complete (replaces polling)
ci_result = wait_for_pr_status(
repo=repo,
pr_number=pr_number,
run_id=latest_run_id,
agent_id=agent_id,
timeout_seconds=3600,
)
STANDALONE Mode (fallback)
When Kafka/Valkey are unavailable:
- Spawn
gh run watch {run_id} --exit-statusas background process after pushing fixes - Wait for result in file-based inbox (
~/.claude/pr-inbox/)
from omniclaude.services.inbox_wait import wait_for_pr_status
# Unified interface -- automatically falls back to STANDALONE
ci_result = wait_for_pr_status(
repo=repo,
pr_number=pr_number,
run_id=latest_run_id,
timeout_seconds=3600,
)
Migration Notes
The original review polling loop is unchanged. The inbox-wait pattern replaces only the
CI status checks that happen between fix cycles (when pr-watch pushes a fix and needs
to wait for CI before re-requesting review). The wait_for_pr_status() function provides
a unified interface that works in both EVENT_BUS and STANDALONE modes.
See Also
ticket-pipelineskill (planned: invokes pr-watch after ci-watch passes)ci-watchskill (planned: runs before pr-watch)auto-mergeskill (planned: runs after pr-watch passes)pr-review-devskill (invoked to fix review comments)inbox_waitmodule (omniclaude.services.inbox_wait) — unified wait interfacenode_github_pr_watcher_effect— ONEX node for EVENT_BUS+ mode routing- OMN-2524 — pr-watch implementation ticket
- OMN-2826 — push-based notifications ticket
Scan to join WeChat group