iw ci-gate reads a commit's whole status history, so a re-run can never go green #472
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#472
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?
What happens
./iw ci-gatereportsCI failedand writesstatus: ci_failedinto the sliceor phase card for a pull request whose checks are all green, whenever the
commit has had more than one CI run.
Seen on PR #470 (commit
811feec). Run #151 failed three jobs because therunner could not reach the maven mirror:
Re-triggering produced run #152 on the same commit, with all six jobs
success(compile, format, lint, test, dashboard-build, contract).ci-gatestill answered:
Why
A commit's status list is append-only: each run adds a row per context rather
than replacing one. The forge itself resolves this correctly —
— but the per-status endpoint keeps the whole history:
ci-gateappears to scan all entries and treat anyfailureas the verdict,instead of taking the latest status per context (or asking the combined
/statusendpoint, which already does exactly this).Consequence
Any close or phase gate that has ever had to re-run CI — for a flaky runner, a
network blip, a cancelled run — is stuck reporting failure permanently, and
writes a false
ci_failedinto the card the dashboard shows. The only way outis to push a new commit so the status history starts clean, or to correct the
card by hand after checking the combined status.
A second, smaller defect in the same run: the gate wrote
ci_gated_sha: e1cf757— the commit before the merge it had just judged, not811feec.Suggested fix
Resolve each context to its most recent status before deciding, or read the
combined
/commits/{sha}/statusendpoint, whosestateis already the answer.Stamp
ci_gated_shawith the commit actually gated.Neighbours
IW-437 covers the gate calling a slow pipeline failed (the wait budget
expiring against a green run). This is the gate calling a re-run pipeline
failed, which is a different cause with the same visible outcome — a green pull
request marked
ci_failed.Found while closing slice
dashboard-control-plane/08-the-cleanup-gets-done(PR #470); recorded in that effort's
LESSONS.md.Fixed in PR #501 (merge
d1eba9c4). Run supersession now keys on(workflowLabel, event)and keeps the newest, after collapsing attempts per run id, so a re-triggered run supersedes the one it replaced. Runs tied at the newest instant are all kept. The second defect is fixed too:ci_gated_shais stamped with the commit actually gated and cleared on every non-green exit.Known limit, accepted deliberately: on GitHub
workflowLabelis the run display name, so two workflow files sharing onename:and one event would collapse. Forgejo (workflow_id) and GitLab (one pipeline per commit+source) are unaffected.