Repository navigation
Keep the response-format grammar applied through a budgeted forced-open thought - #1956
Merged
Merged
Conversation
This was referenced Nov 12, 2026
Contributor
|
Chat app preview removed for |
This was referenced Nov 12, 2026
Closed
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
responseFormat) and required tool calls ignoring the grammar after aThinkingBudgetcloses a template-opened thought on llama.cpp (Qwen3.5 and other forced-open thinking templates).LlamaCppServicesetpauseGrammarDuringReasoningfor every grammar, but the grammar built for a forced-open thought (root ::= think-body "</think>" ...) consumes the thought itself. Paused, it never saw the forced\n</think>and resumed inside the thought.ToolCallGrammarUtils.takesForcedOpenThought; pause only lazy grammars and grammars that do not take the thought. A callerGenerationParams.grammarstill waits for the thought to close.Fixes #1953
Production-readiness scope
responseFormat/ required tool calls return schema-valid output at every thinking budget on forced-open thinking templates.llama_cpp_service.dart; no new native call, so nothing new outsideLlamaCppObjectCalls/ExitTeardownApi).packages/genkit_llamadart(genkit_llamadart: resolve the thinking budget through core (#1929) #1952 is open there).Completeness checklist
validation_coverage_test.dartpasses)PR type guidance
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(CI, and locally viacoverage-lib)dart test -p chrome --exclude-tags local-only(CI)coverage-lib(see Matrix Evidence)check_platform_boundaries,validation_coverage_test.dart,package_skills_test.dart,tool/testing/run_template_parity_suites.shMatrix Evidence
structured-output-adversariallocal-onlytest) + stories15M (default CI)template-parityrun_template_parity_suites.shcoverage-libhigh-risk-exact-head-independent-qa7f1adf9f, wording delta PASS at8267bffe. Evidencellamadart-evidence/pr-1956/(evaluator exit 2)Failing-first on
origin/main(4b96fde):thinking_budget_grammar_testreturns' </think>th. He was a very special boy...'instead of' </think>ok'; the unit test does not compile (notakesForcedOpenThought); the Qwen3.5 test fails at budget 0.think-bodyrulePrimary upstream emission: llama-server b12110 (same llama.cpp commit
cd959bae9) returns{"city": "Paris"}at budgets 16 and 64, with the answer incontentand the thought inreasoning(llamadart-evidence/issue-1953/upstream-llama-server-b12110.log).Review Notes
7f1adf9f; delta re-audit PASS at8267bffeHigh-risk regression review
backendRuntime,structuredOutput)mainis now b096ebf (genkit and CI changes only;merge-treeis clean).local-onlytest)