Control: a model whose draft layer is off keeps the server's own "without the draft layer" step; the app's first-load test shape

Follow-up to 519c7e8c0 and af9b832fd, found by tools/check on Boston (compared with main there):
- drafting.apply took --mtp out itself for a model DFlash2 is not for when "mtp" is false, so serve/server.py's draft-layer step had
  nothing left to remove and its line ("mtp": false - starting without the draft layer) was gone (serve/test_draft_layer). With
  "mtp": false the server's step takes the layer out again; "drafting": "off" alone is still taken out in apply.
- apps/host/tests/drafting.test.mjs reads the load's MTP condition from the source; it now includes the first load after a setup.
This commit is contained in:
Niko1221 committed 2026-11-10 01:49:32 +01:00
1 parent 81f7422c11
commit e481f3b6b9
3 files changed
+8 -6

No files matched your search

+1 -1
View File
@@ -74,7 +74,7 @@ test('a load fetches the drafter first, never stops for it, and says what ran',
assert.match(prepare, /control\.draftingFetch\(/);
assert.match(prepare, /catch\(error\)\{if\(job\.state==='running'\)\{job\.drafterNote=error\.message;/, 'a failed download leaves the MTP and the job says so');
assert.match(source, /await prepareDrafter\(job,args,cfg,configFile,drafts,\{noSplit\}\)/);
assert.match(source, /drafts\?\.mtp_needed===true&&\(args\.values\?\.drafting!==undefined\|\|drafts\.split===true&&[\s\S]*?\{[\s\S]*?await installMtpLayer/, 'a switch to the MTP fetches its layer once, from the Models screen own Load (and a plain Auto load when the plan says split)');
assert.match(source, /drafts\?\.mtp_needed===true&&\(args\.values\?\.drafting!==undefined\|\|\(drafts\.split===true\|\|args\.firstLoad===true\)&&[\s\S]*?\{[\s\S]*?await installMtpLayer/, 'a switch to the MTP fetches its layer once, from the Models screen own Load (and a plain Auto load when the plan says split, or the first load after a setup)');
assert.match(source, /async function noteDrafting\(job,instance,key\)/);
assert.match(source, /instance\.status='ready';instance\.phase='idle';await noteDrafting\(job,instance,key\)/);
assert.match(source, /typeof choice==='string'&&typeof control\.draftingPlan==='function'/, 'the plan lists the drafter Control says is needed');
+2 -1
View File
@@ -1119,7 +1119,8 @@ def apply(cfg: dict[str, Any], *, klass: str = "other", data_dir: str | Path | N
if not supported_model(cfg.get("model_name"), family): # another model: its drafting is not this choice's business (DeepSeek, Swift, Coder, NVFP4, Qwen3.6...)
asked = normalize(cfg.get("drafting"))
if asked == "off" or cfg.get("mtp") is False: # no drafter for this model (its draft layer is off, or a feed model whose entry says drafter: none): say so, start none
cfg["args"] = strip_mtp_flags(strip_draft_flags(args))
# "mtp": false: the server's own draft-layer step takes the layer out (and says so); "drafting": "off" alone: taken out here
cfg["args"] = strip_draft_flags(args) if cfg.get("mtp") is False else strip_mtp_flags(strip_draft_flags(args))
return Decision(asked, "off")
if asked == "dflash2":
cfg["args"] = strip_draft_flags(args)
@@ -11,12 +11,13 @@ def _cfg(**kw):
def test_a_feed_model_with_no_draft_layer_starts_with_no_drafter():
from serve.server import engine_args
for extra in ({"mtp": False, "drafting": "off"}, {"mtp": False}, {"drafting": "off"}):
cfg = _cfg(**extra)
d = drafting.apply(cfg, backend="cuda", archs=["sm_86"])
d = drafting.apply(_cfg(**extra), backend="cuda", archs=["sm_86"])
assert d.drafter == "off", extra
assert "--mtp" not in cfg["args"] and "--spec-min-p" not in cfg["args"]
assert cfg["args"][-2:] == ["--max-context", "32768"]
started = engine_args(_cfg(**extra), announce=False) # what the server starts: no draft layer, whichever key said so
assert "--mtp" not in started and "--spec-min-p" not in started, extra
assert started[started.index("--max-context") + 1] == "32768"
def test_other_models_keep_their_decision():