From ade4f4ba8b3113688ab7095de2b3cad0139e7e57 Mon Sep 17 00:00:00 2001 From: Shuwen Wang <47200617+alphabetc1@users.noreply.github.com> Date: Sat, 29 Aug 2026 04:45:59 +0800 Subject: [PATCH] fix: report the real backend for non-CUDA CI registrations in /rerun-test (#36778) --- scripts/ci/utils/slash_command_handler.py | 49 +++++++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/scripts/ci/utils/slash_command_handler.py b/scripts/ci/utils/slash_command_handler.py index 1bd0e7717..a59a5df17 100644 --- a/scripts/ci/utils/slash_command_handler.py +++ b/scripts/ci/utils/slash_command_handler.py @@ -736,12 +736,11 @@ def _extract_runner_configs(content): return out -def _extract_legacy_suites(content): - """Pull every legacy single-string `suite=` from `register_cuda_ci(...)` - calls. Used only to report why such a file is not dispatchable.""" +def _extract_suites(content, register_fn): + """Pull every single-string `suite=` from `(...)` calls.""" out = [] for args in re.finditer( - r"^[^#\n]*register_cuda_ci\s*\(([^)]*)\)", content, re.MULTILINE + rf"^[^#\n]*{register_fn}\s*\(([^)]*)\)", content, re.MULTILINE ): m = re.search(r'suite\s*=\s*["\']([^"\']+)["\']', args.group(1)) if m: @@ -749,6 +748,34 @@ def _extract_legacy_suites(content): return out +def _extract_legacy_suites(content): + """Pull every legacy single-string `suite=` from `register_cuda_ci(...)` + calls. Used only to report why such a file is not dispatchable.""" + return _extract_suites(content, "register_cuda_ci") + + +# Backends with no job in rerun-test.yml (cuda / multimodal_gen / cpu only) and +# no runner_config in runner_configs.yml, so no dispatch can be built for them. +# Mirrors `REGISTER_MAPPING` in python/sglang/test/ci/ci_register.py. +_OTHER_BACKEND_REGISTERS = { + "register_amd_ci": "AMD", + "register_npu_ci": "NPU", + "register_xpu_ci": "XPU", + "register_musa_ci": "MUSA", + "register_mlx_ci": "MLX", +} + + +def _extract_other_backends(content): + """Return (backend labels, suite names) for every non-CUDA/CPU registration.""" + labels, suites = [], [] + for register_fn, label in _OTHER_BACKEND_REGISTERS.items(): + if re.search(rf"^[^#\n]*{register_fn}\s*\(", content, re.MULTILINE): + labels.append(label) + suites.extend(_extract_suites(content, register_fn)) + return labels, sorted(set(suites)) + + def _dispatch_err(suite, msg): """Build a detect_suite error result for the given suite.""" return { @@ -864,6 +891,20 @@ def detect_suite(file_path_from_test): ) ] + labels, suites = _extract_other_backends(content) + if labels: + backends = ", ".join(labels) + where = f" (suite `{suites[0]}`)" if suites else "" + return [ + _dispatch_err( + suites[0] if suites else None, + f"`{full_path}` is registered for {backends}{where}, not for " + f"CUDA or CPU; rerun-test.yml has no {backends} job. Rerun it " + f"with /rerun-failed-ci, or dispatch the {backends} workflow " + f"manually.", + ) + ] + return [ _dispatch_err( None,