mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 02:59:07 +08:00
Follow-up to #41716, found by live-testing the new parsing chain against locally configured vLLM models (Jolteon/CDCK MoM, DeepSeek V4 Flash, Qwen3.6 35B). ## The bug DeepSeek V4 Flash reproducibly prefixes its structured output with a stray brace-quote, so the streamed document looks like: ``` {"{"output":"Olá a todos! ..."} ``` The complete, correct translation is in there, but every parser in the best-effort chain rejects the document (the stray prefix parses as an object key with no value), and `extract_key` returned an empty string — so translations from this model came back blank. ## The fix Add a recovery attempt to the chain, between the control-character re-escape and the lenient parser: locate the schema key in the text and re-parse (truncation-tolerant) from the object brace immediately preceding it. This is generic for any "garbage before the real object" response, not just the doubled brace-quote observed here. ## Verification Live runs of the real `PostRawTranslator` pipeline (hazard-rich source: emoji, inline code with `<`/`&`, code fences, blockquote, quoted strings) against the three vLLM models: | model | before | after | |---|---|---| | Jolteon (CDCK/MoM) | complete, clean stream | complete, clean stream | | Qwen3.6 35B A3B | complete, clean stream | complete, clean stream | | DeepSeek V4 Flash | **blank translation** | complete translation via fallback, warning logged | All structure checks pass on the recovered output: no control characters, no literal escape artifacts, angle brackets/query strings/code fences/blockquote/emoji intact. Plus a regression spec with the exact observed shape. Parser + structured output suites: 111 examples, 0 failures. |
||
|---|---|---|
| .. | ||
| automation | ||
| chat | ||
| checklist | ||
| discourse-adplugin | ||
| discourse-affiliate | ||
| discourse-ai | ||
| discourse-apple-auth | ||
| discourse-assign | ||
| discourse-cakeday | ||
| discourse-calendar | ||
| discourse-chat-integration | ||
| discourse-data-explorer | ||
| discourse-details | ||
| discourse-gamification | ||
| discourse-github | ||
| discourse-graphviz | ||
| discourse-hcaptcha | ||
| discourse-lazy-videos | ||
| discourse-local-dates | ||
| discourse-login-with-amazon | ||
| discourse-lti | ||
| discourse-math | ||
| discourse-microsoft-auth | ||
| discourse-narrative-bot | ||
| discourse-oauth2-basic | ||
| discourse-openid-connect | ||
| discourse-patreon | ||
| discourse-policy | ||
| discourse-post-voting | ||
| discourse-presence | ||
| discourse-reactions | ||
| discourse-rewind | ||
| discourse-rss-polling | ||
| discourse-solved | ||
| discourse-subscriptions | ||
| discourse-templates | ||
| discourse-topic-voting | ||
| discourse-user-notes | ||
| discourse-workflows | ||
| discourse-zendesk-plugin | ||
| footnote | ||
| poll | ||
| spoiler-alert | ||
| styleguide | ||