PR #686: docs(api): document DeepSeek V4/V4.1 behavior for tool_choice required

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/24e02ab1-f58e-482c-a17c-d35d579e12f8

Opened by a workflow run, Dec 2, 2026 3:48 PM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: jcartu (GitHub association CONTRIBUTOR; 3 merged / 3 closed / 3 open PRs in 180 days; Discord: jcartu) Motivation: On DeepSeek V4/V4.1 cores in the default thinking mode, tool_choice: "required" is prompted exactly like "auto" — no "you must call a tool" instruction is added — but the docs said required mode always adds one. A maintainer triaged that asymmetry as deliberate and said the docs should say so; this PR rewrites that one paragraph. Scale: +14 / −8 lines in 1 file (docs/api.md) Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #686 docs(api): document DeepSeek V4/V4.1 behavior for tool_choice required

Charter alignment — strong. The charter's merge criteria explicitly include "bad docs," and this PR answers a maintainer request: yatesdr's triage on #445 states the documented behavior is "not true for these recipes. The docs should say so." It documents implemented behavior — no per-model branch is added, no request field is newly ignored — so it does not collide with the #417 "don't silently drop API fields" rule; the maintainer's position is that required is enforced at completion (encode.rs:685-689), not dropped. The only latent tension is that it puts prose around the existing renders_tool_choice per-encoder branch, which predates this PR (585702d3).

Novelty & status — genuinely additive. Not obsolete: docs/api.md:666-669 still carries the unconditional claim and no main commit since the branch point (c513e46) touches that file. Not superseded: #461 edits the adjacent named-selection region and #685 a different section; overlap is file-level only. The dossier verifies every new sentence against frontend/mod.rs:151-156, request.rs:465-476, deepseek.rs:272-280, encode.rs:685-689, and both named tests in deepseek_requests.rs.

Value vs maintenance cost — favorable. Docs-only, one file, +14/−8, no runtime, schema, or compatibility surface, no rebase needed. The behavior has been stable for over a month, and because DeepSeek V4/V4.1 default to thinking enabled (api.md:980-981), the caveat describes the default path rather than an edge case: a required request can terminate as "required tool choice was not satisfied" instead of a tool call. Review cost is near zero; the declared lack of a build/test run is immaterial for prose.

Gaps to close before merge (all small):

  1. docs/core-design.md:1727-1728 retains the old unconditional sentence and defers here at :1732 — the same edit, or a committed follow-up, is needed or the docs stay self-contradictory.
  2. Fixes #445 closes an issue whose behavioral half was declined; that decline should be recorded in the closing comment or the reference made non-closing.
  3. An undeclared but harmless rewrap of the adjacent Responses custom-tools lines (:679-681).
  4. Coordination with #461 is unstated; if both land, required mode is described across two separately authored paragraphs. (The TMLv0 qualification gap in docs/TODO.txt is pre-existing.)

Verdict: Worth it with changes.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Classify intake

Selected: triage:review, documentation, area:api, model:deepseek-v4, model:deepseek-v4.1

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review, +documentation, +area:api, +model:deepseek-v4, +model:deepseek-v4.1

Subtraction and simplicity

PR #686 is a one-hunk prose diff in docs/api.md (+14/−8); it introduces no flags, config knobs, wrappers, fallback branches, speculative generality, or dead code, and duplicates no repo helper. The subtraction lens therefore reduces to prose that can be deleted or collapsed.

Findings, high value first:

  1. should-fix, in the diff — docs/api.md:667-669 invents the category name "shared lowering" ("Prompt encoders using shared lowering (Jinja templates and TMLv0) add a system instruction … omit that shared instruction"), lifted from let shared_lowering = … at helios/src/server/request.rs:467 and helios/src/frontend/mod.rs:152-153; the phrase occurs nowhere else in docs/. It also makes "that shared instruction" a false definite. Since renders_tool_choice is true only for DeepseekV4|DeepseekV41 (frontend/mod.rs:151-156), the complement is exactly {Jinja, TmlV0}; name the encoders directly (api.md already does at :721-722, :980). Suggested rewrite also drops the redundant trailing clause "so generation starts inside the tool-call envelope" and folds the final sentence: 9 lines/~110 words → 7 lines/~90 words.
  2. should-fix, outside the diff — docs/core-design.md:1727-1728 keeps the old unconditional claim "tool_choice=required adds a prompt instruction and requires a completed call to a declared tool", while :1732 defers detail to api.md. After merge the design doc still asserts what this PR corrects. Subtractive fix: delete the false clause.
  3. minor — docs/api.md:671 "non-thinking (chat) mode" backticks a value api.md never documents (it comes from helios/src/frontend/deepseek.rs:181-190; :1005-1006 lists only rejections). Drop the parenthetical or name the option once.

