Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

fix: stop repeated tool-call loops - #2651

Open
Oxygen56 wants to merge 1 commit into
MoonshotAI:mainfrom
Oxygen56:fix/2637-stop-repeated-tool-calls
Open

Oxygen56 wants to merge 1 commit into
MoonshotAI:mainfrom
Oxygen56:fix/2637-stop-repeated-tool-calls

Conversation

@Oxygen56

@Oxygen56 Oxygen56 commented Sep 17, 2026 •

Copy link
Copy Markdown

Related Issue

Resolve #2637

Description

This PR turns the repeated identical tool-call guard into a hard stop before executing another duplicate call once the repeat limit is reached.

Previously, the runtime set the stop flag at the limit but still executed that final repeated call and only stopped the turn afterward. Now the toolset returns a repeat-limit error immediately at the stop threshold, so the agent loop can end the turn without performing one more identical Read call. The existing repeated-call reminder behavior before the hard stop is preserved.

Verification

  • Verified the focused before/after behavior locally: the previous implementation executed the twelfth identical call, while the updated implementation stops before that call and returns the repeat-limit result.
  • Verified the changed files compile.
  • The targeted repository test command could not run in this offline worktree because the test runner is not installed and dependency installation was intentionally skipped; project online checks can run the full suite.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog. Not needed for this internal runtime bug fix.
  • I have run make gen-docs to update the user documentation. Not needed for this internal runtime bug fix.

Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Agent stuck in repeated Read-tool loop, unable to emit intended Edit calls

1 participant