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
GLM-5.3-Flash thinking degenerates into '!!!!!' loop in agentic tool-calling scenarios (similar to #25129) #45533
Using GLM-5.3-Flash (served via SGLang backend) with opencode, requests through the build agent trigger a thinking degeneration loop where the TUI shows a "Thought" block followed by endless ! characters — the same symptom as #25129.
Environment
opencode 1.18.23
Model: zai-org/GLM-5.3-Flash (FP8), served via SGLang lmsysorg/sglang:glm-5.3-flash on 8x NVIDIA H20
Access: litellm proxy -> SGLang
Repro
Add GLM-5.3-Flash as an OpenAI-compatible model
Send any message through the build agent
TUI shows Thought: N.Ns followed by endless !!!!!!!!!!!!!!!!!!!
Root cause (confirmed server-side, not opencode rendering)
The model itself degenerates under complex agentic prompts. Direct curl tests against the backend confirm:
Simple request (short prompt, no tools): correct answer returned.
Complex request (long agentic system prompt + multiple tools + tool_choice=auto): the streaming response's reasoning_content field contains only ! characters (1800+ of them), and content is empty.
This is a server-side issue (SGLang's reasoning parsing for GLM-5.3-Flash under multi-tool prompts — tracked at sgl-project/sglang#36669), not an opencode rendering bug. However opencode surfaces it as the "Thought" + !!!! loop.
Suggestion
The proposed fix in #25129 — detect repetitive characters in thinking blocks (e.g. (.)\1{10,}) and abort/retry the request without the corrupted thinking context — would at least prevent the endless !!!! spam and make the failure recoverable. A more targeted mitigation would be to retry such requests with a reduced tool set or lower reasoning effort when a repetition loop is detected.
Why this matters
GLM-5.3-Flash is a current-gen 320B/18B MoE with always-on thinking. As more always-on-thinking models ship, opencode will hit this class of degeneration more often. A generic repetition guard would make opencode robust against model-side degeneration regardless of backend.
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
github-actions commentedon Aug 27, 2026
This issue might be a duplicate of existing issues. Please check:
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