Explicitly not findings: the rewrap of the Responses custom-tools lines (main :673-675 → head :679-681) is required reflow, not churn; the paragraph's restatement of completion validation is load-bearing for issue #445 and should be folded, not deleted; no code/test change belongs to this lens.

Open questions: whether yatesdr intends Fixes #445 to close an issue whose behavioural half was declined; whether core-design.md is fixed in a follow-up; coordination with #461, which edits the adjacent required-mode paragraph.

Full report · Notes

Correctness and contracts

PR #686 is a prose-only correction to docs/api.md:666-678 (one hunk, +14/−8), splitting the old unconditional "required adds a prompt instruction" claim into shared-lowering encoders (Jinja, TMLv0) versus the native DeepSeek V4/V4.1 encoders, which omit it. The new text, and the PR description's before/after, are accurate: every clause traces to helios/src/frontend/mod.rs:151-156, helios/src/server/request.rs:465-476 and :506-514, helios/src/frontend/deepseek.rs:272-280, helios/src/server/inference.rs:387-390, helios/src/server/protocol/encode.rs:685-689, and the tests helios/tests/deepseek_requests.rs:348-415 and :690-711. No runtime, wire, proto, admission, metric or cache path is touched, so the concurrency/contention, memory, failure-blast-radius, metric-span and platform-parity checks come back clean by construction.

Findings: (1) Major — docs/core-design.md:1727-1729 still says "tool_choice=required adds a prompt instruction and requires a completed call to a declared tool" unconditionally, the exact sentence the maintainer's #445 triage called false, and :1732 only defers to api.md at file level, so the two normative docs will contradict each other after merge; fix it in this PR. (2) Minor — docs/api.md:669-670 "render required mode identically to "auto"" is prompt identity only: with a strict tool the plan still sets require_call from request.tool_choice (helios/src/server/request.rs:277-281, helios/src/grammar/strict.rs:1829-1835) and helios/tests/deepseek_requests.rs:815 rejects plain prose; add one clause.

Open: whether Fixes #445 should close an issue whose behavioral half was declined, and whether core-design.md gets corrected here or in a follow-up.

Full report · Notes

Final review

Recommendation: Changes Requested

The new required-mode prose in docs/api.md is factually accurate against the implementation and test suite at 6a2cacc, and directly addresses the maintainer triage on #445 with zero runtime blast radius. However, docs/core-design.md:1727 still carries the exact unconditional statement this PR exists to fix, leaving the two normative docs contradicting each other while Fixes #445 closes the issue. Updating that one sentence in docs/core-design.md—and optionally dropping the unexplained internal shorthand ("shared lowering" / `chat`) in docs/api.md—will make the documentation consistent and ready to merge.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Update the contradicting unconditional claim in docs/core-design.md:1727-1728.
    • docs/core-design.md:1727-1728 still states unconditionally:

      `tool_choice=required` adds a prompt instruction and requires a completed call to a declared tool.

    • The pointer at docs/core-design.md:1732-1733 defers only "the accepted strict schema subset, parser formats, protocol mappings and streamed errors" to api.md, so it does not qualify or rescind :1727. Merging #686 with Fixes #445 leaves the core design specification contradicting docs/api.md on the exact sentence #445 flagged (violating .agents/skills/repo-prose/SKILL.md:26-27 (not opened)).
    • Fix: Remove the stale clause at docs/core-design.md:1727 (e.g., `tool_choice=required` requires a completed call to a declared tool. or note that Jinja/TMLv0 encoders also add a prompt instruction while native DeepSeek V4/V4.1 encoders do not; see docs/api.md).

Subtract / Simplify

  1. Drop internal implementation shorthand ("shared lowering") and undefined option spelling (`chat`) in docs/api.md:667-674.
    • "shared lowering" (docs/api.md:667) appears nowhere else in docs/; it is lifted from the local variable let shared_lowering = ... in helios/src/server/request.rs:467 (.agents/skills/repo-prose/SKILL.md:22-25 (not opened) advises against turning implementation shorthand into document vocabulary). Because PromptEncoder has only four variants (helios/src/frontend/mod.rs:142-149), naming the encoders directly is exhaustive and shorter.
    • Similarly, (`chat`) (docs/api.md:671) backticks the thinking_mode: "chat" value (helios/src/frontend/deepseek.rs:181-183), but thinking_mode is never defined anywhere in docs/api.md.
    • Suggested tightening for docs/api.md:666-674:
      Required mode needs at least one declared tool. Jinja-template and TMLv0 prompt
      encoders add a system instruction to call a tool to the prompt. The native
      DeepSeek V4 and V4.1 prompt encoders add none: in thinking mode they render
      required mode identically to `"auto"` so reasoning starts in `<think>`, and in
      non-thinking mode their template opens the DSML tool-call block at the end of
      the prompt so generation starts inside the tool-call envelope. In all modes,
      including DeepSeek thinking mode, completion validates that generation produced
      at least one completed call to a declared tool.
      

