Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(devex): stop required-check gates going green on cancelled builds (#68208)

Julian Bezded95bdc55ae
diff --git a/.github/workflows/ci-agent-proxy.yml b/.github/workflows/ci-agent-proxy.yml
index 38dbe482ba02..659084675654 100644
--- a/.github/workflows/ci-agent-proxy.yml
+++ b/.github/workflows/ci-agent-proxy.yml
@@ -101,17 +101,21 @@ jobs:
name: Agent Proxy CI Pass
runs-on: ubuntu-latest
timeout-minutes: 5
- if: ${{ !cancelled() }}
+ # always(), not !cancelled(): a skipped required check is treated as a pass by
+ # branch protection, so on cancellation the gate must run and emit an explicit
+ # result rather than skip into a green. A cancelled or timed-out job is caught
+ # by the != success && != skipped checks below; a legitimate no-change skip passes.
+ if: always()
steps:
- name: Check outcomes
run: |
- if [[ "${{ needs.changes.result }}" == "failure" ]]; then
- echo "Change detection job failed."
+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then
+ echo "Change detection did not succeed (result: ${{ needs.changes.result }})."
exit 1
fi
- if [[ "${{ needs.agent-proxy.result }}" == "failure" ]]; then
- echo "Agent Proxy checks failed."
+ if [[ "${{ needs.agent-proxy.result }}" != "success" && "${{ needs.agent-proxy.result }}" != "skipped" ]]; then
+ echo "Agent Proxy checks did not succeed (result: ${{ needs.agent-proxy.result }})."
exit 1
fi
diff --git a/.github/workflows/ci-llm-gateway.yml b/.github/workflows/ci-llm-gateway.yml
index 72b19907a9a6..46b7943a95ee 100644
--- a/.github/workflows/ci-llm-gateway.yml
+++ b/.github/workflows/ci-llm-gateway.yml
@@ -101,17 +101,21 @@ jobs:
name: LLM Services Tests Pass
runs-on: ubuntu-latest
timeout-minutes: 5
- if: ${{ !cancelled() }}
+ # always(), not !cancelled(): a skipped required check is treated as a pass by
+ # branch protection, so on cancellation the gate must run and emit an explicit
+ # result rather than skip into a green. A cancelled or timed-out job is caught
+ # by the != success && != skipped checks below; a legitimate no-change skip passes.
+ if: always()
steps:
- name: Check outcomes
run: |
- if [[ "${{ needs.changes.result }}" == "failure" ]]; then
- echo "Change detection job failed."
+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then
+ echo "Change detection did not succeed (result: ${{ needs.changes.result }})."
exit 1
fi
- if [[ "${{ needs.llm-gateway.result }}" == "failure" ]]; then
- echo "LLM Gateway tests failed."
+ if [[ "${{ needs.llm-gateway.result }}" != "success" && "${{ needs.llm-gateway.result }}" != "skipped" ]]; then
+ echo "LLM Gateway tests did not succeed (result: ${{ needs.llm-gateway.result }})."
exit 1
fi
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index cf2c2468fa5c..fd73d305a311 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -591,7 +591,7 @@ jobs:
# Collate matrix + VR completion status for the required check
visual_regression_tests:
- needs: [visual-regression, vr-setup, vr-complete]
+ needs: [changes, build-storybook, visual-regression, vr-setup, vr-complete]
name: Visual regression tests pass
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -599,13 +599,32 @@ jobs:
steps:
- name: Check matrix outcome
run: |
+ # Change detection is the root of the graph: if it fails, build-storybook
+ # (and everything after) is skipped, which the checks below would read as
+ # a pass. Fail here so a broken paths-filter/checkout can't launder into a
+ # green required check. A legitimate skip (e.g. merge_group) still passes.
+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then
+ echo "Change detection did not succeed (result: ${{ needs.changes.result }}) — cannot certify visual regression."
+ exit 1
+ fi
+
+ # A failed, timed-out or cancelled Storybook build skips the VR jobs
+ # below rather than failing them, and this gate would read those skips
+ # as a pass — a green required check with zero visual coverage. Naming
+ # the build here makes its failure hit the gate directly. A legitimate
+ # "no frontend changes" run leaves the build skipped, which still passes.
+ if [[ "${{ needs.build-storybook.result }}" != "success" && "${{ needs.build-storybook.result }}" != "skipped" ]]; then
+ echo "Storybook build did not succeed (result: ${{ needs.build-storybook.result }}) — visual regression is uncovered."
+ exit 1
+ fi
+
if [[ "${{ needs.visual-regression.result }}" != "success" && "${{ needs.visual-regression.result }}" != "skipped" ]]; then
echo "One or more jobs in the visual-regression test matrix failed."
exit 1
fi
- if [[ "${{ needs.vr-setup.result }}" == "failure" ]]; then
- echo "Visual Review setup failed — VR CLI or API error."
+ if [[ "${{ needs.vr-setup.result }}" != "success" && "${{ needs.vr-setup.result }}" != "skipped" ]]; then
+ echo "Visual Review setup failed or was cancelled (result: ${{ needs.vr-setup.result }})."
exit 1
fi