Repository navigation
refactor: P3 make ChoiceState grammar state explicit - #17719
Conversation
Signed-off-by: Keiven Chang <keivenchang@users.noreply.github.com>
|
No actionable comments were generated in the recent review. WalkthroughThe unified chat-completions parser now stores family-specific native grammar bookkeeping in a selected adapter state. Streaming parsing, finish recovery, deferred Qwen reasoning projection, and EOF flushing use that state. Tests cover adapter selection and updated fixtures. ChangesNative grammar stream state
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk:
|
|
Replying to #17719 (comment): Fixed in 49b778c: the Native selection matrix now checks |
✅ Dynamo PR CI passed — run 41556664412 (attempt 1) on
|
luckyq
left a comment
There was a problem hiding this comment.
Summary: Behaviour-preserving refactor: the six per-family grammar fields collapse into NativeGrammarState, chosen once in ChoiceState::new by the same predicates main used; every former read/write site is either inside an already-gated block or operated on provably empty state on main. No blockers.
Non-blocking
lib/llm/src/protocols/openai/chat_completions/unified_parser.rs:5295— selection matrix omits families that must map toNoneunder Native (gpt_oss, deepseek_v4, muse_spark); a future widening ofuses_qwen_xml_grammarwould pass unnoticed (P3, DIS-3306).
Checked: diff read field-by-field against main (48 read/write sites); mutual exclusivity of the glm47 / qwen-xml predicates on main; no post-construction reassignment of the replaced fields on main; rename call sites and drain points unchanged; ChoiceRecord stays per-choice. Tests not run; CI green on 4971bbf.
|
Replying to #17719 (review): Fixed in 49b778c: the matrix now asserts Native |
Signed-off-by: Keiven Chang <keivenchang@users.noreply.github.com>
|
Replying to #17719 (review): addressed in 49b778c — |
Overview
This refactor makes native grammar bookkeeping explicit in the OpenAI streaming adapter and tests Native state selection across Qwen, Nemotron, GLM, Kimi, GPT-OSS, DeepSeek V4, and Muse Spark.
Details
Verification
Tested commit: 49b778c.
Review scope and follow-up
I’ll address P0/P1 findings in this PR. Let’s handle P2/P3 in follow-up PRs, tracked in DIS-3306. For AI reviewers, report reproducible P0/P1 findings here; record P2/P3 as follow-up work without requesting changes for them on this PR.
The existing native-progress and recovery failures and the remaining parser qualification proofs are follow-up work tracked in DIS-3306.
Where should the reviewer start?
lib/llm/src/protocols/openai/chat_completions/unified_parser.rs
Summary by CodeRabbit