clud-pr-merge
Wait for CI + CodeRabbit on the current PR, fix regressions and review comments, then merge to main.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Wait for CI + CodeRabbit on the current PR, fix regressions and review comments, then merge to main.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
File a deeply-researched GitHub issue via investigate → investigate → post, returning a summary plus the issue URL. Files without asking for confirmation.
Spin up a fast Linux build container for a Rust + soldr + zccache, Python (uv), or C++ (CMake + ccache) project using the bundled `docker-build` tool family. Uses anonymous Docker volumes for build state and a read-only bind for source — the one rule that turns Docker-Desktop's 20-minute cold-build into a sub-30-second warm cycle.
Diagnose and recover a wedged Docker Desktop (engine pipe/socket absent while the UI stays alive, WSL/Docker startup failures) and answer Docker VM disk-growth / memory-pressure questions. Read-only `doctor` first; every restart/reset is confirmation-gated and preserves images/volumes; storage disks are resolved from Docker Desktop's real config (never assumed) and never compacted or deleted automatically.
Coordinate dependent cross-repo changes under a repo-local .extern-repos/ checkout convention.
Show a git diff in a native OS webview window (Beyond Compare-style dual-pane with file picker on the left) via the bundled git/clud-git-diff.py tool. Invoke when the user asks to visually review changes between revisions.
Worktree, branch, process-audit, and quarantine playbook extracted from /clud-pr so /clud-fix-quick and other skills can reuse it. Use this when the user asks for worktree cleanup, stale-branch teardown, or a process audit on a leftover dir.
| name | clud-pr-merge |
| description | Wait for CI + CodeRabbit on the current PR, fix regressions and review comments, then merge to main. |
| triggers | ["When the user asks to merge a PR","When the user says \"/clud-pr-merge\", \"ship it\", \"land this PR\"","After /clud-pr completes and the user wants to follow through to merge"] |
Take an open PR from "tests running" to "merged into main". Two gates:
If the gates fail in fixable ways, dispatch a sub-agent to fix; up to 3 rounds total. After 3, give up and surface the blockers.
When the fix-loop modifies code to clear a regression or address a CodeRabbit comment, work the change RED -> GREEN: pin the failure with a focused test or repro first, make the smallest change that flips the signal, then run lint + the same focused test to confirm the green before pushing.
Resolve the PR. gh pr view --json number,headRefName,baseRefName,state,mergeable,statusCheckRollup,url against the current branch. Refuse if state ≠ OPEN or mergeable ≠ MERGEABLE/UNKNOWN.
Estimate the wait, announce it, then delegate the poll to pr_merge_watch. The whole inline poll loop — PR-state probe, checks probe, CodeRabbit-review probe, cap, cancel-on-fail bookkeeping, all the early-exit edge cases — is encapsulated in the bundled pr_merge_watch.py tool. Don't reimplement it inline; call the tool.
gh run list --repo <owner/repo> --branch main --limit 10 --json conclusion,startedAt,updatedAt. Take the p90 wall-clock; round up to the nearest 5 min. This is your --timeout budget for the tool.max(15, p90 + 5min) for repos with faster CI; never go below 15 minutes.[clud-pr-merge] polling CI for up to <N> min via pr_merge_watch; slowest recent build was <P90> min.--timeout as <N>*60 seconds; everything else defaults are fine for the standard case:
clud tool run github/pr_merge_watch.py <PR#> --timeout <N*60>
The tool internally polls gh pr view, gh pr checks, and (when CodeRabbit has reviewed prior merged PRs in this repo) the coderabbitai[bot] review stream — handling all the gotchas listed below for you. Inspect the exit code:
0 — all required checks green AND PR mergeable. Proceed to step 6 (clean tree gate) then step 7 (merge).1 — at least one required check failed. Tool prints the failing check name + first error + a classifier label (e.g. "rustfmt drift", "clippy warning", "test failure") on stdout. Proceed to step 3 (regression diff) then step 5 (fix loop).2 — new CodeRabbit / human review activity. Proceed to step 4 (collect comments) then step 5 (fix loop).3 — PR was merged or closed out from under us. If MERGED, success (skip to step 7's post-merge confirmation). If CLOSED, abort with a user-facing message.4 — timeout. Give up: [clud-pr-merge] timed out waiting for CI/CodeRabbit after <N> minutes. Re-run when checks have reported. Do NOT merge.Why delegate. The tool encapsulates several edge cases that every inline poll re-discovers the hard way:
pr view --json state first each iteration and exits 3 the moment state ≠ OPEN. Without that, GitHub Actions jobs that don't cancel on merge keep "PENDING" forever and the poll hangs (issue: zackees/zccache ~20-min stalls on merged PRs).gh pr checks exit-code gotcha. gh pr checks returns non-zero whenever any check failed even with --json. The tool reads stdout regardless of $?; an inline poll has to remember this.If you need to background the wait (so the agent does other work in parallel), pass it through run_in_background: true and treat the task-notification's exit code the same way as a foreground invocation. The tool handles its own polling cadence (default 60 s) so no until/sleep wrapping is needed.
Diff CI failures vs main (with PR-only-workflow handling). For every failing check on the PR:
main's latest commit: gh api repos/{owner}/{repo}/commits/main/check-runs.pull_request_target or pull_request event triggers don't run on push to main). Classify by sampling recent PRs: gh pr list --state all --limit 10 --json number then gh pr checks <n> for each. If the same check fails on every recent PR, treat as pre-existing infrastructure failure and skip. If failures are sporadic, treat as inconclusive and surface to the user for judgment — do NOT silently merge.Collect CodeRabbit findings. gh api repos/{owner}/{repo}/pulls/{num}/comments filtered to user.login == "coderabbitai[bot]". Also pull review-level comments. Resolved threads are skipped.
Round-based fix loop, max 3 rounds. For each round:
bash lint + bash test, commit, push.clud tool run github/pr_merge_watch.py <PR#> --timeout <N*60> call as step 2. Interpret the exit code the same way.Clean tree gate. Same as /clud-pr: every modified/untracked file gets a deliberate commit-or-delete decision. No stash-and-merge tricks.
Merge. gh pr merge <num> --squash --delete-branch (or --merge if the repo prefers full history — check repo conventions first). Confirm with gh pr view <num> --json state,mergedAt.
"Already merged" is success. If gh pr merge returns pull request <num> was already merged, treat it as success (a maintainer merged it while we were polling). Skip straight to the post-merge confirmation.
--admin. If the PR is blocked by a required reviewer, surface that and stop.--no-verify on the fix-loop commits. Hooks exist for a reason.The tool (pr_merge_watch.py) handles the polling-specific failure modes — PR-state early-exit, CodeRabbit-absent deadlock, gh pr checks exit-code quirk, cancel-on-exit, cap enforcement. They're listed in the tool's docstring + repo issues #194/#195. The failure modes that remain the skill's responsibility:
[clud-pr-merge] polling CI for up to <N> min ... announcement so a foreground invocation doesn't look hung.until ... sleep loop with gh pr view/gh pr checks/gh api calls. The tool exists exactly because every inline attempt rediscovers the same edge cases. If the tool's behavior is wrong for your case, fix the tool, don't fork it.pull_request_target) never run on push events, so they're invisible in main's check-runs. Cross-reference recent PRs before classifying.