Skip to content

feat: one CI-verdict script for every merge path (M4.6, #628) - #629

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/ci-verdict
Nov 14, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/ci-verdict

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Programme M4.6, part 1. Closes #628. The re-check is on the issue: FB-4 partly holds; FB-5, REL-6 and FLOW-3 hold.

pyauto-brain ci-verdict <owner/repo>#<n> judges every check-run, workflow run and job, and every commit status, for the PR's REST head sha. Exit codes:

  • 0 GREEN: at least one completed check, all of them success or a named skip, and mergeable clean.
  • 2 PENDING: anything incomplete, or mergeability unknown after one re-read.
  • 1 RED: a failure, cancellation or timeout; zero or skipped-only checks; conflicting, behind, draft, closed, or blocked; an empty sha; unreadable gh output.

/prm step 2 and the watcher close-out template now run it, and pr_health delegates its judgement to it. pr_health keeps its single gh pr checks read, so the watcher's network surface is unchanged.

Test plan

  • 37 new tests, offline with a fake gh.
  • Brain suite: 1971 passed. The known environmental failures remain.
  • Skill line counts OK. Tenant firewall OK.
  • Live read-only runs: Brain#626 GREEN, Mind#567 GREEN with the skipped leg named, Heart#345 GREEN, fork PR Array#675 GREEN, Galaxy#697 RED.
  • Independent review: CLEAN. It found no false GREEN across re-run attempts, a fork PR, a failed run with zero jobs, and commit statuses.

Tier: glance. Merge mode: auto-merge on green with the Witness passed (Heart dev-ship gate).

🤖 Generated with Claude Code

Jammy2211 and others added 2 commits November 13, 2026 21:15
`pyauto-brain ci-verdict <owner/repo>#<n> [--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 <noreply@anthropic.com>
`test_a_full_brief_run_spawns_only_heart_readiness_and_git` dated its fake
local readiness at a fixed NOW (2026-11-13 20:00Z) minus 0.5 h, but ran
`brief --new` on the wall clock. From 2026-11-14 01:30Z the snapshot read
over the 6 h age rule, so `read_heart` correctly fell through to the
published feed and the urlopen guard fired, on main 4ae2c42 too. Pass
`--at NOW` like the file's other brief runs; the assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 7e2d16f into main Nov 14, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/ci-verdict branch November 14, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: one CI-verdict script for every merge path (M4.6, re-check first)

1 participant