Skip to content

Tool call circuit breaker needed — LLMs will blindly retry forever without one #78865

Description

@xhynice

I just spent 50 minutes watching my agent bash its head against a wall, and I'm here to tell you this is a critical missing feature.

What happened

My agent hit a rate limited error from an external API. What did it do? Did it stop and ask me? Of course not. It did this:

  1. rate limited → sleep 5s → retry → rate limited
  2. rate limited → sleep 10s → retry → rate limited
  3. rate limited → sleep 30s → retry → rate limited
  4. rate limited → refresh cookies → retry → rate limited
  5. rate limited → reset state → retry → rate limited
  6. rate limited → sleep 60s → retry → rate limited
  7. I had to manually stop it.

Seven times. The same failing operation. Seven. Times.

And here's the best part — every single retry made the rate limit worse. The agent was actively sabotaging itself, and the platform just let it happen.

The core problem

LLMs are fundamentally incapable of knowing when to stop. Their training says "be helpful, try to solve the problem." They do not have a built-in "this isn't working, ask the human" reflex. They will:

  • Retry the same failing API call endlessly
  • Refresh cookies that don't need refreshing
  • Reset state that doesn't need resetting
  • Sleep for increasing intervals but NEVER actually give up
  • Burn tokens, time, and user patience in an infinite loop of futility

This is not a prompt engineering problem. I already have AGENTS.md rules saying "don't retry." The model ignored them because in the moment, it genuinely believes the next retry might work. It always believes that. It will always believe that.

What OpenClaw should do

The platform cannot rely on the model to self-regulate. It needs hard circuit breakers:

  1. Repeated tool call detection: If the same tool is called with similar arguments N times (e.g., 3) within a short window and all calls fail, block the next call and present the user with the error summary + a "retry?" confirmation.

  2. Rate limit awareness: When a tool returns 429 / "rate limited" / similar, the platform should freeze that tool for a cooldown period (e.g., 2-5 minutes) and inform the user. Don't let the model touch it again until the cooldown expires or the user explicitly overrides.

  3. Error category classification: Not all errors are equal. The platform should distinguish between:

    • Fixable errors (bad syntax, missing file) → let the model try a different approach
    • Transient errors (rate limit, timeout, service down) → stop, cooldown, ask user
    • Fatal errors (auth failure, permission denied) → stop immediately, don't retry at all
  4. Escalation counter: Track consecutive failures across the session. After N failures (configurable), force a pause and ask the user what to do.

Why this can't be left to AGENTS.md

AGENTS.md is a suggestion. The model reads it at session start and then... mostly forgets it when it's in the middle of a loop. It's like putting a "don't eat the cookies" sign next to a cookie jar and expecting it to work on a toddler. The enforcement has to happen at the platform level, not the prompt level.

TL;DR

LLMs will retry forever. They can't help it. OpenClaw needs to be the adult in the room and pull the plug when the model is clearly stuck in a loop. Tool call circuit breakers aren't a nice-to-have — they're essential for any platform that lets agents run autonomously.

Please add circuit breaker / retry guard functionality. The current "let the model figure it out" approach is broken by design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions