anomalyco / anomalyco/opencode
DeepSeek V4.1 Flash: answer emitted only in reasoning (output=0, finish=stop) and reasoning leaks into visible text
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
DeepSeek V4.1 Flash (model id opencode-go/deepseek-v4.1-flash and deepseek/deepseek-flash, release 2026-09-10) mishandles the reasoning channel, causing two user-visible defects.
Symptom A — answer lost (via OpenCode Go)
The assistant message finishes with finish: "stop" but tokens.output = 0, while the entire reply is stored only in the reasoning part (no text part). The UI shows the chat stop after tool calls with no answer at all.
Observed 5 times out of 1715 assistant messages (2026-09-17/18). Examples (from the session store):
msg_0b2c8b23c0010TqATTeiqD8lX4— tokens{input: 616, output: 0, reasoning: 185}, finishstopmsg_0b2c12fed0015KY4GbZs6hQq4h— tokens{input: 573, output: 0, reasoning: 247}, finishstop
Symptom B — reasoning leaks into visible text (via direct DeepSeek API)
tokens.reasoning = 0 (reasoning is not separated) and the model's English planning lines (No new messages. ... Report: ... Let me report concisely.) are concatenated into the text part, before the actual answer.
Example: msg_0b2d4b989001WVfvdN8HlBzSfm — deepseek/deepseek-flash, finish stop, tokens {output: 137, reasoning: 0}.
Context
- Model metadata:
reasoning: true,reasoning_options: [toggle, effort(low/high/max)],interleaved.field: reasoning_content. - The older DeepSeek V4 models (
deepseek-v4-flash,deepseek-v4-pro) do not show this behavior across thousands of messages in the same environment.
Expected
The final answer should always be emitted as content; reasoning should be consistently separated into reasoning_content and hidden from visible text.
Environment
OpenCode desktop 1.18.31, Windows 11.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing both DeepSeek V4.1 Flash cases described in the issue, using the OpenCode Go path and the direct DeepSeek API path. Trace how provider responses map to visible content and reasoning_content, then verify that final answers appear as content and planning text remains separated in both scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100