Repository navigation
fix(loop): the merge gate reads commit statuses, which are not where our CI reports - #28
Merged
Merged
Conversation
Rung 1 of loop-run and step 8 of finalize-pr both decided mergeability
from `pull_request_read method:get_status`. That call returns commit
statuses; every repo here tests on GitHub Actions, which reports as
check runs — a separate GitHub surface `get_status` cannot see at all.
The gate was therefore wrong in both directions, measured on two live
PRs on 2 Sep:
SahajAtlasWeb#181 get_status: pending, 0 statuses
get_check_runs: 5/5 success
SahajCloud#672 get_status: success (Railway deploy, 21:14:17Z)
get_check_runs: Lint, Test & Smoke ended 21:31:40Z
The second is the dangerous one. For those seventeen minutes an approved
PR read green while its test job was still running, so a rung-1 run
waking in that window would have merged untested code while following
the skill exactly. The first is merely wasteful: a fully green PR that
the loop would decline to merge on every run, forever.
Both skills now read `get_check_runs` and state green explicitly, since
neither call alone is it: at least one check run, every check run
finished, and every commit status entry successful.
Two clauses go beyond what the ticket specified, and both prevent a
false negative that would recreate the #181 shape:
- `skipped` and `neutral` pass. A strict `conclusion == "success"` test
would read a conditionally-skipped job as not-green forever. Whether a
skip is legitimate is CI's own problem, and the repos already solve it.
- Read the individual `statuses` entries, not `get_status`'s combined
`state` field — with zero statuses that field is `pending`, which is
exactly how #181 read as unfinished.
The "at least one check run" clause is what stops an empty array reading
as green: a merge conflict schedules zero workflow runs, and "every check
run succeeded" is vacuously true of nothing.
This is prose, so it cannot be validated by running it — the change takes
effect on the next run, not this one. The evidence available before merge
is the four tool calls above; docs/why.md carries them.
Closes #26
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V9pS12WqrzQQzKpPoNnyFx
This was referenced Sep 2, 2026
Closed
Ardnived
added a commit
that referenced
this pull request
Sep 2, 2026
Both sides were largely additive; four files conflicted and three of the resolutions were judgement calls worth recording. **The CI-green rule now has one home.** #28 landed the same fix as this branch, as prose, with its own `why.md` anchor — so main and this branch each carried a statement of what "green" means, plus `merge-gate.mjs` implementing it. Deleted my anchor in favour of main's `#ci-truth-lives-in-check-runs`, which is the better write-up (it also reasons about `skipped`/`neutral` and about why the mirror-image status clause is deliberately absent), repointed the citations, and cut rung 1's restatement down to a pointer at the script. The implementation was checked against main's prose clause by clause: they agree. **Kept #32's `review` block, dropped its essay.** A four-sentence `$comment` explaining the fallback idempotency key is a rule, and rules live in the skill that enforces it — `adversarial-review/SKILL.md` already says all of it. **Fixed a bug #32 inherited rather than introduced.** Its rung-5 census, its proposal-ceiling check, its dropped-baton sweep and reflect's new review query all scope `org:$ORG`. The org still holds retired repositories, and that scope put seven-year-old Atlas and WeMeditate issues into the reviewer's queue the first time it was run as a real query. Every search in both skills now uses `$SCOPE`, built from `repos`, and the rule is stated once at rung 0. **Rung 5 no longer restates the green rule or hardcodes a repo fact.** It said "claude-workflow is the one exception: it has no CI" — which `merge-gate.mjs` derives from the workflow count, so it cannot go stale the day someone adds a workflow. Two more things this pass found, neither from #32: - The journal body still carried a `## This month` table from the era of monthly journal issues. The journal has been one issue per day since the baton work; a day's body cannot summarise a month, and the Sunday reflect rung is what reads across issues. - The awaiting-you table went into the per-run comment while the BODY — the surface the reviewer actually reads, and the one the rules single out as "never leave stale" — kept bullets. Both are tables now. `identity.mentionQuery` removed: nothing reads it since rung 0 spells the query out, and a config key no code reads is exactly what the values-only rule exists to prevent. Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_status, which returns commit statuses. Our tests run on GitHub Actions, which reports as check runs — a surfaceget_statuscannot see at all./finalize-prstep 8 now readget_check_runs, and both state what "green" means, because neither call alone is it.Changes
workflow/skills/loop-run/SKILL.md— Rung 1: the third call, the green definition, and two table rows reworded to point at itworkflow/skills/finalize-pr/SKILL.md— step 8's CI watch reads check runs; so does the poll named in loop-run's "Never subscribe" sectiondocs/why.md— new#ci-truth-lives-in-check-runs, carrying the four measurementsTest results
claude plugin validate ./workflow --strict→ "Validation passed", exit 0grep -n "get_status" workflow/skills/{loop-run,finalize-pr}/SKILL.md→ no site whereget_statusalone decides mergeability.claude/workflow.json→packageManager: "none")Manual verification
The evidence is four tool calls, made last night while reading PR state for the journal:
get_statusget_check_runsstate: "pending",total_count: 0,statuses: []conclusion: "success"state: "success", 1 status — Railway's deploy,created_at: 21:14:17ZLint, Test & Smoke,completed_at: 21:31:40ZApplying the new definition by hand:
success; zero statuses, which the definition treats as "no deploy integration", not as a failure. The old rule said "pending" — and would have said it on every run, forever, on a PR that was ready to merge.successstatus is a deploy; the test check run had not finished, so itsconclusionwasnull. The old rule saidsuccessfor those seventeen minutes.Both criteria in the ticket's verification checklist hold.
Notes for reviewer
⚠ This is prose, so it cannot be validated by running it — the change takes effect on the next run, never this one (
CLAUDE.md§ "You cannot validate a change by running it"). The measurements above are the whole of the evidence available before merge, which is why they are indocs/why.mdrather than only here.Two clauses go beyond what the ticket specified. Both were found by reading the diff against the failure it fixes, and both prevent a false negative that would recreate the #181 shape one level down:
skippedandneutralcount as passing. The ticket saidconclusion: "success"literally. A strict test would read a conditionally-skipped job as not-green forever, and the loop would comment on a healthy PR every run rather than merging it — exactly what it does to feat(loop): the Storybook connector, and the three skills that use it #181 today. Whether a skip is legitimate is CI's own problem, and the repos already solve it: SahajAtlasWeb's smoke lane fails a same-repo PR outright rather than skipping quietly.statusesentries, neverget_status's combinedstate. With zero statuses the combined field readspending, which is precisely how feat(loop): the Storybook connector, and the three skills that use it #181 read as unfinished. A definition phrased over the combined field would have shipped the bug it was written to fix.Say the word if you'd rather have the ticket's literal wording and I'll narrow it.
Detail
Why
get_statuslooked right for a week. It is the obvious-sounding call and it returns something plausible on every PR — a state, a count, a list. Nothing about the response says "this surface does not carry your tests". The SahajCloud row is the one that matters: a single green entry, no indication it is a deploy rather than a test, and no way to tell from that response alone that a test job exists at all.Why "at least one check run" is a clause and not decoration. A merge conflict makes GitHub schedule zero workflow runs (
docs/why.md#a-conflicted-pr-schedules-zero-ci-runs), socheck_runscomes back empty — and "every check run succeeded" is vacuously true of nothing. Without the clause a conflicted PR reads as green under the new rule, which would be a worse gate than the one being replaced. The mirror-image clause for statuses is deliberately absent: a repo with no deploy integration legitimately has none.Security review ran —
securityReview.triggerPatternmatches anySKILL.md, and this diff touches two. No findings. Noallowed-toolsline changes, no frontmatter changes, and no new instruction to fetch or execute external content; the only security-relevant property moves in the tightening direction. Theskipped/neutralclause was examined as a possible gate weakening and rejected: arranging for a required job to skip needs push access to the workflow definition, and the gate independently requires a human approving review plus zero unresolved threads, so that actor can already merge.Not done.
/simplifyand/pr-review-toolkit:review-prare not available in this routine sandbox, so step 1 and step 2 of the pipeline were replaced by an adversarial re-read of the diff — which is what produced both departures above. Worth knowing rather than assuming the six lenses ran.No worktree.
EnterWorktreecreates its worktree under.claude/worktrees/, and every edit here would then be a write under.claude/— the Protected Paths guard that stalls an unattended run invisibly (CLAUDE.md§ "Protected paths"). This repo has no dependencies, so a worktree buys nothing to offset that; the work was done on a plain branch off a clean tree.Closes #26
🤖 Generated with Claude Code
https://claude.ai/code/session_01V9pS12WqrzQQzKpPoNnyFx
Generated by Claude Code