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
[BUG]: LLM output stuck in repetition loop across providers and agent types #52763
The LLM output gets stuck repeating the same sentence/phrase indefinitely. The model generates a few correct tokens, then enters a loop where it repeats the same text over and over and never emits a stop. This happens across multiple providers and in both the main agent and subagents, and I must abort the turn manually each time.
Steps to reproduce
Concrete repro (OpenCode Desktop, Windows 11):
OpenCode Desktop 1.18.34, Windows 11 x64.
Run a long-ish session (~30+ turns) on any model. I most reliably see it with:
opencode/longcat-2.5-preview-free (OpenCode Zen), or
a DeepSeek-family model (DeepSeek-V4-Flash via a local OpenAI-compatible endpoint).
Send a follow-up prompt that continues prior work (e.g. "continue" or a small edit request).
Observe: the assistant streams a partial answer, then repeats the same sentence (e.g. the last sentence it generated) over and over; output token count climbs; there is no error and no finish; the turn never ends until I press Esc/abort.
It reproduces in the main agent and in subagents (explore/librarian-style task() dispatches), and in both normal and thinking modes. It is not tied to one provider — I have seen the same loop shape with OpenCode Zen, DeepSeek, and local models.
Expected behavior
opencode should detect repetitive output (same sentence/phrase repeated N consecutive times) and abort/retry the turn or surface a warning, instead of streaming forever until the user aborts.
OpenCode version
Desktop 1.18.34, Windows 11 x64 (Electron sidecar)
Plugins
No plugins (bare opencode). Affects the main agent and subagents alike.
Additional context
This is at the output-content level (the stream itself repeats), distinct from code-level session loops (#13577) or tool-call retry loops (#14087). Closest existing reports are per-model: #43146 (DeepSeek Flash v4), #44962 (reasoning repeats), #51503 (long-session degeneration), #25129 (thinking loop), #552 (long-session repetition). This one is broader — same behavior across providers and across both main/sub agents — so it is worth keeping open rather than closing into a single-model issue. Happy to attach a session log excerpt on next occurrence.
changed the title [-]LLM output stuck in repetition loop across all providers and agent types[/-][+][BUG]: LLM output stuck in repetition loop across providers and agent types[/+]on Oct 3, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
[-]LLM output stuck in repetition loop across all providers and agent types[/-][+][BUG]: LLM output stuck in repetition loop across providers and agent types[/+]github-actions commentedon Oct 3, 2026
Thanks for updating the issue with a clear description, reproduction steps, and system details!
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