Repository navigation
serve: --config FILE reads a start's flags from one JSON object, under the command line's - #982
Conversation
…r the command line's Each key is a flag's name without its dashes and its value the flag's: a string or a number, true for a switch, a list for a flag given more than once. The file's flags go in front of the command line's, and a flag the command line gives in any spelling replaces the file's entry for it, as does a flag that sets the same thing another way (the model's path and repo, the embedding model's, a projector and its off switch, the routed experts' place, --place and the flags that name cards), so the order is the command line, the file, llama-server's variables, the levers and the default. One line on stderr says what each entry was read as or which flag replaced it, never an API key's value. A file that is no JSON object, a key named twice, written with its dashes or naming an action, and a value of the wrong type are refused by name before the model is read; a key no seat takes is refused by the seat.
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix defect was found in the changed startup and JSON validation paths.
Non-blocking
⚠ Pin malformed-file refusals to exit 64: bloomery_serve.rs:694. The current branch correctly uses Code::Usage. Changing it to Code::Refused would leave all six new tests green: the executable tests use valid JSON, and the unit tests call joined directly.
Pin this public exit contract now. Insert before cleanup at serve_preflight.rs:468:
std::fs::write(&path, "{").unwrap();
checked_refusal_as(
"config-syntax",
&["--config", path.to_str().unwrap()],
&[],
"--config",
Code::Usage,
);Checked
Duplicates: 20 new or exposed items checked; no actionable duplicate. Keys reuses the existing visitor. The existing json_type helper has different boolean/type wording. Dryer reported zero pairs; gpu-gates was excluded and checked manually.
Complexity: joined is new at 22, combining file decoding/validation and override merging/notes; those are its split boundaries. run rose 66→68 through one startup error branch.
Silent failure: three absence/skip paths followed: file variant detection, CLI variant detection, and overridden entries. Invalid model values reach named parser errors; overridden entries are validated and reported.
Tests: static mutation check of all six new tests. Keeping replaced entries (serve_config.rs:105), dropping duplicate/type/action checks (:74/:133/:151), or dropping source equivalence (:92) makes assertions fail. Skipping expansion (bloomery_serve.rs:692) fails the process tests; removing source groups (serve_config.rs:36–38) fails their expected downstream errors. The exit-class mutant passes, as above. Tests were not executed.
Gates: no existing gate, tolerance or pin removed or relaxed; the recipe adds the configuration tests.
Escape catalog: C1–C4 checked; none match. The change adds no decode, prefill or kernel work.
Notes
The PR body has no FAIL-first output, nvidia-smi line, or just gate-* command output. Its reported test runs do not establish GPU evidence.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/lib.rs, crates/gpu-gates/src/llama_launch.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
bloomery-serve --config FILE로 서버 설정을 JSON 파일 하나에서 읽을 수 있게 했고, 명령줄이 파일보다 우선합니다.What and why
A server start with many flags had no way to be saved and reused.
bloomery-serve --config FILEreads a start's flags from one JSON object. A key is a flag name without its dashes ("ctx-size": 65536is--ctx-size 65536), a value is a string or a number, a switch istrue, and a flag that may repeat takes a list. The command line wins over the file, the file wins over theLLAMA_ARG_*variables, and those win over theBLOOMERY_*levers and the seat defaults. At start, each entry prints one line on stderr saying how it was read, or that the command line replaced it. API key values are never printed.The file's flags go through the same parsing and preflight as command-line flags, so a key no seat takes is refused by the seat's own
unknown argumenterror before any fetch or load. A file that is not a JSON object, a JSON syntax error, a key named twice, a key written with dashes, an action key (plan,levers,help,version,list-devices,records-schema,recommend,dry-run,json,config), afalse,null, object or empty-list value, a value given to a switch,truegiven to a flag that needs a value, and a second--configall exit 64 (usage) with a message that names the key and the file, before any model is read.docs/serving.mdhas a new "The settings file" section andREADME.mdone sentence.Release notes: Added:
bloomery-serve --config FILEreads the start's flags from a JSON file; the command line still wins.Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": the duplicate-key check incrates/gpu-gates/src/serve_config.rs:176uses the same serde visitor approach ascrates/serve/src/api.rs:1708. That one is a private function that reads only thelogit_biasobject of a request body, while this one reads the top-level keys of the file, so they do not share a body.What I ran
Tested head
aa1963c89b3c790b9c74f33bc2baf521ca1c8a87on base7163db37ff5c25f41870df1692bce5777536f22e, on a DGX Spark (NVIDIA GB10, driver 595.84) with the Qwen3.8 FP4-Local checkpoint (nvidia/Qwen3.8-Flash-Next-FP4-Local, revisionb9ce18a6887e18c089fdea8509a33e63429a3300). The duplicate-key check was added after this run and ran on its own at head74398a840f73cd7031a150959b95e9b4c1d251b2.Unit tests (
serve_config::,llama_launch::,llama_place::, with--features deepseek41,gemma-embedding2,hf --lib):Preflight tests (
--test serve_preflight), includinga_config_file_key_no_seat_takes_is_refused_before_the_fetch:A key no seat takes, with
{"model-file": "<model folder>", "ctx-size": 65536, "ctxx": 1}as the file. It exits 64 in 0 seconds, before the model loads:The command line wins. The file sets
ctx-sizeto 65536; with--ctx-size 32768 --planadded:The file alone (
--plan):Serving.
--config served.jsonand-m <model folder> --ctx-size 65536 --parallel 2 --port 18094 --alias q38-configboth came up (== serve file up=1,== serve flags up=1). The two/propsreplies differ only inengine.args, the command line itself;model_alias(q38-config),total_slots(2),n_ctx,default_generation_settings,model_pathandbuild_infoare the same.A key named twice, with
{"model-file": "<model folder>", "ctx-size": 65536, "ctx-size": 32768}as the file. It exits 64 before the load:cargo test -p gpu-gates --lib serve_config::on that head:test result: ok. 2 passed; 0 failed.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.