Skip to content

fix: stop repeated identical tool call loops - #46272

Open
codeg-dev wants to merge 2 commits into
anomalyco:devfrom
codeg-dev:fix/session-identical-tool-call-loop
Open

fix: stop repeated identical tool call loops#46272
codeg-dev wants to merge 2 commits into
anomalyco:devfrom
codeg-dev:fix/session-identical-tool-call-loop

Conversation

@codeg-dev

@codeg-dev codeg-dev commented Aug 30, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #45442

Related: #43603

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Stops a session after 10 consecutive calls with the same tool name and canonical arguments. Before returning to idle, it emits a visible session error so repeated read loops do not continue indefinitely. Tests cover the threshold, below-threshold calls, and alternating arguments.

How did you verify your code works?

  • bun test packages/opencode/test/session/prompt.test.ts — 61 passed, 1 skipped, 0 failed
  • bun turbo typecheck — 30/30 packages passed

Screenshots / recordings

Not applicable; this is not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

opencode and others added 2 commits August 28, 2026 05:58
Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

subagent: infinite loop of identical tool calls for ~50min with no loop protection, uncontrollable token burn

1 participant