anomalyco / anomalyco/opencode

Agent has no effective no-progress/loop detection during repeated file investigation

Open
#43,603 3 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 20, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

What happened?

OpenCode can enter an effectively infinite tool-call loop when the agent encounters a missing file/path or cannot resolve an implementation detail.

Instead of stopping, asking for clarification, or reporting that the required information is unavailable, the agent repeatedly issues the same investigation intent without producing a new tool call or new information.

Example:

The agent attempted to locate a catalog API client file that did not exist at the requested path:

src/lib/api/catalog.ts

The tool returned:

Cannot find path ... src\lib\api\catalog.ts because it does not exist

After that, the agent repeatedly generated messages such as:

  • "Let me find the catalog api client."
  • "Let me search for it."
  • "Let me locate the catalog api client."
  • "Let me read PlanCatalogPage.tsx."
  • "Let me search once."
  • "Let me grep."
  • "Let me search for the relevant wiring."

This continued for a very large number of iterations without making meaningful progress.

The same behavior also occurred when the agent was trying to verify unresolved implementation details. It repeatedly announced that it would perform the same read/search operation instead of stopping when the required information could not be obtained.

This is especially problematic for autonomous coding workflows because:

  • it wastes a large number of tool calls/tokens
  • it can consume the entire execution budget
  • it delays the actual task indefinitely
  • there is no effective loop-breaker when the investigation produces no new information
  • the user receives no useful failure state or request for clarification

Expected behavior

When the same investigation attempt fails repeatedly, or when consecutive tool calls produce no new information, the agent should detect the loop and stop.

It should instead report something like:

"I cannot locate the requested file/path. I have already attempted the available search paths and received no new information. Please provide the correct path or clarify where the implementation is located."

A bounded retry policy or no-progress detection would be sufficient.

For example:

  • retry a missing-path search a limited number of times
  • detect repeated identical tool intents/results
  • stop after N consecutive no-progress iterations
  • ask the user for clarification when the required information cannot be resolved

The important point is that the agent should not continue generating "Let me search/read/find..." messages indefinitely without an actual new tool action or new information.

Plugins

No response

OpenCode version

1.18.18

Steps to reproduce
  1. Start an OpenCode coding session in a project.
  2. Give the agent a task that requires investigating a specific implementation or file.
  3. Make the referenced file/path incorrect, missing, renamed, or otherwise unavailable.
  4. Allow the agent to investigate using its normal search/read tools.
  5. Observe the agent after the tool reports that the file/path does not exist.
  6. The agent repeatedly generates investigation messages such as "Let me search", "Let me read", "Let me find it", etc., without making meaningful progress or stopping.
  7. The loop can continue for a very large number of iterations and consume the execution budget.
Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

PowerShell

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.