Skip to content

brain-ci: Merge Gate can never fail, and a failed detect-build passes as 'not applicable' #883

Open

Description

@gHashTag

Part of #851 (W15: gates that fail or pass for a reason other than their claim).

Two holes in brain-ci.yml, both next to the one #881 fixes. 🔒 Merge Gate can never fail, and the report prints a false "not applicable" when detect-build fails.

1. 🔒 Merge Gate cannot fail

merge-gate:
  needs: [brain-health-report]
  if: github.event_name == 'pull_request'
  steps:
    - run: |
        if [ "${{ needs.brain-health-report.result }}" != "success" ]; then
          ... exit 1

The job's if: has no status function, so GitHub adds success(). That is false as soon as any job upstream of it failed or was cancelled, including jobs it reaches only through the report's needs; the control run below shows this. So the gate runs only when the report and every brain job succeeded. Its one test, "the report did not succeed", is never true when it runs. When anything fails, the gate is skipped, which GitHub shows in grey, not red.

Measured on 3 pull_request runs where the report failed. In all 3 the Merge Gate is skipped:

run report merge gate
37020038238 failure skipped
36842740058 failure skipped
35513831395 failure skipped

main has no branch protection (GET branches/main/protection returns 404), so no check is required for merge. The gate's only effect is what a reviewer sees on the PR, and on a damaged PR that is a grey "skipped".

2. A failed detect-build makes the report say "no root build.zig"

detect-build writes present=true|false from a shell test. Every brain job runs only if present == 'true'. The report then does:

if [ "${{ needs.detect-build.outputs.present }}" != "true" ]; then
  echo "### ⏭️ Brain CI skipped — no root build.zig ... Non-blocking."
  exit 0
fi

If detect-build itself fails (checkout error, its 2-minute timeout, a broken step), the step that writes present never runs. The output is empty, and [ "" != "true" ] sends the report down the "not applicable" branch. The report check goes green and says there is no root build.zig. main does have one (57de4a1).

Correction. I first wrote that this turns the whole brain CI green, Merge Gate included. The control run shows otherwise. detect-build's own check is red, so the run is red, and the Merge Gate is skipped for the reason in section 1. What is false is the report: a green check whose summary gives a wrong reason. This is smaller than I first claimed.

Not measured: whether detect-build has ever failed on a real run.

Fix

  1. In the report, before the present test, require needs.detect-build.result == 'success'. Otherwise print the result it had and exit 1.
  2. Give merge-gate an explicit if: ${{ !cancelled() && github.event_name == 'pull_request' }}. It then runs after a failed report, and its existing test fails it. After a cancel it does not run (see brain-ci: a cancelled run posts a false "CRITICAL: Brain Health Below Threshold" #881).

Done when

Not in this issue

  • Whether 🔒 Merge Gate should exist at all, given that the report already fails. That is the owner's call. This issue makes it truthful and does not remove it.

🤖 Generated with Claude Code

Activity

  1. added 2 commits that reference this issue on Oct 4, 2026
    19a028d
    7fbeb9b
  2. added 5 commits that reference this issue on Oct 10, 2026
    6250a54
    98da33e
    3e3b3df
    01d8765
    0d34d65
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions