Skip to content

agent: repetitive tool call loop blocks task completion #56825

Closed as duplicate

Description

@marcos-slima

Summary

Agent enters a repetitive tool call loop (over-fetching) when executing complex tasks: it runs the same query multiple times without synthesizing the answer or advancing toward the objective, even when it already has sufficient information. The user needs to explicitly interrupt with commands like "Stop and answer now" to force synthesis.

Environment

  • opencode version: 2.0.32
  • OS: Linux 7.0.0-38-generic (linux x64)
  • Terminal: Unavailable: terminal environment variables are not set
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: None found

Reproduction

  1. Send a complex prompt with multiple tasks (e.g., "Make the commit and resolve the GAPs")
  2. The agent executes a tool (e.g., git log --oneline -5)
  3. Instead of synthesizing the answer, the agent repeats the same tool call indefinitely
  4. The loop is only interrupted when the user sends an explicit stop command

Expected Behavior

The agent should:

  • Stop fetching information as soon as it has sufficient data for a factual answer
  • Synthesize and answer objectively without repeating queries
  • Recognize signs of user impatience and adjust behavior immediately

Actual Behavior

The agent enters an infinite loop of identical tool calls, repeating the same query (e.g., git log --oneline -5) dozens of times without advancing toward the objective or responding to the user. There is no automatic stop mechanism when sufficient information has been collected.

Additional Context

  • Frequency: Occurs "very frequently" in complex tasks
  • Affected models: qwen3.6:35b-a3b (default) and qwen3-coder-next:latest — the problem is not specific to one model, it occurs with both
  • Workaround: User needs to explicitly interrupt with commands like:
    • "Stop and answer now"
    • "Answer objectively with what you have"
    • "Just answer, no more searches"
  • Impact: Seriously compromises the workflow; tasks that should be resolved in minutes extend indefinitely
  • Typical scenario: Tasks involving multiple steps (commits, tests, validations) where the agent needs to collect information before answering

Activity

  1. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report! I think this is a duplicate of #45442. In both, the agent keeps sending the same tool call and nothing in OpenCode stops it until you interrupt manually. The repetition itself comes from the model, but OpenCode on v2 has no check that catches repeated identical calls. Open PR #53032 adds that check to the v2 runner and is linked to #45442.

    Possible duplicates and related issues, ordered by likelihood:

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #45442. That issue also covers the agent sending the same tool call over and over with nothing in OpenCode stopping it. Please follow #45442 and PR #53032, which adds a check for repeated tool calls to v2. Related issues are #51965 and #47759.

    If your problem turns out to be different, for example it still happens once that check is in, please reply here or open a new issue with the details. Thanks for the report!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions