phase-pr exits 0 on a green gate, then pushes a commit the gate never validated #536
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#536
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observed on MEDECA-374 phase 1, GitLab (gitlab.e-bs.cz), MR !448.
WHAT HAPPENED
'./iw phase-pr' waited ~20 minutes, reported CI green, and exited 0. The GitLab API then showed two different pipelines on that MR:
pipeline.id=5316, sha a1fb61c65, status: success <- the run the gate actually read
head_pipeline.id=5318, sha c0cd0afb2, status: pending, started_at: None
The second was still unstarted two hours later.
c0cd0afb2 is phase-pr's OWN bookkeeping commit ('chore: update review-state for phase 01'), pushed AFTER the gate passed, touching only review-state.json. So at the exact moment the workflow declared the phase ready for review, the MR head carried an unvalidated pipeline.
WHY IT SURVIVES UNNOTICED
The pushed commit touches only review-state.json, which is the common case and is harmless. The gap is invisible until someone repeats the gate's 'CI is green' as a claim about the branch rather than about one sha.
SUGGESTED FIX (either one)
WORKAROUND USED
Verified head_pipeline against the MR sha via the GitLab API before reporting the phase's CI state.
Type: bug
Filed from:
/home/mph/Devel/projects/medeca-modul-poptavky-MEDECA-374on branchMEDECA-374Intake: duplicate of #491 — closing this one.
#491 ("phase-pr pushes a commit after reading CI, so its green can describe a stale head", filed 2026-09-01) names the same code path, still present on
main:finishdispatchesCiVerdict.Green(_, sha)tohandOver, which callsupdateReviewStateForReviewand thenpersist;persistcommits the review-state file and pushes the phase branch, moving the head past the gated sha. Seecore/commands/PhasePr.scala:403-462and:526-541.The two reports differ only in the forge and in the symptom that followed the late push — #491 saw it start a run that went red, this one saw it leave the head pipeline unstarted. The cause is identical and both propose the same two options (push the card before the wait, or re-read CI for the new head after the push). Fixing #491 closes this.
Checked and ruled out: IW-517 (
6c2baaad) changed onlycore/adapters/GitLabClient.scala, making the GitLab gate read every pipeline at a commit instead ofhead_pipeline. It does not touch the gate/commit/push order, so it does not fix this.#485 (gate concludes before a pipeline exists) and #513 (forge down vs forge refused) are separate defects in the same command and stay open.