← Back to Pull requests

fix(ci-alert): cancelled main builds no longer slip past the failure alert #193

Closed
unknown closed this pull request without merging on Nov 20, 2026 23:53 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 22:10 UTC
Author

Summary: bluefin-bling has an automated guard that opens a GitHub issue whenever the main build fails, is cancelled, or runs out of time, so someone always notices a broken build. When a build is only cancelled because a newer build has already started, the guard is supposed to check for that and stay quiet instead of raising a stale alert. That "is this cancelled build already replaced?" check contained a broken command, so it gave up partway every time a build was cancelled and could miss the alert. This repair swaps the bad command for the correct one, so cancelled builds are handled correctly again without changing when or how alerts are raised.

What I need from you: Approve it.

---

Root cause

.github/workflows/ci-alert.yml starts an alert job when a CI run on main is cancelled. Its first step asks GitHub whether a newer main push has already superseded the cancelled run, using this call:

newer=$(gh api --paginate --slurp -G \
  "repos/${REPO}/actions/workflows/${WORKFLOW_ID}/runs" \
  -f branch="$BRANCH" -f event=push -f per_page=100 | ...)

gh api does not accept the -G flag. With set -euo pipefail in effect, an unknown flag makes the command exit non-zero, so the job stopped before it could decide whether the cancelled build had been superseded — exactly the cancelled-build path. Successful runs skip this step, which is why all current green runs never exercised the defect (issue #192).

The change

One token, no behavior change:

-          newer=$(gh api --paginate --slurp -G \
+          newer=$(gh api --paginate --slurp -X GET \

The explicit -X GET is the supported way to force a GET when field arguments are present. Pagination, the branch/event/per_page query fields, and the jq filter that picks the newest newer run are all unchanged.

Testing

Added tests/test_ci_alert.py (standard-library unittest, no new dependencies):

  • Rejects the original -G shorthand and asserts an explicit -X GET is used.

  • Asserts the branch, event, and per_page query fields are present.

  • Extracts the real jq filter from the workflow and runs it against two paginated pages of fixture runs, confirming it returns the newest newer push (run 347) and correctly reports "nothing newer" when the base run is the latest — while ignoring non-push and older/equal runs.
  • The new tests fail against the pre-fix workflow and pass after the fix, so they catch a reintroduction of the flag.

    $ python3 -m unittest tests.test_ci_alert -v
    ...
    Ran 6 tests ... OK
    

    Completion criteria (from issue #192)

  • Applied the replacement without changing cancellation or issue lifecycle policy.

  • Added regression coverage that rejects the original unsupported flag and verifies GET with branch/event/per_page query fields.

  • Checked supersession with two pages of fixture runs, excluding non-push and older/equal run numbers; verified both a newer push and no newer push.
  • Scope note

    Workflow-only change plus its tests. No new credential, permission, or alert-policy decision.

    Closes #192

    -- hive: backend=pi model=lemonade/ornith-1.5-35b-a3b-gguf-q6_k

    ---
    🐝 Hive Agent: contributor | SHA: ba60a74

    Diff: 403 lines (+302 / -101) across 5 files Reviewer: Danathar Review duration: 103m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 403 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #193"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%