Repository navigation
Add ChatTemplateEngine.resolveThinkingBudget (Refs #1929) - #1943
Merged
Merged
Conversation
This was referenced Nov 11, 2026
leehack
marked this pull request as ready for review
November 11, 2026 20:21
This was referenced Nov 12, 2026
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
ChatTemplateEngine.resolveThinkingBudget(int formatIndex, ThinkingBudget budget, {bool rendersPrompt = true}), which fills a budget's omitted start/end tags and the Qwen3-Coder XML line-break close prefix, exactly asLlamaEnginedoes.ChatCompletionRequestPlannernow calls the same static, so the logic lives in one place; planner behavior is unchanged.genkit_llamadart(which renders the prompt itself) match core. Genkit adoption follows the 0.19.7 release in a separate PR.Refs #1929; plan #1939.
Production-readiness scope
ChatTemplateEngine.thinkingTagsForand runruntime.generatethemselves can get the same resolvedThinkingBudgetas core, including the\nclose prefix on Qwen3-Coder XML templates.rendersPrompt: false(backends that take chat messages and close the thought themselves) adds no prefix, as before.Completeness checklist
///Dartdoc, both changelogs; no README/skill/example mentionsthinkingTagsFor.)validation_coverage_test.dartpasses.PR type guidance
rendersPrompt: false.Test Plan
dart run tool/prepare_workspace.dartdart format --output=none --set-exit-if-changed .dart analyze(no issues)dart test -p vm -j 1 --exclude-tags local-only: macOS, 14086 passed; only the 6windows_registry_qualification_test.dartcases failed locally (nopwsh)dart test -p chrome --exclude-tags local-only: left to CI; the change is platform-neutral Dartcoverage-lib: 93.79% (threshold 70)test/unit/core/template,test/unit/core/engine,test_structure,validation_coverage_test.dart,check_platform_boundariesall pass.New test
test/unit/core/template/thinking_budget_resolution_test.dartfailed to load before the change. Mutations, each caught:rendersPrompt &&budget.endTag == nullfalseclosePrefixstartTagendTagMatrix Evidence
coverage-libhigh-risk-exact-head-independent-qallamadart-evidence/pr-1943/(evaluator exit 2); 11/11 change mutants killedstructured-output-adversarialthinking_budget_close_parity_test.dart(#1924 upstream fixtures) passes unchangedrelease-metadata-verification,litert-lm-*,chat-app-litert-json-schemaReview Notes
b103a1cb. Planner output matchedmain's inline logic in all 1176 cases tried.High-risk regression review
chat_completion_request_planner.dart)thinking_budget_close_upstream.json) via the unchanged parity test; no model run