Explore scratchpad · NVIDIA/hyperflare-inference #686

Raw Markdown for agents: https://autobot.eidonix.com/p/331f97c6-59af-4b88-b8a3-7766ee9b574d.md

#1 [high] Change: docs/api.md required-mode paragraph rewritten, +14/−8, one file

PR #686 (jcartu, branch docs/deepseek-required-tool-choice, head 6a2cacc, base main, opened 2026-12-02 20:47) changes only docs/api.md (+14/−8). Single hunk.

Before (main, docs/api.md:666-669): "Required mode needs at least one declared tool, adds an instruction to call a tool to the prompt, and validates that generation produced at least one completed call to a declared tool."

After (PR head, docs/api.md:666-678):

Undeclared but harmless: the same hunk re-wraps the adjacent lines "Responses also supports text custom tools by presenting a JSON { "input": string } function…" (main :673-675 → head :679-681). No other hunk, no code, schema or test change. Nothing in the description claims more than the diff does.

Description is complete in the four required parts (why / what / expected result / evidence + limitation that no build or test was run) per AGENTS.md:72-80.

#2 [high] Claims verified: every statement in the new paragraph matches code and tests

Verified against head 6a2cacc:

  1. "shared lowering (Jinja templates and TMLv0)" — PromptEncoder::renders_tool_choice() returns true only for DeepseekV4 | DeepseekV41 (helios/src/frontend/mod.rs:154-156), and the doc comment at :152-153 says self-rendering encoders get their own syntax while "other encoders receive the shared instruction messages instead". shared_lowering = !frontend.prompt_encoder().renders_tool_choice() at helios/src/server/request.rs:467 → true for Jinja (0) and TmlV0 (3). Accurate.

  2. "…add a system instruction to call a tool" — template_messages appends it only for ToolChoice::Required (helios/src/server/inference.rs:387-390, text "You must call at least one of the provided tools in your next response. Choose the appropriate tool and arguments."), via append_system_instruction (helios/src/server/inference.rs:445-462) which prepends/merges into the leading system message. TMLv0 has a system frame kind (helios/src/frontend/tml.rs:424-425), so the instruction is expressible there. Accurate.

  3. "DeepSeek thinking mode renders required identically to auto" — request.rs passes ToolChoice::Auto to template_messages for non-shared encoders (helios/src/server/request.rs:472-476) and still puts "required" into template options (:506-514); helios/src/frontend/deepseek.rs:220-234 parses it, :272-274 rejects required with no tools, and :275-280 downgrades ToolChoice::Required → Auto only when thinking_mode ("Required calls are checked at completion; thinking starts before the tool block"). Tests: helios/tests/deepseek_requests.rs:690-711 asserts required.rendered_prompt == automatic.rendered_prompt and tokens equal, output.content.start == OutputStart::Reasoning, prompt ends <|Assistant|><think>, for V4 and V4.1 across {}, {enable_thinking:true}, {thinking_mode:"thinking"}; also asserts required with empty tools errors.

  4. "non-thinking (chat) mode opens the DSML tool-call block at the end of the prompt" — test helios/tests/deepseek_requests.rs:348-415: with enable_thinking:false + tool_choice required, output.content.start == OutputStart::ToolBody, rendered prompt trim_end ends with <|DSML|tool_calls> (V4) / <|DSML| calls> (V41); an "auto" control request instead accepts text {"ok":true} while required rejects it. Output-start detection lives in helios/src/model/prompt.rs:357-371 (DSML calls opener at prompt end + not ordinary text → ToolBody).

  5. "completion validates at least one completed call to a declared tool in all modes" — Encoder::finish errors "required tool choice was not satisfied: the model did not produce a completed tool call" for Required|Named when !outputs[index].has_tools() (helios/src/server/protocol/encode.rs:685-689); undeclared names are rejected for any non-Auto choice at encode.rs:582-584. Because the DeepSeek downgrade happens only inside the frontend's option parse, the server-side request.tool_choice stays Required, so both checks apply in thinking mode. This is exactly the point the issue reporter missed = the requirement is enforced post-hoc, not dropped.

#3 [high] Why: #445, triaged by a maintainer as a docs gap, fix directed at docs/api.md

Issue #445 (shieldstar, opened 2026-11-21 18:26, label area:api, still open) reported that tool_choice: "required" is "dropped" on DeepSeek V4/V4.1 in thinking mode: the server sees renders_tool_choice()==true, stops sending shared instruction messages and passes ToolChoice::Auto (issue cites helios/src/server/request.rs:336, :341-345, inference.rs:378-380, frontend/mod.rs:154-156, docs/api.md:493-495 at commit 25b49519).

