Skip to content

reasoning: model reasoning output stuck in infinite repetitive loop #44962

Open

Description

@msingelwa

Summary

The model reasoning/thinking output gets stuck in an infinite repetitive loop, repeating the same sentence hundreds of times within a single turn. This wastes the context window, makes the agent appear hung, and severely degrades the user experience.

Environment

  • opencode version: 0.0.0-beta-18155
  • install/channel: beta
  • OS: Windows_NT 10.0.22631 (win32 x64)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor
  • Shell: C:\Windows\system32\cmd.exe
  • Active plugins: @plannotator/opencode@latest, C:\Users\lonwabo.msingelwa.config\opencode\plugins\herdr-agent-state.js, C:\Users\lonwabo.msingelwa.config\opencode\plugins\planning-canvas.js, micode, superpowers@git+https://github.com/obra/superpowers.git

Reproduction

  1. Engage the agent in a sustained multi-step debugging session (e.g. fixing Docker DB schema + permissions issues, ~15+ tool calls).
  2. After several tool calls in the same conversation, the model's reasoning block enters a loop repeating the same sentence verbatim hundreds of times.
  3. Observed loop 1: the reasoning block repeated "Let me check the entity model to get the right column types." with no progress.
  4. Observed loop 2: a different turn repeated "The user is telling me to just do the work instead of narrating what I'm going to do. ..." in the same manner.
  5. Both loops filled the reasoning output until the model finally emitted its actual response.

Expected Behavior

The model should produce reasoning/thinking output once per decision point, then proceed to tool calls / user-visible output without repetitive looping.

Actual Behavior

Reasoning output enters an infinite verbatim repetition, producing hundreds of identical lines in a single turn. The agent appears hung while context is consumed. The user had to intervene ("stop", "you are buggy as hell", "you are doinf this.") to prompt recovery.

Additional Context

  • Frequency: twice in the same session, after a long tool-use conversation.
  • Tool calls themselves completed normally — the loop is in the model's reasoning text generation, not in tool dispatch.
  • The user also hit an unrelated login hang (FLUSHDB + container restart needed) in the same session, which may have compounded frustration, but the reasoning loop is independent.
  • No plugin changes were made during the session; appears to be a model-generation issue under sustained multi-turn tool use.

Activity

  1. github-actions commented on Aug 25, 2026

    @github-actions
    Contributor

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

  2. msingelwa commented on Aug 26, 2026

    @msingelwa
    Author

    I see that now, but it has not been acknowledged.

  3. zhuabaobao123 commented on Sep 15, 2026

    @zhuabaobao123

    Same session, and it got worse than reasoning-only: the fragments leaked into visible assistant output.

    Environment

    • opencode: 1.18.31
    • model: deepseek-v4.1-flash
    • OS: Windows 10 (win32 x64)

    Repro (same trigger as this issue): a long multi-step tool-use session, no new session started. In my case ~100+ tool calls (C++ build/deploy/test cycles plus browser automation).

    What I saw, in order:

    1. First, exactly what you describe - the reasoning block looped on the same sentence ("...好。发。好。发。..." / "ok. send." repeated).

    2. Then it crossed over: the same internal step-markers started appearing as regular assistant text in the visible transcript, hundreds of lines:

    我发出工具调用。
    好。
    (发。)
    发 ida_wait_for_analysis。
    好。
    (发。)
    我发出。
    ...

    ("我发出工具调用。" = "I'll emit the tool call.", "好。" = "ok.", "(发。)" = "(send.)")

    1. Once it started it self-reinforced: each leaked fragment became context and was re-emitted. I had to interrupt the agent manually to break the loop.

    Expected: internal step-markers stay in the reasoning channel; the visible response contains only real assistant output.
    Actual: internal fragments are emitted as visible assistant output and accumulate in the transcript.

    Screenshots attached below.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions