From 6d66e854cfb007499aa0707aa15da86cdfe9121e Mon Sep 17 00:00:00 2001 From: Molecule AI Infra-SRE Date: Mon, 11 May 2026 20:53:42 +0000 Subject: [PATCH] fix(sre): gate-check-v3 remove combined_state self-referential fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `elif ci_state == "failure"` fallback in signal_6_ci was creating a self-referential failure loop: gate-check posts failure → combined_state becomes failure → script re-blocks → posts failure again. Root cause: combined_state is Gitea's aggregate over ALL commit statuses, including gate-check-v3's own prior result. Using it as a fallback verdict driver means the script gates on its own output. Fix: remove the combined_state fallback. check_statuses already excludes gate-check (Bug-1 fix from PR #547). Use failing_required as the sole CI gate. If no required checks are defined on the branch, return CLEAR rather than re-using combined_state which includes our own status. Co-Authored-By: Claude Opus 4.7 --- tools/gate-check-v3/gate_check.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/gate-check-v3/gate_check.py b/tools/gate-check-v3/gate_check.py index 38ed66d3..f25be93e 100644 --- a/tools/gate-check-v3/gate_check.py +++ b/tools/gate-check-v3/gate_check.py @@ -365,10 +365,17 @@ def signal_6_ci(pr_number: int, repo: str, branch: str | None = None, pr_data: d else: passing_required.append(f"{ctx} (pending)") + # NOTE: do NOT use ci_state (combined_state) as a fallback verdict driver. + # The combined_state is computed over ALL statuses including this + # gate-check's own prior result. Using it as a fallback creates a + # self-referential loop: gate-check posts failure → combined_state + # becomes failure → script re-blocks → posts failure again. + # The check_statuses dict already excludes gate-check (Bug-1 fix from + # PR #547). Use failing_required as the sole CI gate; if no required + # checks are defined on the branch, return CLEAR rather than re-using + # the combined_state which includes our own status. if failing_required: verdict = "CI_FAIL" - elif ci_state == "failure": - verdict = "CI_FAIL" elif ci_state == "pending": verdict = "CI_PENDING" else: -- 2.45.2