Skip to content

Doom loop is not caught when during reasoning or output #12716

Description

@Heinrich-XIAO

Description

Image This is never caught.

Plugins

None

OpenCode version

1.1.53

Steps to reproduce

  1. Ask an agent to think about a certain word 100 times. Preferrably, a smaller model like 2-8B

Screenshot and/or share link

Image

Operating System

m1 mac air tahoe 26.3

Terminal

Mac Default Terminal

Activity

github-actions commented on Feb 8, 2026

@github-actions
Contributor

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

Feel free to ignore if none of these address your specific case.

Nindaleth commented on Feb 14, 2026

@Nindaleth
Contributor

doom_loop — triggered when the same tool call repeats 3 times with identical input

(ref) I don't see any tool calls in your screenshot.

Heinrich-XIAO commented on Feb 14, 2026

@Heinrich-XIAO
Author

Yeah. That's what I mean. It makes sense for it to catch non-tool call doom loops.

Nindaleth commented on Feb 14, 2026

@Nindaleth
Contributor

Oh I see, you are targeting this as a feature request. Ok cool, but please mark the issue as such (e.g. using [FEATURE] tag in the title), the feature works as currently designed and is not a bug.

zenoda commented on Apr 1, 2026

@zenoda
Image

same problem

dezren39 commented on Apr 6, 2026

@dezren39

doom loop in thinking has been especially strange because it will think forever, like longer than the context window usually allows. does opencode just continually send requests in thinking mode?

sandeep-chaps commented on Apr 30, 2026

@sandeep-chaps

the doom_loop: deny switch is not working, using opencode github plugin, we are seeing several doom loops in PR reviews.

| Read {"filePath":"<CI_WORKSPACE>//verif/tbs/xbar/agents/xbar_mport_scheduler/xbar_mport_scheduler.sv","limit":25,"offset":127}

| Read {"filePath":"<CI_WORKSPACE>//verif/tbs/xbar/agents/xbar_mport_scheduler/xbar_mport_scheduler.sv","limit":25,"offset":127}

| Read {"filePath":"<CI_WORKSPACE>//verif/tbs/xbar/agents/xbar_mport_scheduler/xbar_mport_scheduler.sv","limit":25,"offset":127}

| Read {"filePath":"<CI_WORKSPACE>//verif/tbs/xbar/agents/xbar_mport_scheduler/xbar_mport_scheduler.sv","limit":25,"offset":127}

Also see patterns like A B A B A B A B also not get detected.

Ultimately filled up context limit since it cannot be interactively stopped on github opencode plugin

removed
bugSomething isn't working
on May 3, 2026

Keesan12 commented on Jun 5, 2026

@Keesan12

I’d treat this as a separate detector rather than extending tool doom-loop logic.

For reasoning/output loops, the primitive is repeated assistant turns with near-identical content and no external state change, plus a hard cap on consecutive model-only turns. Otherwise smaller models can burn tokens forever without ever touching the tool layer, which means the existing guard never even gets a chance to help.

JustSidus commented on Jun 12, 2026

@JustSidus

Related: opened PR #32089 which fixes the doom loop detection for tool calls across messages. The reasoning/output loop detection you describe here is a separate issue that would need its own fix (detecting repetitive text/reasoning blocks, not tool calls). PR #21112 appears to be working on that.

github-actions commented on Aug 12, 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.

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