Repository navigation
Description
reasoning: reasoning text missing entirely despite reasoning tokens (thinking never shown, no text leak)
Summary
For a small but session-clustered set of assistant messages, opencode stores
tokens.reasoning > 0 but the message contains no reasoning part at all —
and the stored text is clean (no inline chain-of-thought, no </think> tag).
Because there is no reasoning part, the TUI never shows a thinking block for
those turns, even though the model did think.
This is not the same as the inline-</think> leak (see Related): here the
reasoning content is absent from the message entirely rather than leaked into
text.
Environment
- opencode version: 2.0.27
- OS: Windows (10.0.26200, x64)
- Terminal: xterm-256color
- Shell: cmd.exe
- Install/channel: release
- Active plugins:
@firecrawl/opencode,opencode-tavily - Model:
opencode/big-pickle(variant:default), agentbuild
Reproduction
Observed from the local session database (normally created sessions — not
imported/migrated).
- Select
opencode/big-pickle. - Send a handful of ordinary message turns.
- In some sessions, every completed turn stores
tokens.reasoningin the
~1090–1340 range, but the assistant messagecontentcontains only a single
textpart. - The TUI shows no thinking block for any of those turns.
Expected Behavior
When the provider reports reasoning tokens and delivers reasoning content, a
reasoning part should be persisted on the message (and rendered as a
collapsible thinking block) — the same as when reasoning_content is returned.
Actual Behavior
The message has no reasoning part, and the text part does not contain the
chain-of-thought either. The reasoning content is simply not present anywhere in
the stored message.
Aggregate scan of the local session DB (all opencode/big-pickle assistant
messages):
| bucket | count |
|---|---|
tokens.reasoning > 0 |
2,754 |
— of those, contain a reasoning part |
2,693 |
— of those, no reasoning part |
61 |
— — of those 61, text contains a </think>/<think marker |
0 |
The 61 affected messages are clustered by session (several affected turns
per session). One session had 6/6 completed turns affected, each with
tokens.reasoning between 1,090 and 1,337 and content = ["text"] only.
Anonymized structure of one affected message (text content omitted):
{
"agent": "build",
"model": { "id": "big-pickle", "providerID": "opencode", "variant": "default" },
"content": [ { "type": "text", "text": "<omitted>" } ],
"finish": "stop",
"rawFinish": "stop",
"tokens": { "input": 1207, "output": 1241, "reasoning": 1090,
"cache": { "read": 12365, "write": 0 } }
}For comparison, a normal message that does persist reasoning looks like:
"content": [
{ "type": "reasoning", "text": "<omitted>", "state": "...", "time": { } },
{ "type": "text", "text": "<omitted>" }
]Related Issues
- reasoning: opencode zen (big-pickle) inline </think> leaks into text content instead of a reasoning part #54599 / fix(core): split inline chain-of-thought into a reasoning part #54612 — inline CoT (with a literal
</think>) leaking into
text. Different symptom: in the messages reported here,textis clean and
the reasoning content is missing altogether. - 「思考流式显示丢失」:长对话/切换模型后 reasoning 流式显示缺失——provider 流式能力无保证 + /event 无重放游标(ordinal 契约已核实对齐) #52377 — reasoning streaming display loss (SSE replay / provider not
streaming thinking deltas).
Additional Context
- The affected messages are structurally identical to normal ones (same
finish,rawFinish,agent,modelkeys), so the trigger is not visible
at the message level. - Responses in affected sessions appear effectively non-streamed
(time.streamed≈time.completed), but that is also true of most messages
that do persist areasoningpart, so streaming alone does not explain it. - Workaround: start a new session — the large majority of sessions persist
reasoning correctly.
Activity
opencode-agent commentedon Oct 12, 2026
Thanks for the detailed report and the database scan. I was able to reproduce this on 2.0.27 with
opencode/big-pickle.I ran a series of one-shot turns (
opencode run -m opencode/big-pickle "Write a short haiku about number N, thinking carefully first."), then scanned the local session database. On a fresh database, 4 of 24 assistant messages withtokens.reasoning > 0had only atextpart. Their reasoning token counts were 1174, 461, 380 and 61. Their text was clean, with no inline chain-of-thought or<think>tags. The other turns had a normalreasoningpart. The script below runs the turns and the scan.What I couldn't establish is where the reasoning gets lost. In the one turn I managed to capture on the wire, Zen streamed
reasoning_contentand OpenCode saved it correctly. I didn't capture an affected turn, so it's still open whether those responses contain reasoning that OpenCode drops or none at all. I also couldn't check the latestdevagainst this model, because Zen's free tier refuses requests from a source build. 2.0.27 is the latest release.Related issues, for reference:
</think>leaks into the text instead of becoming a reasoning partReproduction script (repro.sh)
Run it:
bash repro.sh