Skip to content

fix(ci): contract-only ci-status reads a stale failure during a re-run #4670

Closed

Description

@kyle-sexton

Problem

Reported: editing a PR body triggered a ci run that skipped every lane, ci-status went red as the newest status and blocked the merge, and an empty commit was needed to clear it.

The mechanism in that framing does not match main. .github/workflows/ci.yml treats edited (without changes.base), labeled and unlabeled on a same-repo PR as contract-only. Every job except ci-status is gated off with the same predicate (ci.yml:14-42; the gate at :137, :325, :681 and on the other lane jobs). ci-status (ci.yml, job ci-status, treat-skipped-as: fail, carry-forward-wait-seconds: '540') calls the ci-workflows ci-status composite (pinned 4610c31e, v0.27.1). In contract-only mode that composite ignores the skipped results and instead reads the ci-lanes commit status the last full run recorded on the head SHA. It waits up to 540 s for any in-flight run of the workflow on that SHA. So a body edit goes red only when ci-lanes is failure or absent at read time. treat-skipped-as plays no part.

The real hazard is that a red contract-only check can outlive the failure it carried:

  • (a) A stale settled status ends the wait. In the composite's run.sh (pinned copy line 348; ci-workflows HEAD line 336, logic unchanged), the poll loop breaks as soon as ci-lanes is success, failure or error. It does not check whether a sibling run on the same SHA is still in flight. After a full run fails and is re-run, a body edit during the re-run reads the old failure at once and goes red, without waiting for the re-run the loop exists to wait for.
  • (b) The remedy text sends people the wrong way. The failure message says "no successful ci-lanes status on ; re-run the full workflow". Once ci-lanes is success, re-running the red contract-only run is enough. The message never says so, so an empty commit (a full re-run of every lane) is the natural reaction.

Evidence

Verified this pass (2026-09-27, gh run view/gh api reads):

Not verified:

  • The original incident. No red contract-only run was found whose SHA already had a successful ci-lanes at read time, and no empty-commit PR was identified.
  • Defect (a) in a live run.
  • Which of two same-name ci-status check runs on one SHA the org ruleset honors. If it honors any failure rather than the latest, a red contract-only run blocks the merge even after a passing re-run, and only a new commit clears it. That would match the report.

Proposed approach

The composite is owned by melodic-software/ci-workflows. Fix it there, then repin here.

  1. Reproduce first, in a throwaway PR:
    • Make a full run fail.
    • Re-run it, and edit the body while the re-run is in flight.
    • Observe whether the contract-only run reads the stale failure without waiting (defect a).
    • After the re-run passes, check the PR's merge box: is it blocked by the older red ci-status check run?
  2. Upstream (ci-workflows), for (a): in carry-forward mode, a settled failure or error ends the wait only when no full-run re-run started after that status is in flight (see Constraints for why "any sibling" is wrong). A success may still end it immediately.
  3. Upstream, for (b): rewrite the failure message to name both paths. With a failed or missing full run, re-run the full workflow. When ci-lanes is already success, re-run this run.
  4. Here, only if the reproduction shows the ruleset honors the older red check run: give each full run's ci-status a way to clear stale contract-only failures, for example by re-running failed contract-only ci runs on the same SHA after it records success (needs actions: write). Otherwise document "re-run the red ci-status run" in the PR workflow docs.
  5. Repin ci-workflows in .github/workflows/ci.yml (every uses: SHA moves together) and update the carry-forward-wait-seconds comment if the semantics change.

Acceptance criteria

  • The reproduction result is recorded here, including how the ruleset treats two same-name check runs on one SHA.
  • In a throwaway PR, a body edit made while a re-run of a failed full run is in flight waits for the re-run and passes when the re-run passes.
  • The contract-only failure message names the re-run-this-run remedy when ci-lanes is success.
  • No empty commit is needed to clear a stale red ci-status after the lanes pass (shown in the throwaway PR).
  • ci.yml pins the fixed ci-workflows release.

Constraints and gotchas

  • The fix for (a) must not bring back mutual waiting. The composite's input doc says reading the settled status on each poll is what stops two contract-only runs on one SHA from waiting on each other until the ceiling. Waiting on "any in-flight sibling" before accepting a failure would reintroduce that for two label flips on a failed SHA. The loop has to tell a full-run re-run apart from a contract-only sibling. Options: wait only on a sibling whose current attempt started after the settled status's created_at, or inspect the sibling's jobs to see whether its lanes run.
  • ci-status is the only required check. A change that lets it pass on a skipped lane or on a timeout reopens the fail-open hole the composite exists to close; keep every path fail-closed.
  • The contract-only predicate is repeated verbatim in the concurrency group, in every gated job's if:, and as the composite's contract-only default. Change all of them or none.
  • The wait ceiling is sized from this repository's measured full-run time (timeout-minutes: 10, 540 s).
  • Test in a throwaway PR. Do not force-push or empty-commit other people's PRs to test.