Same-day triage by yatesdr (2026-11-21 18:38, issue's only comment) at main 21a40f05: "For DeepSeek V4 and V4.1 this is deliberate, and the gap is in the docs." Points at helios/src/frontend/deepseek.rs:275-280 ("Required calls are checked at completion"; commit 585702d3), test tests/deepseek_requests.rs:690, Encoder::finish failing with "required tool choice was not satisfied" (helios/src/server/protocol/encode.rs:553-557), and says docs/api.md:537-540 "says required mode 'adds an instruction to call a tool to the prompt', which is not true for these recipes. The docs should say so."

So #686 implements a maintainer's explicit "the docs should say so" instruction — not an unsolicited doc rewrite. It fixes the documentation half of #445; the behavioral complaint (prompt differs between required and auto) is deliberately left as-is, and the issue remains open (#686 says "Fixes #445", so merging would close an issue whose behavioral request was declined).

History of the deliberate behavior: commit 585702d3 (Luke Alonso, 2026-10-29) "Allow required DeepSeek tool choices with thinking" — the only commit on helios/src/frontend/deepseek.rs that introduced the downgrade; the DeepSeek native encoders themselves came from 2a4fcb9f (2026-10-19) "Use official DeepSeek Rust prompt encoders" and ac7bfa9a (2026-10-29) "Integrate DeepSeek recipe 0.2 prompt and streaming APIs".

#4 [high] Undone by omission: docs/core-design.md:1727-1728 keeps the unconditional required-mode claim

docs/core-design.md:1727-1728 still reads: "tool_choice=required adds a prompt instruction and requires a completed call to a declared tool. Without a grammar it uses ordinary sampling." — the same unconditional claim #686 removes from docs/api.md. Two lines later (:1732) the design doc defers details to the API contracts ("See the API contracts"). #686 does not touch docs/core-design.md, so after this PR the design doc contradicts api.md for DeepSeek V4/V4.1; a reader of core-design.md keeps the original inaccurate statement.

Cross-references that also remain unconditional:

#11 [high] Research summary

Case file gathered for #686 (docs-only, one file, +14/−8 in docs/api.md). Ten scratchpad entries cover all eight angles.

Key findings a reader cannot get from the description:

  1. The fix is exactly a maintainer's written instruction. yatesdr triaged #445 the same day it was filed (2026-11-21 18:38): "For DeepSeek V4 and V4.1 this is deliberate, and the gap is in the docs… The docs should say so." #686 implements that, so it sits inside the charter's "bad docs" merge gate. But it says "Fixes #445", which would close an issue whose behavioral request (make required differ from auto) was declined — reading the docs fix as closing the behavioral complaint is the one mismatch worth flagging.
  2. Every new sentence verified true against PromptEncoder::renders_tool_choice (frontend/mod.rs:154-156), template_inputs (server/request.rs:467, 472-476), template_messages' instruction (server/inference.rs:387-390), the DeepSeek downgrade (frontend/deepseek.rs:275-280), Encoder::finish enforcement (protocol/encode.rs:685-689), and tests deepseek_requests.rs:348-415 / :690-711.
  3. Undeclared but harmless: the same hunk re-wraps the following "Responses also supports text custom tools" lines; nothing else changed, nothing claimed that was not done.
  4. Not fixed by this PR: docs/core-design.md:1727-1728 still states the old unconditional "tool_choice=required adds a prompt instruction", so after merge the two documents disagree.
  5. Overlap: #461 (same author, open, changes requested) edits the adjacent required/named-selection sentences; #685 (open, same day) rewrites docs/api.md:540-575. No textual conflict with #686's :666-680 hunk.
  6. Process gaps: zero reviews/comments/labels/reactions, and no CI checks on head 6a2cacc even though native-serving.yml triggers on all pull_request events with no path filter; the description declares no build or test was run (appropriate for prose-only).

Also recorded: origin commit 585702d3 (Luke Alonso, "Allow required DeepSeek tool choices with thinking"), author history (#418 precursor; #404 closed), DeepSeek frontend ownership, reach on DeepSeek V4/V4.1 clients (thinking is the default, so the caveat is routine traffic), the #417 "don't silently drop API fields" tension, and the prefix-cache/echo implication of required-vs-auto prompts in chat mode.

#12 [high] Tension: "Fixes #445" closes an issue whose behavioral request was declined

#445 asks for two things (its "Suggested fix", issue body): (a) behavioral — "either pass ToolChoice::Required through to the encoder's own tool-choice syntax, or keep the shared instruction for required and let the encoder add its own syntax on top"; and (b) docs — "Also state the DeepSeek behaviour in the tool_choice documentation at docs/api.md:493-495."

yatesdr's triage (2026-11-21 18:38, issue's only comment) declines (a) as deliberate and endorses (b) as the fix. #686 declares "Fixes #445" in its description and is linked from the issue as [fixes].

Consequence worth flagging to deciders: merging with that keyword closes an issue whose primary complaint (required is prompted exactly like auto) remains true by design. The docs now disclose it, but the issue's own "Expected" paragraph — "the prompt seen by the model for required should differ from the prompt for auto" — is not satisfied and will not be recorded anywhere as an accepted design decision except this new paragraph. A reviewer may want the issue kept open or a maintainer note added rather than auto-closed. Purely a bookkeeping/decision point; the diff itself contains no behavior change (verified: docs-only, one hunk).

#14 [high] Claims and evidence: what the description asserts, what backs it, what is unbacked

Claims in the PR description, with their backing:

Claim Backing found
renders_tool_choice returns true for DeepseekV4 and DeepseekV41 and bypasses shared lowering in template_inputs Verified: helios/src/frontend/mod.rs:154-156 (only those two variants); helios/src/server/request.rs:467 shared_lowering = !…renders_tool_choice()
In thinking mode the frontend passes ToolChoice::Auto so reasoning begins in <think> with no added instruction Verified: helios/src/frontend/deepseek.rs:275-280; test deepseek_requests.rs:690-711 asserts rendered prompt/tokens identical to auto and ends <|Assistant|><think>
In non-thinking (chat) mode the template opens the DSML tool-call block at the end of the prompt Verified: test deepseek_requests.rs:348-415 (OutputStart::ToolBody, prompt trim_end ends <|DSML|tool_calls> / <|DSML| calls>, auto control accepts text instead); detection in helios/src/model/prompt.rs:357-371
Shared lowering encoders (Jinja, TMLv0) add a system instruction Verified: server/inference.rs:387-390 + append_system_instruction :445-462; TMLv0 has a system frame (frontend/tml.rs:424-425)
Completion enforces a completed declared call in all modes Verified: protocol/encode.rs:685-689 (Required
"No runtime code, schemas, or compatibility contracts changed" Verified by the diff: docs/api.md only, one hunk
Evidence pointers named in the description (mod.rs, request.rs, inference.rs, deepseek.rs, encode.rs, the two test names) All exist and say what is claimed; no mis-citation found
Limitation: no build/test/GPU run Consistent with the change; nothing in the diff can affect compilation or runtime, and comparable docs PRs (#461) ran only a narrow lib test

Nothing claimed is unbacked. What is not demonstrated anywhere: that the new wording reads correctly for TMLv0 in practice on a served Inkling 2 core — docs/TODO.txt:12-15 still tracks qualifying strict: true tools on a TMLv0 core, so the TMLv0 half of the first new sentence describes a path that has not been end-to-end qualified for tools. That is a small, pre-existing qualification gap the new text inherits by naming TMLv0 explicitly.

#5 [medium] Related work: #461 (same author, same section) and #685 (same file) overlap in file only

Both open, both edit docs/api.md, no textual overlap with #686's hunk (docs/api.md:666-680 on the PR head):

Note the sentence immediately preceding the hunk at docs/api.md:663-666 ("Tagged parameters … DeepSeek retains the original text of a string="false" parameter … Invalid JSON in a whole argument document or a typed XTML value fails parsing") is the doc text maintained by #359/#364/#578 lineage; #686 leaves it intact.

#6 [medium] People: jcartu's docs/DeepSeek series; DeepSeek frontend owned by Luke Alonso

jcartu, GitHub association CONTRIBUTOR (not one of the charter's priority contributors: @voipmonitor, @original-el8, @lukealonso — charter "Respect contributors"/AGENTS.md). Last 180 days: 3 merged, 3 closed, 3 open. Merged: #505 "Bind core-declared FP32 parameters into text forward graphs", #416 "Refresh host prefix-cache recency on request completion", #418 "Add strict function-tool schemas for DSML, Qwen, GLM and TML parsers" (2026-11-22, commit 0b09434d). Areas touched: docs (3), helios/src (3), heliopause/src (1), helios (1), helios/proto (1).

#418 is the direct precursor: it introduced the strict-tool grammar/admission work and updated the same api.md tool section (its review thread flagged missing sentences about named/required selection attaching a grammar, which #461 then wrote). So #686's DeepSeek required-mode text is the third iteration of the same author documenting required-mode semantics in this file.

Open siblings: #461 (docs: strict tool selection and numeric range precision, changes requested), #621 (scheduler admission vs core parameter declarations), #642 (ignition relocate_inductor). Closed: #520, #517, #404 (per-request activation steering for DeepSeek V4.1 cores — rejected/closed, showing prior DeepSeek-specific proposals from this author were not merged).

Who usually works these areas: docs commits in the last 180 days are Luke Alonso (391), Martin Vit (55), yatesdr (49). The DeepSeek frontend itself is Luke Alonso's (2a4fcb9f, ac7bfa9a, 585702d3) and Martin Vit's (tool parsing: #359, #364). yatesdr is the reviewer who triaged #445 and requested this doc change; he has not commented on #686.

#7 [medium] Process: ready, no reviews, no labels, no CI checks on head despite the pull_request trigger

Process (as of 2026-12-02, the day it opened): open, "ready for review" (not draft), 1 file +14/−8, head 6a2cacc, base c513e46. Zero reviews, zero comments (discussion empty), no labels, no reactions. CI: no checks on head 6a2cacc even though .github/workflows/native-serving.yml triggers on every pull_request (:6-7) and would build the release CLI and run the full helios test target on Linux and Windows (:43-68) — a docs-only change runs that whole pipeline because the workflow has no path filter.

Branch freshness: orientation packet reports no commits on main since the branch point touching docs/api.md, and git shows main's tip content at docs/api.md:655-686 identical to the PR's "before" text, so the PR is current (no rebase needed).

Missing evidence, declared: the description's own limitation — "no build, test suite, or GPU execution was run on this branch". For a docs-only diff this is consistent with practice on other docs PRs (e.g. #461 ran only lib grammar tests), and the change cannot affect build or runtime. What is not shown: a rendered check that the new sentence reads correctly in place, or that any doc link/table is unaffected — trivial here.

Prose/format: conforms to the repo's ~78-80 column wrapping of api.md, present tense, no conversation history, no unexplained identifiers; names PromptEncoder variants correctly ("DeepSeek V4 and V4.1" as opposed to enum spelling DeepseekV4), consistent with existing api.md usage at :980. PR description answers the four required questions in order (why / what / expected result / evidence + limitation), per AGENTS.md:72-80, and follows the charter's four-part description standard.

#8 [medium] Community: no comments, reviews or reactions; no Autobot case file posted

Community: no comments, no reviews, no reactions, no linked Discord discussion beyond the author's own "Discord: jcartu" line. Only engagement in the chain is yatesdr's 2026-11-21 triage comment on #445 itself, which #686 now implements; the issue has that single comment. So interest is: one maintainer's written request plus one contributor acting on it, one day short of two weeks later — nothing organic around the PR itself yet. Autobot has not posted a case file on #686 (unlike #685 and #461, both of which got one within minutes/hours), which is itself a sign the PR has had no automated or human traffic yet.

#9 [medium] Project fit: charter accepts "bad docs"; the #417 don't-drop-fields rule is the tension #686 resolves in prose

Charter fits:

#10 [medium] Reach: DeepSeek V4/V4.1 required-mode clients, thinking is the default; auto/required share a section

Who/what is affected:

#13 [medium] Recent activity: the tool-semantics section was rewritten repeatedly in the two weeks before this PR

docs/api.md on main has been touched daily in the last week (docs area owners: Luke Alonso 391, Martin Vit 55, yatesdr 49 commits/180d). Merged in the ten days before #686's branch point, each adding to the same "Conversation and tool semantics" section:

DeepSeek frontend: no commit to helios/src/frontend/deepseek.rs since 71fed07b (yatesdr, 2026-11-19 "Keep request token spellings literal in Jinja prompts"); the required/thinking downgrade itself is untouched since 585702d3 (Luke Alonso, 2026-10-29). So #686 documents behavior that has been stable for over a month and that other recent DeepSeek merges (#578, #573) left alone. Nothing in recent activity conflicts with, reverses, or supersedes it; the only interaction is with still-open #461 and #685 editing the same file.

#15 [medium] File map: the two paragraphs of docs/api.md:640-702 and where #686 sits in them

docs/api.md, section "Conversation and tool semantics" (heading at :485 on main / same on head):

#685 rewrites roughly docs/api.md:540-575 (DSML streaming, per its own diff at PR head :650-682 region for the arguments paragraph) — different paragraphs, no conflict.