Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

read the SGLang parser flags from the shared Qwen table instead of inlining them (#4778)

[._.]/ Adam Eivy4f8df9c12848
diff --git a/docs/features/sglang-qwen38.md b/docs/features/sglang-qwen38.md
index db6d3a8b12..5b5532c9c4 100644
--- a/docs/features/sglang-qwen38.md
+++ b/docs/features/sglang-qwen38.md
@@ -92,10 +92,10 @@ services:
- "32768"
- "--max-prefill-tokens"
- "32768"
- - "--reasoning-parser"
- - "qwen3"
- "--tool-call-parser"
- "qwen3_coder"
+ - "--reasoning-parser"
+ - "qwen3"
- "--mamba-radix-cache-strategy"
- "extra_buffer"
- "--mamba-ssm-dtype"
@@ -116,6 +116,10 @@ services:
makes. This is the exact failure the 3090 bring-up hit.
- **`--reasoning-parser qwen3`** — the same class of silent failure for the
thinking block.
+
+ Both come from `parserFlagsFor('sglang')` in
+ [`server/lib/qwenAgentParsers.js`](../../server/lib/qwenAgentParsers.js), the one
+ table holding the per-runtime parser spellings. Change them there, not here.
- **`--mamba-full-memory-ratio 1.201`** — derived, not defaulted. Qwen3.8-27B is a
hybrid Gated DeltaNet model, so post-weight memory splits between a reserved GDN
state pool (which sets the concurrency ceiling) and the paged KV pool. The
diff --git a/server/lib/sglangQwenRecipe.js b/server/lib/sglangQwenRecipe.js
index 2fcf5370e9..f744990237 100644
--- a/server/lib/sglangQwenRecipe.js
+++ b/server/lib/sglangQwenRecipe.js
@@ -10,13 +10,18 @@
*
* **Three flags are load-bearing and silent when wrong.**
*
- * - `--tool-call-parser qwen3_coder` — SGLang's spelling. vLLM's is
- * `qwen3_xml`. Get it wrong (or omit it) and the server starts, answers, and
+ * - `--tool-call-parser` — SGLang spells it differently from vLLM for the very
+ * same model. Get it wrong (or omit it) and the server starts, answers, and
* returns raw markup with no `tool_calls` block: the agent narrates edits it
* never makes. This is the exact failure the 3090 bring-up hit, and the
* reason both parsers are baked into every cell below rather than left to an
* `EXTRA_ARGS` line an operator can forget.
- * - `--reasoning-parser qwen3` — same class of failure for the thinking block.
+ * - `--reasoning-parser` — same class of failure for the thinking block.
+ *
+ * Both come from `lib/qwenAgentParsers.js` via `parserFlagsFor('sglang')`,
+ * and neither spelling is typed here: that table is the one place they live,
+ * precisely so a third runtime cannot copy whichever doc it read first. A
+ * guard test there fails any file that retypes one.
* - `--mamba-full-memory-ratio` — see `mambaFullMemoryRatio` below. The
* cookbook default (`0.9`) under-sizes the GDN state pool for CoS-length
* prompts and silently clamps `max_running_requests` below the concurrency
@@ -44,6 +49,7 @@
*/
import { PORTS } from './ports.js';
+import { parserFlagsFor } from './qwenAgentParsers.js';
/** The official image. PortOS never builds an engine — same bar as the vLLM path. */
export const SGLANG_QWEN_IMAGE = 'lmsysorg/sglang:qwen38-27b';
@@ -294,9 +300,9 @@ export function buildSglangQwenRecipe({
...flagIf('--chunked-prefill-size', cell.chunkedPrefillSize),
...flagIf('--max-prefill-tokens', cell.maxPrefillTokens),
...flagIf('--max-running-requests', cell.maxRunningRequests),
- // Both parsers, always. See the file header for the silent failure.
- '--reasoning-parser', 'qwen3',
- '--tool-call-parser', 'qwen3_coder',
+ // Both parsers, always — read from the shared table rather than typed
+ // here. See the file header for the silent failure this prevents.
+ ...parserFlagsFor('sglang'),
'--mamba-radix-cache-strategy', radixStrategy,
'--mamba-ssm-dtype', ssmDtype,
'--mamba-full-memory-ratio', String(ratio),
diff --git a/server/lib/sglangQwenRecipe.test.js b/server/lib/sglangQwenRecipe.test.js
index 8c2f5dea77..4f87ebf3ec 100644
--- a/server/lib/sglangQwenRecipe.test.js
+++ b/server/lib/sglangQwenRecipe.test.js
@@ -14,6 +14,7 @@ import {
SGLANG_HARDWARE_IDS,
} from './sglangQwenRecipe.js';
import { PORTS } from './ports.js';
+import { parserFlagsFor, qwenAgentParsersFor } from './qwenAgentParsers.js';
const repoRoot = join(fileURLToPath(new URL('.', import.meta.url)), '..', '..');
@@ -81,8 +82,9 @@ describe('buildSglangQwenRecipe — the verified H200 cell', () => {
'--attention-backend', 'flashinfer',
'--chunked-prefill-size', '32768',
'--max-prefill-tokens', '32768',
- '--reasoning-parser', 'qwen3',
- '--tool-call-parser', 'qwen3_coder',
+ // Read from the shared table rather than retyped — the spellings live
+ // in exactly one file, and its own guard test enforces that.
+ ...parserFlagsFor('sglang'),
'--mamba-radix-cache-strategy', 'extra_buffer',
'--mamba-ssm-dtype', 'float32',
'--mamba-full-memory-ratio', '1.201',
@@ -104,14 +106,14 @@ describe('buildSglangQwenRecipe — the verified H200 cell', () => {
});
describe('buildSglangQwenRecipe — every cell', () => {
- it.each(SGLANG_HARDWARE_IDS)('%s bakes in both Qwen parsers', (hw) => {
- // The silent failure this whole table exists to prevent: the wrong (or a
- // missing) tool-call parser makes the server answer with raw markup and the
- // agent never edits a file. `qwen3_xml` is vLLM's spelling, not SGLang's.
- const { flags } = buildSglangQwenRecipe({ hw });
- expect(flags[flags.indexOf('--tool-call-parser') + 1]).toBe('qwen3_coder');
- expect(flags[flags.indexOf('--reasoning-parser') + 1]).toBe('qwen3');
- expect(flags).not.toContain('qwen3_xml');
+ it.each(SGLANG_HARDWARE_IDS)('%s carries SGLang\'s parsers, never vLLM\'s', (hw) => {
+ // The silent failure this table exists to prevent: the wrong (or a missing)
+ // tool-call parser makes the server answer with raw markup and the agent
+ // never edits a file. Both spellings are read from `qwenAgentParsers.js` —
+ // retyping either here is what its own guard test fails on.
+ const flags = buildSglangQwenRecipe({ hw }).flags;
+ expect(flags.join(' ')).toContain(parserFlagsFor('sglang').join(' '));
+ expect(flags).not.toContain(qwenAgentParsersFor('vllm').toolCallParser);
});
it.each(SGLANG_HARDWARE_IDS)('%s derives the mamba ratio rather than leaving 0.9', (hw) => {