Nits

None.

Dropped on verification

Full report Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes decide malicious: all_clear (100%): No malicious content found

explore

Author: jcartu (CONTRIBUTOR; 3 merged / 3 closed / 3 open PRs in 180 days; Discord: jcartu) Motivation: Two normative docs claimed tool_choice: "required" always adds a prompt instruction, which is untrue for the native DeepSeek V4/V4.1 encoders. A maintainer triaged issue #445 as a docs gap, so this PR fixes the wording instead of the runtime. Scale: +13 / −5 in 2 files Proposal:

Full report · Notes

Classify intake

Selected: triage:review, documentation, area:api, model:deepseek-v4, model:deepseek-v4.1

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

No label changes

Subtraction and simplicity

The diff is lean and idiomatic for what it is: prose only, two files (docs/api.md +8/−3, docs/core-design.md +5/−2), no code, flags, wrappers, fallback branches, or dead code could be introduced or left behind, and no repo helper or abstraction is duplicated. The behavior the new prose describes matches the code vocabulary already used in api.md, and both docs follow .agents/skills/repo-prose/SKILL.md (not opened) (present-state specification, no chronology, no unexplained shorthand). Nothing blocks.

Highest-value trim: docs/core-design.md:1727-1730 restates, near-verbatim, the per-encoder required-mode rule that docs/api.md:666-674 already specifies in full, and links to it — while docs/core-design.md:1735 already points into api.md two sentences later. Collapsing the encoder clause to "prompt encoders differ in the instruction they add (see the API contracts link)" keeps one authoritative statement and removes the duplicate pointer, and incidentally removes the only occurrence of TMLv0 in core-design.md (a bare identifier with no local definition, against repo-prose SKILL.md:20-25). This is exactly the class of drift #445 reported.

Second, low: docs/api.md:670-672 ends with "so generation starts inside the tool-call envelope", which the preceding clause ("opens the DSML tool-call block at the end of the prompt") already implies — seven redundant words.

Third, no action: incidental wrap-point churn at docs/api.md:674 and docs/core-design.md:1731 is cosmetic and unavoidable in an insert.

Open questions: whether the unanchored api.md pointer at core-design.md:1735 should become anchorless-with-single-pointer or keep the new specific anchor (author's choice); whether a maintainer prefers core-design to hold only the invariant plus a pointer; no human review exists, and no CI ran on head 9ca1f72.

Full report · Notes

Correctness and contracts

Verdict: sound. No blockers, no majors — two Minor documentation nits on a prose-only diff (docs/api.md +8/−3, docs/core-design.md +5/−2 at 9ca1f72). Areas 1 and 2 (safety, concurrency, memory, failure propagation, platform parity) have no surface here and I say so rather than inventing findings.

Findings:

Open questions: #461 shares the same api.md paragraph (rebase-order only; pr/461 not in local copy); no human maintainer has reviewed; how GitHub renders the anchor was checked by reading, not rendering.

Full report · Notes

Re-review

Recommendation: Ready To Merge

PR #686 cleanly resolves both items from the prior review at head 9ca1f72 (9ca1f72bd0b40ead0fe13f20364fb876c6607295): docs/core-design.md is now aligned with docs/api.md, and the internal "shared lowering" / `chat` labels were removed. Every documented claim matches the verified runtime implementation and existing tests across Jinja-template, TMLv0, and native DeepSeek V4/V4.1 prompt encoders, with zero runtime or compatibility blast radius.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

None.

Subtract / Simplify

  1. (Optional) Avoid repeating the encoder list and api.md link in docs/core-design.md:1727-1736: The newly added link [API contracts](api.md#conversation-and-tool-semantics) at docs/core-design.md:1729-1730 appears five lines before the existing See the [API contracts](api.md) pointer at :1735, and TMLv0 appears only here in docs/core-design.md. If you want docs/api.md to remain the single authoritative enumeration of encoder behavior, you can optionally collapse :1727-1730 to:

    `tool_choice=required` requires a completed call to a declared tool; whether a system prompt instruction is added depends on the prompt encoder (see the [API contracts](api.md#conversation-and-tool-semantics)). Or simply drop the parenthetical link at :1729-1730 and keep :1735. Not required for merge.

Nits

None.

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (98%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.