[Bug] Reasoning from local thinking models leaks into dub translations and glossary auto-extract

Author: FenjuFuCreated Sep 29, 2026Updated Sep 29, 2026

Before filing

  • I searched existing issues and this isn't a duplicate.
  • I'm on the latest release (or main).

What happened?

With a local reasoning model behind an OpenAI-compatible server, the model's chain of thought can end up in dub translations and glossary suggestions, even though Test in Settings → LLM Providers passes. I found this while checking how Spark-X2.5 would run as a Custom provider when served with the vLLM command from its README, and I reproduced it on main with the faked OpenAI clients the existing tests use.

There are two separate gaps:

1. Only some call sites strip reasoning. #2252 added _strip_reasoning in llm_backend.py. It covers dictation refinement (through OpenAICompatBackend) and the Settings Test button, but the translation paths read message.content raw:

Call site Feature
backend/api/routers/dub_translate.py:708 direct LLM dub translation (every segment)
backend/services/translation_quality.py:84 reflect pass (critique + polish) and auto-glossary context
backend/services/translator.py:323 Cinematic / Autofit refine
backend/api/routers/glossary.py:237 glossary auto-extract

So a model that passes Test can still write its reasoning into segments. The direct path only rejects output in the wrong script, and reasoning in the target script passes that check. In auto-extract, any SOURCE || TARGET lines the model drafts inside its reasoning are saved as glossary terms.

2. _strip_reasoning misses templates that prefill <think>. It only drops a block that starts with <think>/<thinking>/<reasoning>. Some chat templates write the opening tag into the generation prompt themselves. Spark-X2.5's chat_template.jinja does this, and so do the Qwen3 thinking variants and DeepSeek-R1-0528. A server run without a reasoning parser (the Spark-X2.5 vLLM quickstart doesn't pass --reasoning-parser) then returns:

The user wants a Spanish line for a cooking show, keep it casual...
</think>

enciende la parrilla ya

There's no leading <think>, so even the paths that do call _strip_reasoning return the whole thing.

Steps to reproduce

With a real server (I haven't run this part myself; no GPU here):

  1. Serve Spark-X2.5-4B with the vLLM command from its README. It has no --reasoning-parser, and the template enables thinking by default.
  2. Settings → LLM Providers → Custom: set Base URL to http://127.0.0.1:30000/v1 and Model to spark25, then Test and use it for translation.
  3. Dub any clip with the LLM translation engine, or run Glossary → Auto-extract.

Without a GPU: have a faked client return "reasoning...\n</think>\n\nHola." in tests/test_translator.py or tests/test_dub_translation_quality.py. The reasoning text comes back as the translation.

What did you expect instead?

Every LLM reply goes through the same reasoning filter before it's used, and the filter also handles a bare closing tag from a prefilled template. A reply that is only reasoning should come back empty so each caller falls back as it does today.

Operating system

Any. This is backend logic only and doesn't depend on the OS or GPU.

How did you install it?

From source

Version

main @ eef0e23

Compute device

N/A

Anything else?

I have a fix with regression tests ready and will open a PR.

Source: debpalash/OmniVoice-Studio