chore: request handler fix for sglang + deepseekv4 end to end + sglang chat processor fix for deepseek v4 tool calling - #8701
Merged
dmitry-tokarev-nv merged 2 commits intoApr 24, 2026
Conversation
dmitry-tokarev-nv
approved these changes
Apr 24, 2026
dmitry-tokarev-nv
merged commit Apr 24, 2026
d116e2a
into
codex/deepseek-v4-parsers
71 of 73 checks passed
This was referenced Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make SGLang-backed Dynamo run DeepSeek-V4 end-to-end. Two fixes:
DecodeWorkerHandlerpassesreturn_routed_expertsunconditionally toEngine.async_generate, which fails on SGLang builds that don't have the kwarg yet.tokenizer.apply_chat_templatepath produces wrong prompts for tool calls and thinking mode. DS-V4 needs SGLang's customencoding_dsv4.encode_messages.Changes
components/src/dynamo/sglang/_compat.pyensure_sglang_top_level_exports()— restoressgl.Engine/sgl.ServerArgson SGLang 0.5.x snapshots that don't re-export them.filter_supported_async_generate_kwargs(engine, kwargs)— inspectsEngine.async_generatesignature (cached) and drops kwargs the installed engine can't accept;**kwargssignatures pass through unchanged.components/src/dynamo/sglang/request_handlers/llm/decode_handler.pyreturn_routed_expertsthrough the filter at both prefill and decodeasync_generatecall sites.components/src/dynamo/frontend/sglang_prepost.pychat_template, and render viasglang.srt.entrypoints.openai.encoding_dsv4.encode_messages.chat_template_kwargs.thinking;reasoning_effortis clamped to{max, high, None}.tool_choice="none"and named tool choice) extracted into_filter_template_toolsso both paths share it.get_json_schema_constraint/parser.get_structure_constraint, which gainedparallel_tool_callsin a later release.components/src/dynamo/sglang/publisher.pyfrom __future__ import annotations.Tests
components/src/dynamo/frontend/tests/test_sglang_processor_unit.py(+316): DS-V4 detection, tool filtering, thinking / reasoning-effort, parallel-tool-calls wrapper.components/src/dynamo/sglang/tests/test_sglang_unit.py(+98): async_generate kwarg filter.Notes for reviewers
codex/deepseek-v4-parsers, notmain— confirm merge order so this doesn't land orphaned.ValueErrorat request time if the SGLang build lacksencoding_dsv4. Runtime-visible, not at startup — acceptable for now, flag if we'd rather fail fast at worker init.tokenizer.chat_template is NoneAND any ofmodel/ tool-call-parser / reasoning-parser normalizes to containdeepseekv4.Test plan
test_sglang_processor_unit.py,test_sglang_unit.py).tool_choice,tool_choice="none", and parallel calls.return_routed_expertssupport and one without — confirm no crash in either case.Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)