Repository navigation
chore(skills): fixer always verifies and fixes post-merge CI on main - #2250
Conversation
Two consecutive /fixer merges each had fully green pre-merge PR checks, but the separate push-triggered CI workflow run on main failed both times right after -- a risk the PR-level gate (step 2f) never checks. Add invariant I8, step 2f-bis, and a matching pointer in the drain phase so every merge is followed by a mandatory wait-and-fix on main's own post-merge CI before the batch advances to the next issue.
Greptile SummaryThe PR makes post-merge
Confidence Score: 4/5The PR needs a drain-phase PR-identifier fix before merging because that path cannot reliably resolve and verify the CI run for the parked PR it just merged. The normal merge path now identifies its commit safely, but the drain path holds the merged PR in Files Needing Attention: .claude/skills/fixer/SKILL.md Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Merge PR"] --> B["Read immutable mergeCommit.oid"]
B --> C["Find matching main CI run"]
C --> D["Watch run"]
D -->|Green| E["Advance"]
D -->|Red| F["Inspect and rerun failed jobs"]
F -->|Green| E
F -->|Still red| G["Stop and fix regression"]
H["Drain-phase merge: MERGED_PR"] -. "must be mapped to lookup input" .-> B
Reviews (2): Last reviewed commit: "fix(skills): read post-merge CI SHA from..." | Re-trigger Greptile |
| # checkout does not have the new commit until fetched. | ||
| git fetch origin main || { echo "ERROR: git fetch failed — cannot identify the merge commit"; exit 1; } |
There was a problem hiding this comment.
There was a problem hiding this comment.
Fixed in 912d314 — MERGE_SHA is now read from gh pr view <PR> --json mergeCommit --jq '.mergeCommit.oid' (authoritative and immutable once GitHub records the merge) instead of git rev-parse origin/main after a fetch, which could race with a concurrent push to main.
| echo "fixer: state.json entry for PR #$MERGED_PR updated parked -> merged" | ||
| ``` | ||
|
|
||
| Then apply I8 exactly as in step 2f-bis: verify the post-merge `CI` workflow run on `main` for this merge's commit, wait for it if still in progress, and diagnose-and-fix (or confirm-transient-via-rerun) a red result before merging the next parked PR or starting another pass. A drain-phase merge lands on `main` the same way a Phase 2 merge does, so it carries the identical risk of tipping shared CI capacity into failure. |
There was a problem hiding this comment.
Drain loses merged PR identity
When a parked PR is merged during the drain phase, applying step 2f-bis exactly reads .codegraph/fixer/current-pr, which normal iteration cleanup has already removed, instead of using the drain phase's MERGED_PR. The verification therefore exits while reading the missing state or uses stale state and watches CI for the wrong PR, leaving the just-merged commit unverified.
Summary
An autonomous
/fixerbatch run surfaced a real gap in its own merge-gate process./fixerchecks each PR's own pre-mergestatusCheckRollup(the five gate conditions in step 2f) before merging with--squash --admin— but this repo also runs a separateCIworkflow triggered directly by the push-to-mainevent at merge time: a full, independent re-run of the entire test suite on the newmainHEAD./fixernever checked that workflow at all.In practice: two consecutive merges during a batch run each had fully green pre-merge PR checks (verified at the time and re-verified after the fact), but the separate post-merge
CIrun onmainfailed both times right after, with an identicalTest Node 22 (windows-2022)timeout in abeforeAllhook — never seen in the previous 20 runs onmain, and gone again on the very next run. This points to the batch's own rapid-fire merge cadence straining shared Windows-runner capacity, not a real regression in either merged PR — but/fixerhad no mechanism to even notice, let alone respond to, that failure.Changes
Why this skill is built the way it is):main's own post-merge CI state, not just each PR's pre-merge checks, is the real ground truth for whether a batch is leaving the repo healthy.Phase: Solve and Merge Loop): after every successful merge, identify the post-mergeCIrun for that exact commit, wait for it in the foreground, and if it's red: diagnose viagh run view --log-failed, fix a genuine regression with a new small PR, or confirm-and-clear a transient failure with onegh run rerun --failed. Never cut the next issue's branch while this is unresolved.post-merge-ci-runscratch-state entry for the run ID being watched.The five pre-merge gate conditions (G1-G5) are unchanged and still described as "five" — this is a separate, additional post-merge check, not a sixth gate, since it runs after
gh pr mergerather than as a precondition to it.A related resumability gap in the crash-resume reconciliation path (which can bypass this check if a sub-agent crashes between
gh pr mergeandstate.json's write) was found but is out of scope for this change; filed as #2249.Verification
npm run lint).claude/skills/create-skill/scripts/lint-skill.shrun against the edited file: identical error/warning count to the unmodified file (2 pre-existing false-positive errors, 13 pre-existing warnings) — no new issues introduced by this change.