Skip to content

GLM-5.3-Flash thinking degenerates into '!!!!!' loop in agentic tool-calling scenarios (similar to #25129) #45533

Closed as not planned

Description

@ech0potato

Description

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

  1. Add GLM-5.3-Flash as an OpenAI-compatible model
  2. Send any message through the build agent
  3. 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.

Activity

  1. github-actions commented on Aug 27, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions