[Bugfix][Parser] Emit REASONING_END for Inkling tool calls that follow no thinking block (#50528)

Signed-off-by: Jason Yao <wsyjh8@gmail.com>
This commit is contained in:
Jason
2026-08-09 21:04:53 -04:00
committed by GitHub
parent 751f2ccdd3
commit 0820125ae9
4 changed files with 160 additions and 12 deletions
+14 -9
View File
@@ -342,16 +342,12 @@ class StreamingParserEngine:
self._in_skipped_tool_span = True
elif is_exit:
self._in_skipped_tool_span = False
if self.state == ParserState.MESSAGE_HEADER:
self.state = ParserState.CONTENT
leaving_message_header = self.state == ParserState.MESSAGE_HEADER
if leaving_message_header:
self._message_header_buffer = ""
return [
SemanticEvent(
EventType.TEXT_CHUNK,
value=value,
tool_index=self.tool_index,
)
]
# A tool terminal that implicitly ends reasoning must report
# that even from the header state, or the reasoning pass never
# hands the block to the tool pass.
if EventType.REASONING_END in transition.events:
self.state = ParserState.CONTENT
return [
@@ -366,6 +362,15 @@ class StreamingParserEngine:
tool_index=self.tool_index,
),
]
elif leaving_message_header:
self.state = ParserState.CONTENT
return [
SemanticEvent(
EventType.TEXT_CHUNK,
value=value,
tool_index=self.tool_index,
)
]
content_type = self.config.content_events.get(self.state)
if content_type is not None:
return [