From 9ddd9f3e9695dbbfd335d8a30498951532d5140c Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Fri, 13 Nov 2026 21:15:40 +0000 Subject: [PATCH 1/2] feat(prm,batch): one CI-verdict script for every merge path (#628) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `pyauto-brain ci-verdict # [--json]` (bin/ci_verdict.py) is the one CI judgement. It takes the REST head sha (an empty sha is refused before any run query), reads every check-run, commit status, workflow run and job on it (paginated) and the PR's mergeability, and prints GREEN, PENDING or RED with reasons (exit 0 / 2 / 1). - GREEN: at least one completed check, every completed check success (or a named skip/neutral), mergeable_state clean. - PENDING: a check or run not completed; mergeability not computed yet (re-read once); unstable while every check read has completed. - RED: failed / cancelled / timed-out / unrecognised conclusion; zero checks or only skipped ones; conflicting, behind, draft, closed unmerged; blocked or another non-clean state once every check has completed; unreadable gh. The three merge paths now use it: - /prm step 2 runs `ci-verdict` and obeys it (reference.md and mcp.md point at it; the hand recipe stays for surfaces where it cannot run); - the shift close-out template gains step 4, `{ci_verdict_cmd}`, for every repo — only GREEN passes; - the watcher's pr_health keeps its `gh pr checks` read (its approved network surface) and delegates the judgement to `ci_verdict.judge`; its words and tests are unchanged. Tests (offline, fake gh): all green, one red leg, cancelled/timed out, skipped-only, zero checks, pending, queued run with no jobs, startup_failure, empty head sha refused, behind/conflicting/blocked/draft, mergeability retry, merged and closed PRs, third-party check-runs and commit statuses, pagination, CLI exit codes and the dispatcher. Co-Authored-By: Claude Opus 5.5 --- agents/conductors/batch/AGENTS.md | 3 +- agents/conductors/batch/_digest.py | 54 +-- agents/conductors/batch/_orchestrator.py | 7 +- agents/conductors/batch/closeout_template.md | 23 +- bin/README.md | 6 + bin/ci_verdict.py | 354 +++++++++++++++++++ bin/pyauto-brain | 10 + skills/prm/mcp.md | 2 +- skills/prm/prm.md | 50 ++- skills/prm/reference.md | 5 + tests/test_ci_verdict.py | 280 +++++++++++++++ 11 files changed, 744 insertions(+), 50 deletions(-) create mode 100644 bin/ci_verdict.py create mode 100644 tests/test_ci_verdict.py diff --git a/agents/conductors/batch/AGENTS.md b/agents/conductors/batch/AGENTS.md index ac68808e..67eab6ee 100644 --- a/agents/conductors/batch/AGENTS.md +++ b/agents/conductors/batch/AGENTS.md @@ -348,7 +348,8 @@ counts the PRs GitHub shows merged by `review-at:`, whoever merged them, and `workers-crashed` counts exit records, not a tally. A `### Workers` section prints one line per worker (`