Skip to content

Repetitive tool-call loops with alibaba-coding-plan-cn/qwen3.6-plus #22142

@Astro-Han

Description

@Astro-Han

Description

When using OpenCode with alibaba-coding-plan-cn/qwen3.6-plus, some sessions fall into repetitive tool-call loops.

What I observe:

  • One user turn turns into many assistant turns.
  • Adjacent assistant turns often contain nearly identical reasoning.
  • Each assistant turn often performs only one tool call, then re-enters the loop.
  • The session usually eventually finishes, so this does not look like a storage or transport hang.
  • This seems more like a harness-level loop amplification issue that is exposed more often by qwen3.6-plus.

Local evidence from my machine:

  • Session ses_2845d8980ffemjHrBrf2XpIrY7 had 18 user messages and 114 assistant messages.
  • Many adjacent assistant turns repeated almost the same reasoning, especially around checking or updating the same section again after each tool result.
  • In a local sample, qwen3.6-plus sessions showed a higher assistant-to-user ratio than recent opencode-go/glm-5.1 sessions.
  • Across stored assistant messages, Qwen also produced many more single-tool turns before reaching a final stop.

This does not look like a simple “session got stuck forever” bug. It looks more like the loop keeps accepting repeated tool-calls from this model without enough guardrails against repetition.

Relevant code paths that may be involved:

  • packages/opencode/src/session/prompt.ts
  • packages/opencode/src/agent/agent.ts

My current suspicion:

  • OpenCode keeps looping while the assistant finishes with tool-calls.
  • The default build agent appears to have no practical default step limit.
  • There does not seem to be a repetition guard for “same reasoning / same tool pattern again”.
  • qwen3.6-plus seems more likely than some other models to produce serial one-tool-at-a-time continuations, which makes the issue much more visible.

Plugins

No custom plugins involved, as far as I can tell.

OpenCode version

Mostly observed on 1.4.3.

Affected local sessions I checked:

  • 1.4.3: ses_2845d8980ffemjHrBrf2XpIrY7, ses_289442f7affexh49ZQ2S655J74, ses_28a631ed9ffedBp4DospJDEqoE
  • 1.4.0: ses_28f1e807cffe55PnIHB9b7fK2C

I also have local qwen3.6-plus sessions on 1.3.13 and 1.4.1, but the strongest examples I inspected were on 1.4.3.

Steps to reproduce

  1. Configure OpenCode to use alibaba-coding-plan-cn/qwen3.6-plus.
  2. Use the default build agent on a task that requires multiple reads, edits, or repeated verification inside a repo.
  3. Watch the session timeline.
  4. In some cases, the assistant will produce many short turns with near-duplicate reasoning and one tool call per turn before finally stopping.

A representative pattern is:

  1. Assistant reasons briefly.
  2. Assistant performs one tool call.
  3. Assistant re-enters with nearly the same reasoning.
  4. Assistant performs another single tool call.
  5. This repeats much longer than expected.

Screenshot and/or share link

I do not have a share link attached yet.

I can provide sanitized session details if needed. Example local session IDs:

  • ses_2845d8980ffemjHrBrf2XpIrY7
  • ses_289442f7affexh49ZQ2S655J74
  • ses_28a631ed9ffedBp4DospJDEqoE

Operating System

macOS 26.3.1

Terminal

Not verified from the current environment.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions