Correctness, Contracts & System-Level Consequences review of PR #686 (head 9ca1f72)
Key findings
Verdict: sound. No blockers, no majors, no should-fix. Two Minor documentation nits. The diff is prose-only in two files (docs/api.md +8/−3, docs/core-design.md +5/−2, confirmed by pr_diff at 9ca1f72). There is no runtime, wire-schema, grammar, scheduler, cache, metric or admission surface in it, so lens areas 1 (correctness/safety/platform parity) and 2 (system-level consequences under load, failure propagation, memory, contention) are genuinely unaffected — stated plainly rather than filled with invented findings. What matters for this lens is whether the new normative text is true of the implementation and whether it creates a new contract claim the code does not honour. I traced every sentence to code and tests; one sentence is looser than the code, and one pointer is duplicated.
Findings
Minor 1 — docs/api.md:672-674: "Sampling is unchanged" is over-broad; the new prose omits the strict-tool grammar path
Severity: Minor. Citation: docs/api.md:672-674 at 9ca1f72bd0b40ead0fe13f20364fb876c6607295, against helios/src/server/request.rs:277-282.
Verbatim, docs/api.md:672-677 (the new text):
tool-call envelope. In all modes, including DeepSeek thinking mode, completion
validates that generation produced at least one completed call to a declared
tool. Sampling is unchanged; no calls are fabricated
and no retries are attempted. Missing calls, including output truncated before a
complete call, produce HTTP 500 for buffered requests or a terminal error event
for streams.
Verbatim, helios/src/server/request.rs:277-282:
allow_undeclared: request.tool_choice == ToolChoice::Auto,
require_call: matches!(
request.tool_choice,
ToolChoice::Required | ToolChoice::Named(_)
),
single_call: !request.parallel_tool_calls,
Impact. The new paragraph frames required mode as an output-side check ("completion validates…") plus "Sampling is unchanged". For DeepSeek V4/V4.1 with an active strict function tool, that is not the whole mechanism: ToolGrammarPlan sets require_call: true for Required, so the required-call requirement is also compiled into the decoding grammar for the whole generation, and docs/api.md:760-768 (unchanged, later in the same section) states that an active strict tool forces device-masked decoding at MTP width one with one step in flight. A reader who takes "Sampling is unchanged" literally for a strict-tool DeepSeek request will mis-model the request: with a strict tool, both the sampling path (speculative width / replay loop) and the grammar differ. This is the one place where the new text is looser than the code; it is a documentation-precision issue, not a behavioural bug, and it does not contradict any other sentence in the diff (the later paragraph still covers strict tools).
Concrete fix. Add a half-clause rather than new structure, e.g. after "Sampling is unchanged": "…unless an active strict tool also requires the call in the request grammar (see below)". Cheaper still: change "Sampling is unchanged" to "Without an active strict tool, sampling is unchanged". No cross-reference restructuring needed.
Minor 2 — docs/core-design.md:1729-1730: duplicate pointer to the same api.md section, two sentences apart
Severity: Minor. Citation: docs/core-design.md:1729-1730 and :1735 at 9ca1f72.
Verbatim, docs/core-design.md:1727-1736 (new text is 1727-1730):
`tool_choice=required` requires a completed call to a declared tool;
Jinja-template and TMLv0 prompt encoders also add a system prompt instruction,
while native DeepSeek V4 and V4.1 encoders do not (see the
[API contracts](api.md#conversation-and-tool-semantics)). Without a grammar it
uses ordinary sampling. Named tool
selection filters the definitions to that tool; it does not by itself enable a
grammar. The encoder requires a completed call to the selected tool and rejects
other tool names. It omits ordinary answer text but preserves reasoning and arguments.
`tool_choice=none` removes tools from the template. See the [API contracts](api.md)
for the accepted strict schema subset, parser formats, protocol mappings and streamed errors.
Impact. Two links to api.md in adjacent sentences, the second to the same document (broader anchor). Cosmetic only; the habit of precise anchors is good. The anchor itself is valid — docs/api.md:485 is ## Conversation and tool semantics (read at 9ca1f72), so the deep link resolves by inspection.
Concrete fix. Keep the precise deep link at :1729-1730 and demote the pre-existing one at :1735 to plain text ("See the API contracts for…"), or vice versa.
What I verified as accurate (no finding)
Every behavioural claim in the two hunks maps to code and existing tests at the PR head:
- "Jinja-template and TMLv0 prompt encoders add a system instruction."
helios/src/frontend/mod.rs:151-156—renders_tool_choiceismatches!(self, Self::DeepseekV4 | Self::DeepseekV41), and the enum at:140-149has exactly four variants (Jinja,DeepseekV4,DeepseekV41,TmlV0), so the doc's two-bucket split is exhaustive with no encoder left unclassified.helios/src/server/request.rs:467let shared_lowering = !frontend.prompt_encoder().renders_tool_choice();and:472-476pass the request'stool_choiceintotemplate_messagesonly whenshared_lowering;helios/src/server/inference.rs:387-390appends "You must call at least one of the provided tools in your next response. Choose the appropriate tool and arguments." - "Required mode needs at least one declared tool" (carried over, unchanged in meaning) —
helios/src/server/inference.rs:387-390path plushelios/src/frontend/deepseek.rs:272-273; testhelios/tests/deepseek_requests.rs:709assert!(fixture.prepare(json!({"tool_choice":"required","tools":[]})).is_err());. - "In thinking mode they render required mode identically to
autoso reasoning starts in<think>."helios/src/frontend/deepseek.rs:275-280(Required → Autowhenthinking_mode). Testhelios/tests/deepseek_requests.rs:689-711assertsrequired.rendered_prompt == automatic.rendered_prompt, equalprompt.tokens,OutputStart::Reasoning, andrendered_prompt.ends_with("<|Assistant|><think>"), across thinking defaults/enable_thinking:true/thinking_mode:"thinking". - "In non-thinking mode their template opens the DSML tool-call block at the end of the prompt." Test
helios/tests/deepseek_requests.rs:347-415assertsoutput.content.start == OutputStart::ToolBodyandrendered_prompt.trim_end().ends_with("<|DSML|tool_calls>")(V4) /"<|DSML| calls>"(V4.1), withenable_thinking:falseandtool_choice:"required". - "In all modes … completion validates that generation produced at least one completed call to a declared tool."
helios/src/server/protocol/encode.rs:582-584rejects an undeclared tool name whenevertool_choice != Auto, and:685-689errors with "required tool choice was not satisfied…" whenRequired | Named(_)produced no completed tools. This is the asymmetry the PR documents: the prompt is lowered toAutofor native DeepSeek, but the output-side validation still sees the semantictool_choice. (That the encoder is constructed with the semantic value was confirmed in research athelios/src/server/http.rs:366(not opened); this run I re-opened and re-verified onlyencode.rs:570-600and:670-700.)
Area-by-area disposition
- Area 1 — Correctness, safety, platform parity: unaffected. No code paths change; no panic, error-handling, reset/flag or metric path is touched. There is no Unix/Windows asymmetry to check in a Markdown diff.
- Area 2 — Unintended system-level consequences: none. The diff cannot alter lock/queue contention, memory amplification, buffering, failure blast radius or a small/partial-hit path. Notably it also does not create a per-model runtime branch (the charter's main concern, #267/#334) — it documents one that already exists at
helios/src/frontend/mod.rs:154-156andhelios/src/frontend/deepseek.rs:275-280. - Area 3 — Architecture, contracts, charter: compliant. No wire/proto/captured-graph/public contract is modified, so no owner sign-off gate applies. The change documents existing behaviour rather than changing a default, and matches the charter's "bad docs" merge criterion and the "don't silently ignore API fields" rule (#417) by stating the encoder-specific behaviour of
tool_choice: "required"instead of leaving it implied. No previously blocked design choice is re-landed. - Metric / rate / admission-pricing span check: not applicable. No
inbound_rate,estimated_seconds,worth_fetchingor any other sampled metric changes scope in this diff; no threshold downstream of a metric is touched. The only admission-adjacent construct mentioned by the new text (the strict-tool grammar plan athelios/src/server/request.rs:277-282, which governs device-masked width and the replay loop) is unchanged code, pre-existing, and already described atdocs/core-design.md:1723-1726. - Area 4 — Tests & claim accuracy: sound. The PR description's before/after claims match the diff exactly ("Before: api.md stated required mode adds an instruction … After: … splits by encoder") — confirmed against
pr_diff. Every cited test exists onmainand exercises the documented paths (helios/tests/deepseek_requests.rs:347-415,:689-711), so a docs-only change needs no new test. The declared limitation ("no build, test suite, or GPU execution was run") is accurate and harmless here; there is no CI evidence for9ca1f72, which for prose-only files is a non-issue and I am not raising it as a finding.
Observations that are not findings
Fixes #445closes an issue whose behavioural half was deliberately declined. The behaviour the issue asked for is intentionally absent (helios/src/frontend/deepseek.rs:275-280—Required → Autoin thinking mode), and yatesdr's triage in #445 redirects the fix to the docs ("this is deliberate, and the gap is in the docs… The docs should say so"). Merging therefore closes #445 as won't-fix-by-design while the "Expected" paragraph is satisfied only by prose. Defensible; worth a one-line note in the merge commit so the decision is recorded.docs/core-design.md:1730-1731"Without a grammar it uses ordinary sampling." This sentence is pre-existing but now directly follows a sentence about native DeepSeek encoders, which do attach a grammar in non-thinking mode. It still reads correctly (the qualifier is explicit), but it is the one spot where the new insertion slightly changes the surrounding rhythm. Optional tightening only; not a finding.#461overlap on the samedocs/api.mdrequired-mode paragraph (bot review measureddocs/api.md:562-575onpr/461vs666-678here, at6a2cacc).pr/461is not in the local copy, so I could not re-measure it. Plausibly a textual rebase-order conflict only, not a semantic one; confirm at merge time.
Open questions / could not verify
- Whether
api.md#conversation-and-tool-semanticsrenders as intended on GitHub — heading## Conversation and tool semanticsexists atdocs/api.md:485, verified by reading, not by rendering. #461's live hunks — unverifiable locally; the only outstanding merge-order question.- No human maintainer has reviewed any version of #686; the only review is the bot's, and yatesdr (who requested the doc fix in #445) has not commented.
- Tool caveat: reading files at ref
pr/686earlier returned the pre-push (6a2cacc) content of both docs whilepr_files/pr_diffshowed the new state, so all line numbers above were pinned to commit9ca1f72bd0b40ead0fe13f20364fb876c6607295and re-read this run.