Repository navigation
Conversation
A finished reply whose last scope is never closed keeps a call complete through `</function>` and drops a scope cut off before its call ends. An argument the tool declares as a string keeps its value as generated. With `ToolChoice.required`, the grammar lets a thought and text without a scope start precede the calls, as llama.cpp cd959bae9's does. The excluding-text grammar rules escape control characters so a delimiter's line break stays on its rule's line.
…1898) When the added scope end yields no call, parse the reply as generated so the added tag does not show in content.
This was referenced Nov 10, 2026
leehack
added a commit
that referenced
this pull request
Nov 10, 2026
This was referenced Nov 10, 2026
Merged
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.
Summary
Stacked on #1906. Its own change is the top commit.
Parse Seed-OSS tool calls closer to llama.cpp
cd959bae9:</function>\n, it is kept. A scope that ends before its call does (Hello <seed:tool_call>\n, a cut-off name) is dropped from content.\n42\nand{"a": 1}stay strings. The handler now implementsToolSchemaAwareChatTemplateHandler.ToolChoice.requiredand no forced-open thought, the grammar allows a leading<seed:think>…</seed:think>and then text without<seed:tool_call>\nbefore the calls.ToolCallGrammarUtils.excludingRulesnow escapes control characters. Without this, a delimiter containing a line break wrote a raw newline into its rule.Part of #1898 (plan #1899).
Production-readiness scope
Completeness checklist
PR type guidance
seed_oss_tool_call_upstream.jsonhas 156 llama.cpp-recorded cases, and 136 of them fail on the base.seed_oss_handler_test.dartholds verdicts recorded from llama.cpp's grammar.Test Plan
dart run tool/prepare_workspace.dartdart format --output=none --set-exit-if-changed .dart analyzedart test -p vm -j 1 --exclude-tags local-only: rantest/unit/core,test/integration/coreandtest/unit/toolinglocally; the full suite runs in CI.windows_registry_qualification_testalso fails locally onmain(host ProcessException).dart test -p chrome --exclude-tags local-only: rantest/unit/core/templateandchat_completion_stream_parser_test.dart.coverage-libmatrix row: 93.68% line coverage (33717/35993) at Seed head b3605ed, which contains this stack; the fulldart test -p vm --exclude-tags local-onlyrun there had 13444 passes, and its only failures were the 6windows_registry_qualification_testhost failures thatmainalso hasspecialized_tool_grammar_validation_e2e_test.dartwithLLAMA_CPP_GBNF_VALIDATOR./tool/testing/run_template_parity_suites.sh(PASS)Matrix Evidence
structured-output-adversarialcd959bae9probe; vendoredByteDance-Seed-OSS.jinjahigh-risk-exact-head-independent-qarelease-metadata-verificationlitert-lm-*Review Notes
_withLastScopeEndedadds still yields no call (two consecutive unclosed scopes, where llama.cpp fails the reply), the reply is parsed as generated so the added</seed:tool_call>no longer leaks into content. Failing-first test inseed_oss_handler_test.dart; mutants L1–L3 and the earlier S1–S13 all killed. Merged the new Parse Qwen3-Coder XML call bodies as llama.cpp does (#1898) #1906 head (61a3140) so this branch fast-forwards.ci.ymlworkflow_dispatch run 42886419606: success (26 jobs, 6 skipped) at 6e241a3.High-risk regression review
cd959bae9on the vendored template, kept as durable fixtures.