From db0fe370b72585d02ab775eaf19d5317ea819cd0 Mon Sep 17 00:00:00 2001 From: cctry Date: Mon, 3 Aug 2026 09:44:25 -0700 Subject: [PATCH] [PD] Fix false health-503 during decode retraction re-admission (#33118) --- python/sglang/srt/managers/scheduler.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python/sglang/srt/managers/scheduler.py b/python/sglang/srt/managers/scheduler.py index 69705dc72..573627ecd 100644 --- a/python/sglang/srt/managers/scheduler.py +++ b/python/sglang/srt/managers/scheduler.py @@ -3862,6 +3862,9 @@ class Scheduler( def on_idle(self): """Idle housekeeping: guard, check, metrics, reset, sleep.""" + # Flush any health-check signal deferred while the engine was busy. + self.maybe_send_health_check_signal() + if not self.is_fully_idle(): return @@ -3921,6 +3924,14 @@ class Scheduler( # Waiting queues: waiting + bootstrapping + preallocation + kv transfer (decode) idle &= len(self.waiting_queue) == 0 + if ( + for_health_check + and not self._engine_paused + and self.disaggregation_mode == DisaggregationMode.DECODE + and self.disagg_decode_prealloc_queue is not None + ): + idle &= len(self.disagg_decode_prealloc_queue.retracted_queue) == 0 + if not for_health_check: # Grammar queue and prefill inflight queue may not produce batch # results instantly, but they still indicate the server is not idle.