Skip to content

Bug: repeated tool calls #28596

Closed as not planned
Closed as not planned

Description

@oceanwap

Description

Model sometimes goes into tool/exec call loop [with exact arguments] indefinitely and doesn't come out without manual interruption.

Image

Agent should prevent such calls and throw an error, so AI agent does something different.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on May 21, 2026

    @github-actions
    Contributor

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

    If your issue is distinct from those (e.g. different trigger conditions or model), please add more context such as your OpenCode version, OS, and steps to reproduce so maintainers can distinguish it.

  2. Arcadi4 commented on May 21, 2026

    @Arcadi4
    Contributor

    This is likely the model's own issue. Try to locate the exact prompt pattern that would reproduce this behavior (this tool might be helpful) and report to the model's dev team instead.

  3. isac322 commented on May 29, 2026

    @isac322

    I hit a very similar repeated-tool-call loop with Gemini and published a tiny OpenCode plugin workaround: https://github.com/isac322/opencode-gemini-dejavu / npm: opencode-gemini-dejavu

    It inserts a request-local user boundary before the repeated tool-call tail and prunes stale prior thought signatures while keeping the current turn signature intact. Not a general doom-loop detector fix, but it may help with this exact “same tool call again” pattern.

  4. Arcadi4 commented on May 30, 2026

    @Arcadi4
    Contributor

    Actually, there's an option in OpenCode that lots of users might not know. You can set the permission doom_loop to deny to halt identical tool calls repeated 3+ consecutive times.

    See https://opencode.ai/docs/permissions

  5. Dr-Hughes commented on Jul 27, 2026

    @Dr-Hughes

    Actually, there's an option in OpenCode that lots of users might not know. You can set the permission doom_loop to deny to halt identical tool calls repeated 3+ consecutive times.

    See https://opencode.ai/docs/permissions

    Part of the problem with this is that often doom loops end up being the same 2-3 repeated calls, so it becomes a little more annoying to detect

    e.g.,

    <thinking> let me check X
    read Y/X
    <thinking> X isn't in Y, let me check Z
    read Z/X
    <thinking> X isn't in Z, let me check Y
    read Y/X
    .
    .
    .

    I think another solution would be to add a hard limit to steps rather than soft suggestion. Or at least, a way to safeguard against failures becoming too costly

  6. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  7. RehanMohammed985 commented on Oct 8, 2026

    @RehanMohammed985

    If anyone has a trace of a loop, runtape (https://github.com/RehanMohammed985/runtape) can rerun the call that repeated, with each part of the context removed, to show what keeps the model calling it again (often the previous result or how it's formatted), and check fixes on that exact call. Glad to run it on one.

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