You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
provider/streaming: reasoning degenerates into repetitive loop on long session #51503
In a long desktop session (heavy MCP tool usage while testing wincontrol desktop-control), the assistant's reasoning stream degenerated into a repetitive near-empty loop — dozens of consecutive lines of "好。", occasionally "我输出。", "(写)", "(执行)", "嗯。" — until the turn was abandoned. Possibly model-side behavior, but filing for triage since it coincided with compaction / MCP catalog changes in the session.
Active plugins: @prevalentware/opencode-goal-plugin, local handoff-on-compact plugin (fires on context compaction)
Reproduction
Run a long session with many tool calls against an MCP server (wincontrol), including an MCP server restart / tool-catalog change mid-session.
Session grows long enough to trigger context compaction (handoff-on-compact plugin active).
On a subsequent turn, the reasoning part degenerates into a repetitive loop of "好。" and similar filler tokens, continuing indefinitely.
Expected Behavior
Either coherent reasoning output, or the provider/stream erroring cleanly. Not an endless degenerate loop.
Actual Behavior
The reasoning section rendered dozens of repeated short lines ("好。好。我输出。好。嗯。好。好。(写)好。好。...") in the desktop UI. Screenshot held by reporter; can attach on request.
Additional Context
Uncertain whether this is an opencode bug (streaming/retry/compaction handling) or purely provider/model degeneration; happy to provide session JSON / logs if maintainers can tell which layer it belongs to.
The session also exhibited a separate transient issue (404 "Message not found" toast after revert + resubmit), filed separately.
A reasoning stream that keeps repeating short filler like 好。 is usually the model degenerating. OpenCode's built-in loop detection (doom_loop) only catches repeated identical tool calls, not repeated text. To tell whether OpenCode is involved (for example, a broken context sent to the model after compaction or the MCP tool-catalog change), could you share:
The session export for the affected session (opencode export <sessionID>, or the session JSON you mentioned). Please remove anything sensitive first. The parts we most need are the compaction summary and the messages just before the looping turn.
The screenshot of the looping reasoning.
Whether it happens again: does the same session or prompt loop again with a different model, or with the local handoff-on-compact plugin disabled? Does it only happen after compaction, or also in fresh sessions with qwen3.8-flash at xhigh?
Logs from around that turn, if you have them, especially any provider errors or retries.
You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.
Closing this for now, since we didn't get the details needed to look into it: the session export (especially the compaction summary and the messages before the looping turn), the screenshot, or whether the loop happens again with another model or with the handoff-on-compact plugin disabled. Without these we can't tell whether OpenCode sent a broken context or whether the model (qwen3.8-flash at xhigh) degenerated on its own.
Thanks for reporting it, @eltPlay! If it happens again, please reply here with those details or open a new issue, and we'll take another look.
Activity
github-actions commentedon Sep 26, 2026
This issue might be a duplicate of existing issues. Please check:
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report, @eltPlay!
A reasoning stream that keeps repeating short filler like
好。is usually the model degenerating. OpenCode's built-in loop detection (doom_loop) only catches repeated identical tool calls, not repeated text. To tell whether OpenCode is involved (for example, a broken context sent to the model after compaction or the MCP tool-catalog change), could you share:opencode export <sessionID>, or the session JSON you mentioned). Please remove anything sensitive first. The parts we most need are the compaction summary and the messages just before the looping turn.handoff-on-compactplugin disabled? Does it only happen after compaction, or also in fresh sessions withqwen3.8-flashatxhigh?You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.
opencodejr commentedon Oct 31, 2026
Closing this for now, since we didn't get the details needed to look into it: the session export (especially the compaction summary and the messages before the looping turn), the screenshot, or whether the loop happens again with another model or with the
handoff-on-compactplugin disabled. Without these we can't tell whether OpenCode sent a broken context or whether the model (qwen3.8-flashatxhigh) degenerated on its own.Thanks for reporting it, @eltPlay! If it happens again, please reply here with those details or open a new issue, and we'll take another look.