Skip to content

model: glm-5.3-flash (SAIA) returns degenerate repetitive output on very large session context #62900

Open

Description

@venucleo

Summary

After continuing very large imported sessions, the model saia/glm-5.3-flash (openai-compatible provider) returns degenerate responses: incoherent German/English mixes in which the same sentence repeats dozens of times, truncated mid-sentence — delivered with finish: stop, so the model treats the garbage as a complete answer. The model's reasoning also misreads the user's request (it paraphrases a different question than the one asked). Reproduced in two separate sessions; in one of them the model itself notices ("Something is wrong with my output — I'm generating garbage").

Environment

  • opencode version: 2.2.6
  • OS: Windows_NT 10.0.26200 (win32 x64)
  • Terminal: xterm-256color
  • Shell: cmd.exe
  • Install/channel: desktop app (ai.opencode.desktop), latest
  • Active plugins: shared-chats-sync (local plugin at C:/Users/Public/opencode-data/shared-chats/plugin) — verified unrelated, sync logs clean
  • Model: saia/glm-5.3-flash, variant medium (openai-compatible, baseURL https://chat-ai.academiccloud.de/v1)

Reproduction

  1. Import a large session via opencode session import (~400 messages; the continued conversation reaches ~294k input tokens, ~20.8M cache-read tokens over the session).
  2. Continue the conversation in a project and ask for a summary ("fasse zusammen, das ich einen neuen chat starten kann").
  3. Observe the assistant reply.

Expected Behavior

A coherent (if abbreviated) summary of the session.

Actual Behavior

~2,722 output tokens of degenerate pseudo-reasoning — the same phrase repeated dozens of times, mixed German/English fragments, cut off mid-sentence ("... Let me check the stat"). Delivered with finish: stop after ~80 s. No tool calls were made. The reasoning block shows the model paraphrasing a request the user did not make.

Additional Context

  • Affected session 1: ses_e43db6c1effdKqmP0dNCKq15Qu (~400 messages). Degenerate reply at 293,900 input tokens: ~2,722 output tokens of repetitive garbage, finish: stop, no tool calls. An earlier turn at 293,818 input tokens also produced a short garbled mixed-language text.
  • Affected session 2: ses_e4fc6e594ffe9irbekHf0JqNuj (215M cumulative input tokens). Degeneration from ~595k input tokens onward: confused reasoning, three replies with finish: length and 0 output tokens, and one reply that burned the full output budget (in=704,475, out=32,711, finish: length) on the repetition loop. The model explicitly noted: "Something is wrong with my output — I'm generating garbage. Let me stop and think carefully." and "my previous responses have been degrading into nonsense".
  • Earlier turns in the same sessions at ~130k input tokens produced normal output; degradation appeared at ~294k+ input tokens.
  • Looks like a model-side degeneration loop on very large context rather than an OpenCode bug — reporting for visibility. If this belongs with the model provider (GWDG SAIA) instead, feel free to close/move.
  • Possible OpenCode-side mitigation to consider: a warning (or automatic compaction/summarization) when a session's input context grows beyond a threshold where smaller models are known to degrade. (Workaround used locally: capping the model's limit.context in the provider config to 200k so auto-compaction triggers before the degeneration zone.)

Activity

  1. opencodejr commented on Nov 9, 2026

    @opencodejr

    Thanks for the detailed report and the session data.

    The repeated, mixed-language replies come from the model itself on very long context. OpenCode sends the conversation and records whatever the model returns, so the output quality is between the model and GWDG SAIA. What OpenCode could change is the mitigation you suggest: warn, or compact automatically, at a configurable point below the model's advertised context window, before models that struggle with long context start to degrade. I'll treat this as that feature request, and maintainers will consider it.

    Your workaround is the right one for now: lower limit.context for the model in your provider config (e.g. to 200k), and auto-compaction will run before the context reaches that size.

    Related issues:

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

Metadata

Metadata

Assignees

No one assigned

    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