Repository navigation
Conversation
Inkling2ToolParser._split splits a completion into blocks at <|message_model|> and starts a new block at every content marker. tml_renderers.renderers.Inkling2 ends a block only at <|end_message|>: a leading <|message_model|> is optional, and a later one, like a second content marker, is body text. A tool call that followed a text block without its <|end_message|>, or a tool-call marker inside a text or thinking block, came back as an OK call, where the reference keeps it as text. A block after <|end_message|> without <|message_model|> was dropped, where the reference parses it. Split blocks at <|end_message|> and read one content kind per block, from its first marker.
kalomaze
marked this pull request as ready for review
November 27, 2026 00:58
This branch has not been deployed
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.
Inkling2ToolParser._splitsplits a completion into blocks at<|message_model|>and starts a new block at every content marker.tml_renderers.renderers.Inkling2(0.4.2, as pinned in CI) ends a block only at<|end_message|>. A leading<|message_model|>is optional, and a later one, like a second content marker, is body text.So when a text block lacks its
<|end_message|>, a tool call after it comes back as anOKcall, where the reference keeps it as text. A tool-call marker inside a text or thinking block does the same. A caller runs a call that the reference parser never produces, and in RL the environment executes and rewards it with nothing marking it as malformed. In the other direction, a block after<|end_message|>without<|message_model|>is dropped, where the reference parses it.Fix
Split blocks at
<|end_message|>and read one content kind per block, from its first marker. A well-formed completion parses as before.Reproducer:
contenttml_renderers'Deleting the build directory.<|message_model|>bash<|content_invoke_tool_json|>{…}''Deleting the build directory.'bash {"cmd": "rm -rf build"},oktml_renderersTests
test_block_framing_matches_tmlintests/test_inkling_reference.pychecks content and tool calls againsttml_renderersfor both Inkling 2 checkpoints, in three cases:<|message_model|>inside an open text block, a tool-call marker inside a text block, and a block after<|end_message|>without<|message_model|>.test_tool_call_inside_thinking_blockintests/test_inkling2.pynow expects the reference result: the marker and body stay inreasoning_contentand there is no tool call.mainand pass with the change.-m "not model": 212 passed, 1 skipped.-m model -k inkling: 1,342 passed, 18 skipped.tests/test_inkling2.py,tests/test_inkling_reference.pyandtests/test_parsers.py: 100 passed, 6 skipped (the framing cases on the original Inkling checkpoints).ty check renderersreports the same 62 diagnostics asmain, none inparsers.py.Tool-call validation is unchanged.
Note
Fix
Inkling2ToolParser._splitto end blocks only at end-message tokensMacroscope summarized 9d52011.
Note
Medium Risk
Changes Inkling 2 parsing semantics for RL/training callers that relied on the old block splits; well-formed completions should be unchanged, but malformed samples will parse differently and may stop executing phantom tool calls.
Overview
Aligns Inkling 2 completion parsing with
tml_renderers:Inkling2ToolParser._splitnow segments on<|end_message|>only, not on repeated<|message_model|>or extra content-kind markers. A block’s type comes from its first marker; any later<|message_model|>or tool/thinking tokens inside the same block stay in text or reasoning, and at most one tool call is emitted per closed block.Behavior change: malformed or nested markers (e.g.
<|content_invoke_tool_json|>inside an open thinking block, or a second<|message_model|>before<|end_message|>) no longer produce spuriousOKtool calls. Blocks after<|end_message|>without a leading model token are no longer dropped.Tests are updated:
test_tool_call_inside_thinking_blockexpects reference reasoning text with no tool call; newtest_block_framing_matches_tmlcases assert content and tool calls match the reference parser.Reviewed by Cursor Bugbot for commit 9d52011. Bugbot is set up for automated code reviews on this repo. Configure here.