Two assertions could not fail: "report" in the research user message
matched other words, and the question number check passed for any digit
near the template heading. They now look for the rendered mode
(``report``) and for "#n of 3" / "第 n/3 道". The research forced-finish
docstring said tool_choice="none" while the test asserts "auto".
Refs #2974
The forced FINISH round keeps the loop's tools, so the model may still
call one. That call is not run, and the assistant turn added before the
repair note had empty content plus the round's reasoning or thinking
blocks. Anthropic rejects an empty text block, so the turn now carries a
short note ("Tool call not run: this round must finish.") when the round
returned tool calls and no text. Rounds that returned text are unchanged.
Refs #2974
The research block already tests the case where the model calls a tool
in the forced FINISH round; deep_question's _force_finish had no such
test. The new test checks that both requests carry the tools, the call
is not dispatched (no tool or tool_calls messages) and the repair note
is appended before the second attempt.
Refs #2974
When a research block or a deep_question explore/quiz loop runs out of
rounds, the forced FINISH request was sent with no tools. Removing the
tools changes the first bytes of the request, so none of the block's
history is served from the provider cache. In a real deep_research run a
block's forced finish paid 28.6k and 279.8k uncached tokens.
The forced rounds now send the loop's tool schemas unchanged; the prompt
already tells the model to stop calling tools. tool_choice="none" is not
used because DeepSeek renders it like no tools (replayed: 1,152 cached
tokens with "none" or no tools, 14,976 with the tools left as they were).
A tool call in a forced round is not dispatched; it fails the attempt and
gets the existing repair note.
Refs #2974