The SGLang cookbook and SGLang itself now launch with `sglang serve`, but
--reference-script only matched `sglang.launch_server`, so a recipe copied
from the cookbook yielded no flags and the CLI exited 2.
Find where flags start with one rule for every framework: after
`python3 -m <module>`, or after `serve` when the token before it is the
vllm or sglang CLI. This replaces the separate vLLM branch, drops the
now-unread framework parameter of _extract_server_args, and keeps `sglang`
from being taken as the positional model.
Fixes #1933
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HktBcjPwjE7QgkA8MgKH6q
--reference-scriptmatched onlysglang.launch_serverfor SGLang. The SGLang cookbook (and SGLang's own warning, "'sglang serve' is the recommended entrypoint") usesglang serve, so a recipe copied from the cookbook produced no flags and the CLI exited 2. The marker list now includessglang serve, and the start of the flags is found by one rule for every framework (_flags_start): afterpython3 -m <module>, or afterservewhen the token before it is thevllm/sglangCLI. That replaces the vLLM-only branch in_extract_server_argsand removes its now-unreadframeworkparameter. Without the shared rule,sglangandservewould have been read as positionals andsglangrecorded as the model.test_parse_sglang_serve_entrypoint_as_the_cookbook_writes_it(multi-line cookbook form: flags kept,--host/--port/--model-pathdropped, model and env lifted) andtest_parse_serve_entrypoint_does_not_take_the_cli_name_for_the_model; both fail onmain. The 9 test files that touch reference scripts: 449 passed.ruffclean;code-metricsPASSED.Real recipe check: the GLM-5.2 MXFP4 MI355X cookbook recipe used in an 8 h run, in
sglang serveform, parses to the same 30 arg tokens,SGLANG_OPT_USE_TOPK_V2=1and model as the hand-convertedpython3 -m sglang.launch_serverform (identical: True); onmainthe serve form yields 0 tokens._extract_server_argscognitive complexity drops 54 → 40; the baseline entry is lowered accordingly._extract_server_argsis replaced by one entrypoint rule; existing vLLM /-mrecipes parse unchanged (existing tests).sglang serve ...) to--reference-scriptas-is. Before, it was rejected with "yields neither a flag nor an export" (or carried exports only) and had to be rewritten topython3 -m sglang.launch_serverby hand.🤖 Generated with Claude Code