|
| 1 | +--- |
| 2 | +description: List Claude-authored PRs that haven't failed (ready or still running) with their actual check state |
| 3 | +--- |
| 4 | + |
| 5 | +List open PRs authored by Claude (branches starting with `claude/`) that have **not** had any check fail. Show each PR's actual state (READY when all checks finished green, RUNNING when sweeps are still queued/in-progress) along with a per-status check breakdown. |
| 6 | + |
| 7 | +## Step 1 — list candidate `claude/*` PRs |
| 8 | + |
| 9 | +`gh pr list --json statusCheckRollup` truncates each PR's rollup, so it can't be trusted for the per-check filter. Use it only to get the candidate numbers, then re-query each PR individually. |
| 10 | + |
| 11 | +```bash |
| 12 | +gh pr list --repo SemiAnalysisAI/InferenceX --state open --limit 200 \ |
| 13 | + --json number,title,headRefName \ |
| 14 | + --jq '.[] | select(.headRefName | startswith("claude/")) | "\(.number)\t\(.title)"' \ |
| 15 | + > /tmp/claude_pr_candidates.tsv |
| 16 | +``` |
| 17 | + |
| 18 | +## Step 2 — per-PR state classification |
| 19 | + |
| 20 | +For each candidate, fetch the full rollup with `gh pr view`. Compute each check's effective state as `if (.conclusion // "") != "" then .conclusion else .status end` — `gh` returns `conclusion: ""` for in-flight checks, so jq's `//` does not fall through to `.status`. |
| 21 | + |
| 22 | +Classify the PR as: |
| 23 | +- **FAILED** — any check is `FAILURE`, `CANCELLED`, or `TIMED_OUT`. Skip these. |
| 24 | +- **RUNNING** — no failed checks, but at least one check is `QUEUED`, `IN_PROGRESS`, or `PENDING`. |
| 25 | +- **READY** — no failed checks, no pending checks, and at least one `Run Sweep` check is `SUCCESS` (sweep actually ran — not all skipped). |
| 26 | +- **NO_SWEEP** — no failed, no pending, but the sweep never produced a `SUCCESS` (all skipped or never ran). Skip these. |
| 27 | + |
| 28 | +```bash |
| 29 | +: > /tmp/claude_pr_status.tsv |
| 30 | +while IFS=$'\t' read -r pr title; do |
| 31 | + rollup=$(gh pr view "$pr" --repo SemiAnalysisAI/InferenceX --json statusCheckRollup) |
| 32 | + classification=$(printf '%s' "$rollup" | jq -r ' |
| 33 | + def state: if (.conclusion // "") != "" then .conclusion else .status end; |
| 34 | + . as $p |
| 35 | + | ([$p.statusCheckRollup[] | state]) as $s |
| 36 | + | ($s | any(. == "FAILURE" or . == "CANCELLED" or . == "TIMED_OUT")) as $failed |
| 37 | + | ($s | any(. == "QUEUED" or . == "IN_PROGRESS" or . == "PENDING")) as $pending |
| 38 | + | ([$p.statusCheckRollup[] | select(.workflowName == "Run Sweep" and (state) == "SUCCESS")] | length > 0) as $swept |
| 39 | + | if $failed then "FAILED" |
| 40 | + elif $pending then "RUNNING" |
| 41 | + elif $swept then "READY" |
| 42 | + else "NO_SWEEP" end') |
| 43 | + if [ "$classification" = "READY" ] || [ "$classification" = "RUNNING" ]; then |
| 44 | + breakdown=$(printf '%s' "$rollup" | jq -r ' |
| 45 | + def state: if (.conclusion // "") != "" then .conclusion else .status end; |
| 46 | + [.statusCheckRollup[] | state] | group_by(.) | map("\(.[0])=\(length)") | join(" ")') |
| 47 | + printf '%s\t%s\t%s\t%s\n' "$pr" "$classification" "$breakdown" "$title" >> /tmp/claude_pr_status.tsv |
| 48 | + fi |
| 49 | +done < /tmp/claude_pr_candidates.tsv |
| 50 | +``` |
| 51 | + |
| 52 | +## Step 3 — present the result |
| 53 | + |
| 54 | +Sort READY first, then RUNNING. Render a markdown table with columns: |
| 55 | + |
| 56 | +| PR | State | Check breakdown | Title | |
| 57 | +|---|---|---|---| |
| 58 | + |
| 59 | +Each PR cell should be a markdown link to `https://github.com/SemiAnalysisAI/InferenceX/pull/<number>`. The check breakdown column should show the per-state counts (e.g. `SUCCESS=44 SKIPPED=7 NEUTRAL=1` or `SUCCESS=9 QUEUED=34 IN_PROGRESS=14 SKIPPED=6 NEUTRAL=1`). |
| 60 | + |
| 61 | +Do **not** auto-merge. This command is informational only. |
0 commit comments