From 5f343c65ca7938435216b4b3085186cffee43cf1 Mon Sep 17 00:00:00 2001 From: laoyao0822 Date: Sat, 30 May 2026 01:37:05 +0800 Subject: [PATCH] Keep EAGLE diagnostics from breaking disagg startup The C32 startup audit was diagnostic-only, but it incorrectly read spec_algorithm from helper queue objects. PrefillBootstrapQueue and DecodePreallocQueue keep scheduler-owned runtime state instead, so the debug path failed before KV manager initialization could complete.\n\nUse scheduler.spec_algorithm for both startup audits and record the ownership rule in the page-aligned cache ledger.\n\nConstraint: Queue helpers do not copy every scheduler field onto self.\nRejected: Disable EAGLE accept diagnostics | would lose the draft-transfer evidence needed for the accept-len investigation.\nConfidence: high\nScope-risk: narrow\nDirective: Disaggregation helper diagnostics should read scheduler-owned runtime state unless the constructor explicitly copied the field.\nTested: Local py_compile for prefill.py and decode.py.\nTested: Local git diff --check.\nTested: Synced prefill.py/decode.py to g0034 and remote container py_compile passed.\nNot-tested: Full disaggregated startup and ETE traffic after this fix; user controls runtime launch and load generation. --- ...sa_prefill_cp_page_aligned_cache_contract.md | 17 +++++++++++++++++ python/sglang/srt/disaggregation/decode.py | 2 +- python/sglang/srt/disaggregation/prefill.py | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md b/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md index c7b3b19f4..90bac0e9a 100644 --- a/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md +++ b/docs/advanced_features/nsa_prefill_cp_page_aligned_cache_contract.md @@ -1966,3 +1966,20 @@ C32 correction update: transfer surfaces are registered. - Synced `prefill.py` and `decode.py` to remote `g0034:/mnt/beegfs/cjy/sglang-dev`; remote container py_compile passed for the updated files. + +### C33. EAGLE accept startup diagnostic must read speculative config from scheduler-owned state + +Finding: + +- Enabling `SGLANG_EAGLE_ACCEPT_DEBUG=1` caused prefill startup to fail in `PrefillBootstrapQueue._init_kv_manager()` with `AttributeError: 'PrefillBootstrapQueue' object has no attribute 'spec_algorithm'`. +- The diagnostic added in C32 incorrectly assumed the bootstrap/prealloc queue objects expose `self.spec_algorithm`. They only retain `self.scheduler`; the speculative algorithm lives on `self.scheduler.spec_algorithm` in these queue classes. +- The same incorrect diagnostic reference existed in `DecodePreallocQueue._init_kv_manager()`, which would have produced the analogous decode startup failure under the same debug env. + +Correction: + +- Read `self.scheduler.spec_algorithm.is_eagle()` in both prefill and decode KV-manager startup audits. +- This is a diagnostic-path-only fix. It does not change KV registration, cache ownership, transfer, prefetch, or EAGLE acceptance behavior. + +Guardrail: + +- Future diagnostics inside disaggregation helper queues should use scheduler-owned runtime state unless the queue constructor explicitly copies that state onto `self`. diff --git a/python/sglang/srt/disaggregation/decode.py b/python/sglang/srt/disaggregation/decode.py index cfb9495b6..069983be2 100644 --- a/python/sglang/srt/disaggregation/decode.py +++ b/python/sglang/srt/disaggregation/decode.py @@ -509,7 +509,7 @@ class DecodePreallocQueue: len(kv_args.state_data_ptrs), ) - if envs.SGLANG_EAGLE_ACCEPT_DEBUG.get() and self.spec_algorithm.is_eagle(): + if envs.SGLANG_EAGLE_ACCEPT_DEBUG.get() and self.scheduler.spec_algorithm.is_eagle(): logger.info( "[EAGLE_ACCEPT_DEBUG] decode_kv_manager cp_rank=%s " "target_kv_bufs=%s draft_kv_bufs=%s total_kv_bufs=%s " diff --git a/python/sglang/srt/disaggregation/prefill.py b/python/sglang/srt/disaggregation/prefill.py index 21bc2407b..b47ba5948 100644 --- a/python/sglang/srt/disaggregation/prefill.py +++ b/python/sglang/srt/disaggregation/prefill.py @@ -350,7 +350,7 @@ class PrefillBootstrapQueue: len(kv_args.state_data_ptrs), ) - if envs.SGLANG_EAGLE_ACCEPT_DEBUG.get() and self.spec_algorithm.is_eagle(): + if envs.SGLANG_EAGLE_ACCEPT_DEBUG.get() and self.scheduler.spec_algorithm.is_eagle(): logger.info( "[EAGLE_ACCEPT_DEBUG] prefill_kv_manager cp_rank=%s " "target_kv_bufs=%s draft_kv_bufs=%s total_kv_bufs=%s "