Context

Source: operator report during the inbox wind-down, which this issue retires. Related: ci-workflows #550, #557, #559, #561, #562; melodic-software/github-iac#378 (the earlier eviction bug that led to the branched concurrency group).

Activity

  1. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    Reopened. This comes from the 2026-09-29 audit of the Cursor agent run. priority: medium and work-class: scoped stay.

    Finding

    #4956 closed this issue with none of the five acceptance criteria met. It added a ci.yml comment and a docs section (the issue's conditional step 4 fallback) without doing steps 1-3 and 5: no reproduction is recorded, no upstream fix exists, and ci.yml still pins ci-workflows 4610c31e (v0.27.1) for that composite.

    The operator remedy it states (re-run the red contract-only run; an empty commit is wrong) is unverified. The issue's "Not verified" section names exactly this: which of two same-name ci-status check runs the org ruleset honors.

    Operator steps (needs a maintainer with a throwaway PR)

    1. Throwaway PR: make a full ci run fail, re-run it, edit the PR body while the re-run is in flight, and record whether the contract-only ci-status reads the stale failure without waiting (defect a).
    2. After the re-run passes, check the merge box: does the older red ci-status check run still block? Record the result here.
    3. File the upstream issue in melodic-software/ci-workflows (none exists: fix(source-control): require per-thread pins for autonomous bulk babysit thread resolves #561, source-control/babysit-prs: telemetry-comment edit uses gh api -f body=@file, posts literal @path string instead of file content #559 and work-items(triage): status side-exit routing does not reliably clear priority: needs-triage, letting already-decided items re-enter the queue #562 fixed earlier wait-ordering bugs, none covers defect a; search again first) using the issue body's steps 2 and 3 and its Constraints (do not reintroduce mutual waiting; tell a full-run re-run from a contract-only sibling; keep every path fail-closed). Link it here.
    4. Repin ci-workflows and update the docs section.

    This issue stays the tracker until then.

    What happens next

    PR #5316 reduces the ci.yml comment to a pointer at docs/ci-runner-routing.md and uses Refs #4670, never Closes. The core-docs group is asked to soften the docs remedy to what is verified.

  2. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Agent consensus under the owner's 2026-09-30 delegation (not reviewed by the owner; reversible): Not obsolete. The thread's four operator steps were never done, and nothing on origin/main or upstream supersedes them. The thread frames no owner question, and the owner delegated the choice to run the throwaway-PR reproduction autonomously instead of waiting for a maintainer. Resolution: do it here.

    Plan:

    1. Open a throwaway same-repo PR as a draft with a do-not-merge label, and close and delete it at the end. Make the full ci run fail, re-run it, edit the PR body during the re-run, and record whether the contract-only ci-status reads the stale ci-lanes=failure at once (defect a). After the re-run passes, read the merge box and the rulesets API to see whether the older red ci-status check run still blocks. Record both results on fix(ci): contract-only ci-status reads a stale failure during a re-run #4670.
    2. Search melodic-software/ci-workflows again, then file the upstream issue and PR. In carry-forward mode a settled failure or error ends the wait only if no full-run re-run started after that status's created_at is in flight. Rewrite the failure message to name the re-run-this-run remedy when ci-lanes is success. Keep every path fail-closed and do not reintroduce mutual waiting. Extend the ci-workflows ci-status shell tests with: (i) stale failure plus in-flight full re-run waits, (ii) two contract-only siblings on a failed SHA do not wait on each other, (iii) a missing status still fails.
    3. After an upstream release, repin every uses: SHA in .github/workflows/ci.yml together and update the carry-forward-wait-seconds comment. Update docs/ci-runner-routing.md, and add the stale-check-clearing step only if step 1 shows the ruleset honors the older red check run. The PR uses Refs #4670, and the issue closes when all five acceptance criteria are met.

    Evidence: origin/main .github/workflows/ci.yml still pins ci-workflows 4610c31e (v0.27.1). ci-workflows main .github/actions/ci-status/run.sh lines 332-340 say a settled verdict ends the wait whatever is still in flight, and lines 378, 388 and 396 still say only "re-run the full workflow", so defects (a) and (b) are unfixed. No ci-workflows issue covers defect (a) (#561 is closed and a different ordering bug). Latest ci-workflows release is v0.30.1 and the repin is pending. Not verified: whether the PR #5316 comment softening landed.

    Resolved by consensus of three read-only researchers under the owner's standing instruction of 2026-09-30 to resolve owner-gated issues.

    Next: the issue is labeled agent-ready; a worker picks it up and starts with step 1.

  3. added
    agent-ready
    on Sep 30, 2026
  4. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Reproduction results from a throwaway PR (#5581, draft, labeled do-not-merge, now closed and its branch deleted). All times are 2026-09-30 UTC, repo melodic-software/claude-code-plugins, head SHA ad99ed0ce859b0fa1071d48f30c410528ee331f8, composite pin 4610c31e (v0.27.1).

    Setup: a step in the hook-utils job (if: github.run_attempt == '1', run: exit 1) fails the first attempt only. scripts/check-lane-coverage.sh --check and scripts/check-docs-only-gate.sh --check accepted the edit.

    Defect (a) is reproduced

    Time Event
    05:33:54 PR opened as draft with the label. Full run 36673988526 (opened) and contract-only run 36673989103 (labeled) start.
    05:56:46 Full run attempt 1 ends with hook-utils failed. ci-lanes=failure recorded (status id 55241522644).
    05:57:09 gh run rerun 36673988526. Attempt 2 is queued.
    05:57:13 gh pr edit --body-file while attempt 2 is queued.
    05:57:16 Contract-only run 36675804726 (edited) is created.
    05:59:56 Its ci-status job starts. Attempt 2 is still in flight: changes finished 05:59:31, every lane job was still queued.
    06:00:00 Aggregate step logs Contract-only event: reading the ci-lanes status ....
    06:00:01 ::error::no successful ci-lanes status on ad99ed0c...; re-run the full workflow.

    The log has no Waiting Ns for in-flight run(s) line and no wait note. The composite read the stale failure at once, with the re-run in flight, and went red. After attempt 2 finished at 06:12:50 (all lanes success), ci-lanes=success was recorded at 06:12:49 (status id 55242254969).

    Contrast, run 36673989103 (started 05:39:26): no settled ci-lanes status existed yet, so it logged Waiting 15s for in-flight run(s) 36673988526 on every poll and ended at the 540 s ceiling (05:49:03) with waited 540s of 540s. The full run was slow that day because lane jobs sat in the runner queue for about 6 minutes, and it ran about 23 minutes end to end. So the wait loop works only while no settled status exists.

    Re-running the red contract-only run

    Re-running 36675804726 after ci-lanes=success (attempt 2 job, 06:14:55): the Aggregate step logged Carried forward: ci-lanes is success on ad99ed0c... and passed. The job still went red because pr-contract fails on the do-not-merge label. The stale check run 109760383506 was replaced by 109764541830 in the same check suite (99324140244). The check-runs API no longer lists the replaced run. The same happens to attempt 1 of the full run after a re-run.

    So a re-run of a red contract-only run fixes the composite's own verdict and replaces that check run. That supports defect (b): the remedy is to re-run the contract-only run, not to push a commit.

    Ruleset and merge box: not determined

    • gh api repos/melodic-software/claude-code-plugins/rules/branches/main is readable without admin scope. The required-status-checks rule is from org ruleset 17989001: context ci-status, integration_id 15368, strict_required_status_checks_policy false. Other rules: deletion, non_fast_forward, required_linear_history (17988999), pull_request (squash only, thread resolution required), required_signatures (17989003). None says how two same-name check runs on one SHA are combined.
    • GitHub's "Troubleshooting required status checks" page states that a check and a commit status of the same name must both pass. It does not say how two check runs of the same name are combined.
    • With the label applied, every ci-status run is red no matter what ci-lanes says, so the merge box cannot answer the question. After the passing re-run: mergeStateStatus BLOCKED, mergeable MERGEABLE, draft true; rollup holds three ci-status FAILURE entries (runs 36673988526, 36673989103, 36675804726) and ci-lanes SUCCESS. Whether the ruleset honors the latest run or any red run was not observable.
    • Answering it needs a green latest ci-status, so a ready, unlabeled probe PR with an older red contract-only check run beside it. I did not remove the label: the do-not-merge label was the only merge guard on a probe that adds a first-attempt exit 1 to ci.yml, and a green unlabeled ready PR could be merged. That is the owner's call.
    • Historical check: over the last 200 merged PRs, none had a failure ci-status check run older than a later success on its merged head SHA. The SHA 3e014e21 from the issue is on no remote branch and no PR has it as a head (PR 4559, same title, merged with head 0b88a37d), so it cannot show whether the ruleset blocked.

    Acceptance criteria

    • AC1: partial. The reproduction is recorded, but the two-same-name-check-runs question is open.
    • AC2, AC3, AC4, AC5: not met. They need the upstream ci-workflows fix and a repin.

    The issue stays open.

  5. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-09-30): ratified. The owner approved the agent consensus above (headed "Agent consensus under the owner's 2026-09-30 delegation") in their own words: "I explicitly want you to do the recommended stuff here." It now stands as the owner's decision.

  6. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-01): approved the recommendation ("go with recommended", the owner's reply to the batch decision page that listed this question and its recommendation).

    Question: may an agent merge ci-workflows PR #647 and cut a release so the repin can go ahead?

    Chosen option A: approve, with no ruleset probe. An agent takes ci-workflows #647 out of draft, merges it and cuts a release. It then repins every ci-workflows uses: SHA in .github/workflows/ci.yml together, updates the carry-forward-wait-seconds comment and docs/ci-runner-routing.md (the remedy is to re-run the contract-only run; how the ruleset treats two same-name ci-status check runs stays recorded as unverified), and re-runs the labeled draft throwaway-PR check on the new pin. No unlabeled ready probe PR.

    Next: an agent readies and merges #647 through its own ready flow, cuts the release, and opens a draft PR here (Refs #4670) with the repin and doc edits. The result goes on this issue, and it closes once AC2-AC5 are met, with AC1's ruleset item recorded as unverified.

  7. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Done under the owner decision of 2026-10-01 (option A). All times are 2026-10-01 UTC.

    Merges and release

    Throwaway-PR check on the new pin

    The probe was #5749: a draft labeled do-not-merge, now closed with its branch deleted. Its head d01dc5d4 is #5747's head at the time, e53c2f6e (the same ci-workflows pins that merged), plus the same hook-utils step as #5581 (if: github.run_attempt == '1', run: exit 1).

    Time Event
    21:18:51 PR opened. Full run 36927824414 starts, and contract-only run 36927828640 (labeled) starts.
    21:18:59 to 21:27:15 36927828640 logs Waiting 15s for in-flight run(s) 36927824414 on every poll.
    21:27:01 Attempt 1 records ci-lanes=failure (status 55404119752).
    21:27:14 gh run rerun 36927824414 --failed. Attempt 2 is queued with run_started_at 21:27:15.
    21:27:15 36927828640's last poll, within a second of the re-run request, reads the attempt-1 failure as settled, and the run goes red.
    21:27:15 gh pr edit --body-file creates contract-only run 36928786481 (edited).
    21:27:31 36928786481 logs Waiting 15s for in-flight run(s) 36927824414 ... (waited 0s of 540s).
    21:27:45 Attempt 2 records ci-lanes=success (status 55404172904).
    21:27:47 36928786481: settled after 15s, then Carried forward: ci-lanes is success. Its Aggregate step passes.
    21:28:38 Red run 36927828640 is re-run with no new commit. Its Aggregate step logs Carried forward: ci-lanes is success and passes.

    Three Aggregate steps passed: 36927824414 attempt 2, 36928786481, and 36927828640 attempt 2. Their ci-status jobs are still red, but only because pr-contract fails on the do-not-merge label, the probe's merge guard. The Aggregate step, which runs the composite, is the verdict this check reads. At 21:27:31 the newest ci-lanes was still the 21:27:01 failure, and the success arrived only at 21:27:45. That poll is the one that tells v0.30.2 from v0.27.1, which would have gone red there. On v0.27.1 the same body edit read the stale failure at once (#5581, run 36675804726).

    The red at 21:27:15 carries the new message: no successful ci-lanes status on d01dc5d4...; re-run the full workflow (waited 465s of 540s on in-flight run(s): 36927824414). Once ci-lanes on d01dc5d4... is success, re-run this run instead.

    Acceptance criteria

    • AC1: the reproduction is recorded above and in the 2026-09-30 comment. How the org ruleset treats two same-name ci-status check runs on one SHA stays unverified. The decision ruled out an unlabeled ready probe, and docs/ci-runner-routing.md says it is unverified. No stale-check-clearing step was added.
    • AC2: met (run 36928786481).
    • AC3: met (the run 36927828640 message above, and ci-workflows run.sh fail_carry_forward).
    • AC4: met. Re-running the red run cleared its Aggregate verdict with no new commit, and the run started during the re-run waited and passed.
    • AC5: met. ci.yml pins v0.30.2 on main at b935cceb8e9962df5a1cff906668d53b16e35cac.

    Closing per the decision: AC2 to AC5 are met, and AC1's ruleset item is recorded as unverified.

    Not in scope, because the decision names only ci.yml: .github/workflows/test-windows.yml (change-detection) and .github/workflows/issue-triage-label.yml still pin ci-workflows v0.27.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions