Repository navigation
[Engine] Inkling 2: honour a forced tool call when thinking is on - #212
Open
okada-shogo wants to merge 1 commit into
Open
okada-shogo wants to merge 1 commit into
okada-shogo wants to merge 1 commit into
Conversation
With thinking on, a named tool_choice (or "required" with one tool) was never
honoured for Inkling 2: Service._run writes the call's opening when
parser.state is "content" between blocks, but InklingOutputParser kept
OutputParser's initial state ("reasoning") for the whole reply, so the model
answered in text and no call was made. The same stale state counted every
token of the reply as a thinking token.
InklingOutputParser.state now follows its mode: "reasoning" in a thinking block,
"content" between blocks, "text" inside a text block. The opening is written
right after the closed thinking block, without the blank line other formats put
before a call (an Inkling block is a message of its own).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
okada-shogo
marked this pull request as ready for review
November 22, 2026 21:27
okada-shogo
added a commit
to okada-shogo/PolyStrata
that referenced
this pull request
Nov 23, 2026
…ll when thinking is on Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and result
With thinking on,
tool_choicenaming a tool (or"required"with one tool) did nothing for Inkling 2: the modelanswered in text and made no call. The same bug counted every reply token as a thinking token.
tool_choice: get_weather)I cannot check weather.get_weather({'city': 'Rome'})reasoning_tokensThinking off is unchanged (the prompt already ends with the call's opening).
Related discussion
Split out of #200, as the maintainer asked there:
#200 (comment)
The bug was found by the Inkling 2 golden tests, which follow in a separate draft PR (
port/serve-fixtures).Approach
Service._runwrites the forced call's opening whenparser.state == "content"(between blocks).InklingOutputParsernever updatedstate: it stayed"reasoning"for the whole reply.InklingOutputParser.statenow follows its mode:reasoningin a thinking block,contentbetween blocks,textin a text block.own message).
Validation
Passed:
cd terminal && ../.venv/bin/python -m unittest serve.test_inkling serve.test_server(CPU only, MockEngine):main 477 tests OK; this branch 479 tests OK.
serve.test_family_parsers,test_lfm2,test_flint,test_gemma,test_prompt_encoder,test_stop_holdback,test_responses,test_tool_addition,test_tool_markup_retry,tools.test_strata_ornith122,tools.test_tokenizer_plain_spans,tools.test_setup_inkling,tools.test_hy4_tokenizer): 211 OK (1 skipped), the same on main and on this branch.Failed: On unchanged main d1f711e, serve.test_inkling + serve.test_server failed 1 of 477 once in 3 runs (the output didn't name the test; it is intermittent on main itself, not in this change). The branch runs passed every time.
Not run: a run with the real model on a GPU (the check above drives the service with scripted replies).
Limits
Credits: VecSzn's forced-call path for Inkling 2 on main.
🤖 Generated with Claude Code