Repository navigation
Description
Description
A manual /compact request using opencode-go/deepseek-v4-flash entered an intra-response repetition loop. This differs from repeatedly triggering multiple Session compacted cycles: one compaction request itself generated a transcript-like prefix and then repeated the same short line 1,511 times.
The compaction never completed. I cancelled it after about 48 seconds, after which OpenCode recorded the message as Aborted. No HTTP, authentication, provider, or stream error was logged before cancellation.
Related, but not identical:
- Infinite "Session compacted" loop on multiple models (DeepSeek V4, MiMo V2.5, MiniMax M3) #30443
- bug(session): infinite compaction loop when compression fails to reduce context #27924
OpenCode version
1.18.16
Environment
- Ubuntu Linux
- TUI
- Provider:
opencode-go - Model:
deepseek-v4-flash - Manual
/compact, not automatic overflow compaction - No custom
compactionagent or compaction prompt configured
Steps to reproduce
- Use
opencode-go/deepseek-v4-flashin a long-running session containing normal assistant messages and tool calls. - Wait for the active assistant turn to finish.
- Run
/compactmanually. - Observe the compaction output.
Actual behavior
- The compaction response began by reproducing part of the preceding transcript, including serialized assistant/tool-call text.
- It then became stuck repeating one short line.
- The persisted compaction text was 29,389 characters when cancelled.
- The repeated line occurred 1,511 times in that single text part.
- The final text was cut off mid-token because the request was cancelled.
- OpenCode did not detect the high repetition or stop the compaction as failed.
- The provider/model still completed a minimal normal text-generation request successfully after the incident.
Sanitized log sequence:
stream providerID=opencode-go modelID=deepseek-v4-flash agent=compaction
llm runtime selected ... provider=opencode-go model=deepseek-v4-flash
[about 48 seconds of streaming]
cancel session.id=<redacted>
process ... error=Aborted
Expected behavior
The compaction agent should produce a concise handoff summary. If its output becomes highly repetitive or fails to reduce the conversation meaningfully, OpenCode should stop the request, mark compaction as failed, and preserve the previous usable session state.
A repetition/degeneration guard on compaction output would prevent a model or provider backend from streaming thousands of duplicate lines and consuming usage indefinitely.
Additional context
This may involve an interaction between the DeepSeek model/backend and the compaction prompt, but OpenCode currently has no client-side guard for degeneration inside a single compaction response. This report intentionally omits the full session export because it contains private project content.
Activity
joaomj commentedon Aug 12, 2026
I am seeing the same general failure pattern, including internal-looking text leaking into the TUI and compaction not completing.
My environment:
1.18.1625.6.0on arm641.3.1and the Zed integrated terminalses_00a38fe1cffef3fdfqdS44708edeepseek-v4-flashthrough OpenCode Zen Free.The issue appeared across both Ghostty and Zed, and across more than one provider, so it does not look specific to one terminal. When compaction triggered, the TUI started showing a large amount of internal/reasoning-like text and the compaction state did not finish. The session could remain stuck with the compaction indicator active.
The example in my debug output showed text such as
Thought: 16.5s, followed by internal planning text and tool-call payloads being displayed in the TUI. This looked similar to the behavior described in this issue, although my report also includes the compaction hang.I then retried compacting the same session using
deepseek-v4-flashthrough the native DeepSeek API instead of OpenCode Zen, and that compaction completed successfully. This suggests there may be an interaction with the OpenCode/Zen route or with the compaction request format, rather than a terminal-only problem or a general inability of the session to compact.As a temporary mitigation, I am testing the compaction agent with reasoning disabled.
joaomj commentedon Aug 12, 2026
regarding (#41801 (comment)): its working with bedrock gpt oss.