openclaw - 💡(How to fix) Fix Runtime safety: break out of repeated identical failed tool calls

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The agent enters an infinite loop retrying the same failed edit/patch tool call. The tool correctly rejects it with "No changes made" (oldText === newText), but the model retries the identical action repeatedly.

Root Cause

The agent enters an infinite loop retrying the same failed edit/patch tool call. The tool correctly rejects it with "No changes made" (oldText === newText), but the model retries the identical action repeatedly.

Fix Action

Fix / Workaround

Bug: Agent enters no-op edit loop when tool rejects identical patch

The agent enters an infinite loop retrying the same failed edit/patch tool call. The tool correctly rejects it with "No changes made" (oldText === newText), but the model retries the identical action repeatedly.

The runtime should detect repeated identical failed tool calls and:

  1. Break out of the loop after N attempts (e.g., 3)
  2. Surface the failure to the user
  3. Allow the agent to try a different approach (re-read file, compute different patch, or explain blocker)

Code Example

edit: replace "const response = await notion.databases.query({"
with "const response = await notion.databases.query({"
"No changes made"
[retries same edit 20+ times]
RAW_BUFFERClick to expand / collapse

Bug: Agent enters no-op edit loop when tool rejects identical patch

Description

The agent enters an infinite loop retrying the same failed edit/patch tool call. The tool correctly rejects it with "No changes made" (oldText === newText), but the model retries the identical action repeatedly.

Log Excerpt

edit: replace "const response = await notion.databases.query({"
with "const response = await notion.databases.query({"
→ "No changes made"
[retries same edit 20+ times]

Expected Behavior

The runtime should detect repeated identical failed tool calls and:

  1. Break out of the loop after N attempts (e.g., 3)
  2. Surface the failure to the user
  3. Allow the agent to try a different approach (re-read file, compute different patch, or explain blocker)

Environment

  • OpenClaw version: 2026.5.12 (f066dd2)
  • Model: stepfun/step-3.6
  • Session type: Normal chat session (Discord)
  • Tool: edit (patch/replace)

Mitigation (prompt-level)

Added to workspace AGENTS.md:

No-op edit guard: If an edit/patch tool call fails with "No changes made" or the oldText equals newText, do NOT retry the same edit. Re-read the file, compute a different patch, or stop and explain the blocker.

Feature Request

Add a runtime config knob: agents.defaults.maxIdenticalToolFailures (default: 3)

When the same tool call with identical parameters fails N times in a row, automatically:

  • Stop the current agent turn
  • Return a system event noting the repeated failure
  • Include the tool name and parameters in the event

Related

  • Heartbeat watchdog for stuck background processes (HEARTBEAT.md step 14)
  • Mechanical stops for batch scripts (MECHANICAL_STOPS.md)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING