Skip to content

feat: add tiered tool-repetition detection (soft warning + hard stop)#772

Open
p12tic wants to merge 1 commit into
Zoo-Code-Org:mainfrom
p12tic:repetitive-calls-soft-block
Open

feat: add tiered tool-repetition detection (soft warning + hard stop)#772
p12tic wants to merge 1 commit into
Zoo-Code-Org:mainfrom
p12tic:repetitive-calls-soft-block

Conversation

@p12tic

@p12tic p12tic commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes: #771

Description

Replace the single-threshold ToolRepetitionDetector with a two-tier system:

  • Soft block (default 2nd identical call): the tool is not executed and the model receives an error asking it to justify the repeat. The user is not involved and the counter keeps incrementing toward the hard limit.
  • Hard stop: execution stops and the user is asked for guidance (previous behavior).

Test Procedure

Tell a model to call the same command multiple times. See how it can't execute 3rd command and starts to using different variations of it.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

None.

Documentation Updates

None.

Additional Notes

None.

Summary by CodeRabbit

  • New Features

    • Added a configurable “tool repetition soft limit” for repeated identical tool calls (default threshold, with 0 disabling soft warnings).
    • Added an advanced settings control to adjust the soft limit.
    • Added localized soft-block messaging prompting the model to justify a retry.
  • Bug Fixes

    • Updated tool repetition handling to use a two-stage approach: soft-block first, then escalate into the existing hard-stop flow when further repeats occur.
    • Ensured the configured soft limit is applied consistently to new tasks and restored sessions.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a configurable toolRepetitionSoftLimit for repeated tool calls, changes repetition detection to action-based soft and hard blocks, and wires the setting through task creation, config migration, assistant handling, settings UI, tests, and localized strings.

Changes

Tool repetition soft limit

Layer / File(s) Summary
Contracts and defaults
packages/types/src/provider-settings.ts, packages/types/src/task.ts
DEFAULT_TOOL_REPETITION_SOFT_LIMIT = 2 is exported, ProviderSettings gains toolRepetitionSoftLimit?: number, and CreateTaskOptions accepts the same field.
Detector action model
src/core/tools/ToolRepetitionDetector.ts, src/core/tools/__tests__/ToolRepetitionDetector.spec.ts
ToolRepetitionDetector now returns allow, soft_block, or hard_block via RepetitionCheckResult, uses soft/hard thresholds, and the test suite is rewritten for the new behavior.
Assistant message handling
src/core/assistant-message/presentAssistantMessage.ts, src/core/assistant-message/__tests__/presentAssistantMessage-*.spec.ts
presentAssistantMessage branches on repetitionCheck.action, sending soft_block directly back as a tool error and keeping hard_block on the user-guidance path; mocks and dedicated repetition tests were updated.
Task wiring and provider config migration
src/core/task/Task.ts, src/core/task/__tests__/Task.spec.ts, src/core/config/ProviderSettingsManager.ts, src/core/config/__tests__/ProviderSettingsManager.spec.ts, src/core/webview/ClineProvider.ts
Task stores and forwards the soft limit to the detector, provider settings are migrated for existing configs, and both task creation paths now pass the new option through.
Settings UI and locale strings
webview-ui/src/components/settings/ToolRepetitionLimitControl.tsx, webview-ui/src/components/settings/ApiOptions.tsx, webview-ui/src/components/settings/__tests__/ToolRepetitionLimitControl.spec.tsx, webview-ui/src/components/settings/__tests__/toolRepetitionLimits.spec.ts, webview-ui/src/components/settings/toolRepetitionLimits.ts, src/i18n/locales/*/tools.json, webview-ui/src/i18n/locales/*/settings.json
Adds the soft-limit slider, clamping helper, UI wiring, tests, and matching tool/settings translations across locales.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

awaiting-author

Suggested reviewers

  • taltas
  • JamesRobert20
  • navedmerchant
  • hannesrudolph
  • edelauna

🐇 Two limits hum in the carrot patch bright,
One soft, one hard, keeping call loops in sight.
The bunny says hop, then pause, then explain—
Repeat with a purpose, and think once again!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the linked issue, summarizes the implementation, and includes a test procedure and checklist.
Linked Issues check ✅ Passed The changes implement the requested lower soft limit that reports back to the model without human intervention, with escalation to hard stop.
Out of Scope Changes check ✅ Passed The added settings, migrations, locales, and tests all support the tiered tool-repetition feature and appear in scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly summarizes the main change: introducing tiered tool-repetition detection with a soft warning and hard stop.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
webview-ui/src/components/settings/ApiOptions.tsx 0.00% 2 Missing and 1 partial ⚠️
src/core/task/Task.ts 66.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@p12tic p12tic changed the title feat: add tiered tool-repetition detection (soft warning + hard stop) WIP: feat: add tiered tool-repetition detection (soft warning + hard stop) Jun 30, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/core/task/__tests__/Task.spec.ts (1)

419-432: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Test name overstates what is verified. The test claims to verify the hard stop is derived from consecutiveMistakeLimit, but it only asserts the two input fields and that toolRepetitionDetector is defined — it never checks that the detector's hard limit actually equals 7. Since hardStopLimit is private, consider verifying behavior instead (e.g., constructing the detector and exercising check() until the hard block fires at the 7th identical call), or relax the test name.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/task/__tests__/Task.spec.ts` around lines 419 - 432, The test name
is stronger than what the `Task` spec actually verifies: it says the tool
repetition hard stop is derived from `consecutiveMistakeLimit`, but only checks
the constructor inputs and that `toolRepetitionDetector` exists. Update the
`Task.spec.ts` case around the `Task` constructor to either assert the detector
behavior through repeated `check()` calls until the 7th identical repetition
triggers the block, or rename/relax the test so it only reflects the fields
being verified. Use `Task` and `toolRepetitionDetector` as the key symbols when
adjusting the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@webview-ui/src/components/settings/ApiOptions.tsx`:
- Around line 763-770: The soft threshold in ToolRepetitionLimitControl can
still be saved at or above the hard limit, which makes the soft-block path
unreachable in ToolRepetitionDetector.check(). Update the ApiOptions setting
flow (the softValue/onSoftChange wiring around setApiConfigurationField and the
consecutiveMistakeLimit-related controls) to clamp or reject
toolRepetitionSoftLimit so it always stays below the hard stop, and add a local
Vitest regression test under webview-ui/src/**/__tests__ covering the
invalid-combination behavior and the saved-value validation/constraint.

---

Nitpick comments:
In `@src/core/task/__tests__/Task.spec.ts`:
- Around line 419-432: The test name is stronger than what the `Task` spec
actually verifies: it says the tool repetition hard stop is derived from
`consecutiveMistakeLimit`, but only checks the constructor inputs and that
`toolRepetitionDetector` exists. Update the `Task.spec.ts` case around the
`Task` constructor to either assert the detector behavior through repeated
`check()` calls until the 7th identical repetition triggers the block, or
rename/relax the test so it only reflects the fields being verified. Use `Task`
and `toolRepetitionDetector` as the key symbols when adjusting the assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fdea1a9d-ff92-4776-9d48-b1d9d27e929d

📥 Commits

Reviewing files that changed from the base of the PR and between 80fb159 and 9f27169.

📒 Files selected for processing (52)
  • apps/vscode-e2e/src/types/global.d.ts
  • packages/types/src/provider-settings.ts
  • packages/types/src/task.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-unknown-tool.spec.ts
  • src/core/assistant-message/presentAssistantMessage.ts
  • src/core/config/ProviderSettingsManager.ts
  • src/core/config/__tests__/ProviderSettingsManager.spec.ts
  • src/core/task/Task.ts
  • src/core/task/__tests__/Task.spec.ts
  • src/core/tools/ToolRepetitionDetector.ts
  • src/core/tools/__tests__/ToolRepetitionDetector.spec.ts
  • src/core/webview/ClineProvider.ts
  • src/i18n/locales/ca/tools.json
  • src/i18n/locales/de/tools.json
  • src/i18n/locales/en/tools.json
  • src/i18n/locales/es/tools.json
  • src/i18n/locales/fr/tools.json
  • src/i18n/locales/hi/tools.json
  • src/i18n/locales/id/tools.json
  • src/i18n/locales/it/tools.json
  • src/i18n/locales/ja/tools.json
  • src/i18n/locales/ko/tools.json
  • src/i18n/locales/nl/tools.json
  • src/i18n/locales/pl/tools.json
  • src/i18n/locales/pt-BR/tools.json
  • src/i18n/locales/ru/tools.json
  • src/i18n/locales/tr/tools.json
  • src/i18n/locales/vi/tools.json
  • src/i18n/locales/zh-CN/tools.json
  • src/i18n/locales/zh-TW/tools.json
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/components/settings/ToolRepetitionLimitControl.tsx
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json

Comment thread webview-ui/src/components/settings/ApiOptions.tsx
@p12tic p12tic force-pushed the repetitive-calls-soft-block branch 2 times, most recently from 2a2e2c6 to 5f7162d Compare June 30, 2026 18:00

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
webview-ui/src/components/settings/__tests__/ToolRepetitionLimitControl.spec.tsx (1)

47-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align this test with the component’s declared prop contract.

ToolRepetitionLimitControl currently types softValue as number, so softValue={undefined as unknown as number} only works by sidestepping TypeScript. Either make the prop optional if this fallback is a supported runtime path, or move this coverage to the parent that can actually omit/default the value. As written, the test passes for a state typed callers cannot express.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@webview-ui/src/components/settings/__tests__/ToolRepetitionLimitControl.spec.tsx`
around lines 47 - 54, The test is forcing an impossible prop state by passing
softValue as undefined even though ToolRepetitionLimitControl declares it as a
number. Update the coverage to match the component contract: either make
softValue optional in ToolRepetitionLimitControl if undefined is a supported
input, or move this defaulting assertion to the parent component that actually
omits the value and supplies the fallback. Use the ToolRepetitionLimitControl
prop type and the existing softValue/default behavior in the test suite to
locate the right place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/core/assistant-message/__tests__/presentAssistantMessage-tool-repetition.spec.ts`:
- Around line 207-228: The allow-path test in presentAssistantMessage is only
checking that toolRepetitionDetector.check was called and that no hard-block
prompt happened, so it can still pass if tool dispatch never occurs. Update this
spec to assert a downstream side effect from the normal execution path after
action: "allow", using presentAssistantMessage and the mocked tool execution
path (for example, verify the tool runner or resulting message/state change was
triggered) so the test proves the tool actually continued normally.

---

Nitpick comments:
In
`@webview-ui/src/components/settings/__tests__/ToolRepetitionLimitControl.spec.tsx`:
- Around line 47-54: The test is forcing an impossible prop state by passing
softValue as undefined even though ToolRepetitionLimitControl declares it as a
number. Update the coverage to match the component contract: either make
softValue optional in ToolRepetitionLimitControl if undefined is a supported
input, or move this defaulting assertion to the parent component that actually
omits the value and supplies the fallback. Use the ToolRepetitionLimitControl
prop type and the existing softValue/default behavior in the test suite to
locate the right place.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 20da49a2-5201-4a7d-ab32-18730952fc5b

📥 Commits

Reviewing files that changed from the base of the PR and between 9f27169 and 5f7162d.

📒 Files selected for processing (53)
  • packages/types/src/provider-settings.ts
  • packages/types/src/task.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-tool-repetition.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-unknown-tool.spec.ts
  • src/core/assistant-message/presentAssistantMessage.ts
  • src/core/config/ProviderSettingsManager.ts
  • src/core/config/__tests__/ProviderSettingsManager.spec.ts
  • src/core/task/Task.ts
  • src/core/task/__tests__/Task.spec.ts
  • src/core/tools/ToolRepetitionDetector.ts
  • src/core/tools/__tests__/ToolRepetitionDetector.spec.ts
  • src/core/webview/ClineProvider.ts
  • src/i18n/locales/ca/tools.json
  • src/i18n/locales/de/tools.json
  • src/i18n/locales/en/tools.json
  • src/i18n/locales/es/tools.json
  • src/i18n/locales/fr/tools.json
  • src/i18n/locales/hi/tools.json
  • src/i18n/locales/id/tools.json
  • src/i18n/locales/it/tools.json
  • src/i18n/locales/ja/tools.json
  • src/i18n/locales/ko/tools.json
  • src/i18n/locales/nl/tools.json
  • src/i18n/locales/pl/tools.json
  • src/i18n/locales/pt-BR/tools.json
  • src/i18n/locales/ru/tools.json
  • src/i18n/locales/tr/tools.json
  • src/i18n/locales/vi/tools.json
  • src/i18n/locales/zh-CN/tools.json
  • src/i18n/locales/zh-TW/tools.json
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/components/settings/ToolRepetitionLimitControl.tsx
  • webview-ui/src/components/settings/__tests__/ToolRepetitionLimitControl.spec.tsx
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
✅ Files skipped from review due to trivial changes (31)
  • src/i18n/locales/hi/tools.json
  • src/i18n/locales/ca/tools.json
  • src/i18n/locales/en/tools.json
  • src/i18n/locales/zh-CN/tools.json
  • webview-ui/src/i18n/locales/nl/settings.json
  • src/i18n/locales/ja/tools.json
  • src/i18n/locales/zh-TW/tools.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • src/i18n/locales/vi/tools.json
  • src/i18n/locales/pl/tools.json
  • src/i18n/locales/nl/tools.json
  • src/i18n/locales/es/tools.json
  • src/i18n/locales/tr/tools.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • src/i18n/locales/de/tools.json
  • src/core/assistant-message/tests/presentAssistantMessage-unknown-tool.spec.ts
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • src/i18n/locales/pt-BR/tools.json
  • src/i18n/locales/ru/tools.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • src/i18n/locales/it/tools.json
  • src/i18n/locales/ko/tools.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • src/i18n/locales/id/tools.json
🚧 Files skipped from review as they are similar to previous changes (20)
  • src/core/assistant-message/tests/presentAssistantMessage-images.spec.ts
  • src/core/assistant-message/tests/presentAssistantMessage-custom-tool.spec.ts
  • packages/types/src/task.ts
  • src/core/assistant-message/presentAssistantMessage.ts
  • src/i18n/locales/fr/tools.json
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • src/core/webview/ClineProvider.ts
  • webview-ui/src/components/settings/ToolRepetitionLimitControl.tsx
  • src/core/config/tests/ProviderSettingsManager.spec.ts
  • webview-ui/src/i18n/locales/ca/settings.json
  • src/core/task/tests/Task.spec.ts
  • src/core/task/Task.ts
  • src/core/config/ProviderSettingsManager.ts
  • webview-ui/src/i18n/locales/ru/settings.json
  • packages/types/src/provider-settings.ts
  • webview-ui/src/i18n/locales/hi/settings.json
  • src/core/tools/tests/ToolRepetitionDetector.spec.ts
  • src/core/tools/ToolRepetitionDetector.ts

@p12tic p12tic force-pushed the repetitive-calls-soft-block branch from 5f7162d to 75ae6ab Compare June 30, 2026 18:10

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@webview-ui/src/components/settings/toolRepetitionLimits.ts`:
- Around line 25-30: The clamping logic in clampToolRepetitionSoftLimit can
return a negative value when hardLimit is a fractional positive number,
violating the helper’s non-negative contract. Update the Math.min branch so the
returned soft limit is still bounded below by zero while remaining strictly
below the hard stop, and keep the existing early return for hardLimit <= 0
intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c3221e9-f84c-4e37-b0dd-b8373dbdd026

📥 Commits

Reviewing files that changed from the base of the PR and between 5f7162d and 75ae6ab.

📒 Files selected for processing (55)
  • packages/types/src/provider-settings.ts
  • packages/types/src/task.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-custom-tool.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-images.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-tool-repetition.spec.ts
  • src/core/assistant-message/__tests__/presentAssistantMessage-unknown-tool.spec.ts
  • src/core/assistant-message/presentAssistantMessage.ts
  • src/core/config/ProviderSettingsManager.ts
  • src/core/config/__tests__/ProviderSettingsManager.spec.ts
  • src/core/task/Task.ts
  • src/core/task/__tests__/Task.spec.ts
  • src/core/tools/ToolRepetitionDetector.ts
  • src/core/tools/__tests__/ToolRepetitionDetector.spec.ts
  • src/core/webview/ClineProvider.ts
  • src/i18n/locales/ca/tools.json
  • src/i18n/locales/de/tools.json
  • src/i18n/locales/en/tools.json
  • src/i18n/locales/es/tools.json
  • src/i18n/locales/fr/tools.json
  • src/i18n/locales/hi/tools.json
  • src/i18n/locales/id/tools.json
  • src/i18n/locales/it/tools.json
  • src/i18n/locales/ja/tools.json
  • src/i18n/locales/ko/tools.json
  • src/i18n/locales/nl/tools.json
  • src/i18n/locales/pl/tools.json
  • src/i18n/locales/pt-BR/tools.json
  • src/i18n/locales/ru/tools.json
  • src/i18n/locales/tr/tools.json
  • src/i18n/locales/vi/tools.json
  • src/i18n/locales/zh-CN/tools.json
  • src/i18n/locales/zh-TW/tools.json
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/components/settings/ToolRepetitionLimitControl.tsx
  • webview-ui/src/components/settings/__tests__/ToolRepetitionLimitControl.spec.tsx
  • webview-ui/src/components/settings/__tests__/toolRepetitionLimits.spec.ts
  • webview-ui/src/components/settings/toolRepetitionLimits.ts
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
✅ Files skipped from review due to trivial changes (31)
  • src/i18n/locales/pl/tools.json
  • src/i18n/locales/ja/tools.json
  • src/i18n/locales/ru/tools.json
  • src/core/assistant-message/tests/presentAssistantMessage-unknown-tool.spec.ts
  • webview-ui/src/i18n/locales/nl/settings.json
  • src/i18n/locales/en/tools.json
  • src/i18n/locales/id/tools.json
  • src/i18n/locales/ko/tools.json
  • src/i18n/locales/it/tools.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
  • src/i18n/locales/tr/tools.json
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • src/i18n/locales/hi/tools.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • src/i18n/locales/fr/tools.json
  • src/i18n/locales/ca/tools.json
  • src/i18n/locales/pt-BR/tools.json
  • src/i18n/locales/zh-TW/tools.json
  • webview-ui/src/i18n/locales/id/settings.json
  • src/i18n/locales/es/tools.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • src/i18n/locales/de/tools.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • src/i18n/locales/vi/tools.json
  • webview-ui/src/i18n/locales/es/settings.json
  • src/i18n/locales/zh-CN/tools.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
🚧 Files skipped from review as they are similar to previous changes (22)
  • packages/types/src/task.ts
  • src/i18n/locales/nl/tools.json
  • webview-ui/src/components/settings/ToolRepetitionLimitControl.tsx
  • src/core/assistant-message/tests/presentAssistantMessage-images.spec.ts
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/components/settings/tests/ToolRepetitionLimitControl.spec.tsx
  • src/core/assistant-message/presentAssistantMessage.ts
  • webview-ui/src/i18n/locales/tr/settings.json
  • src/core/assistant-message/tests/presentAssistantMessage-custom-tool.spec.ts
  • webview-ui/src/components/settings/ApiOptions.tsx
  • src/core/assistant-message/tests/presentAssistantMessage-tool-repetition.spec.ts
  • webview-ui/src/i18n/locales/ru/settings.json
  • src/core/webview/ClineProvider.ts
  • src/core/task/tests/Task.spec.ts
  • packages/types/src/provider-settings.ts
  • src/core/config/tests/ProviderSettingsManager.spec.ts
  • src/core/task/Task.ts
  • src/core/config/ProviderSettingsManager.ts
  • src/core/tools/ToolRepetitionDetector.ts
  • src/core/tools/tests/ToolRepetitionDetector.spec.ts
  • webview-ui/src/i18n/locales/hi/settings.json

Comment thread webview-ui/src/components/settings/toolRepetitionLimits.ts Outdated
@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Jun 30, 2026
@p12tic p12tic force-pushed the repetitive-calls-soft-block branch from 4950296 to 8bbfa84 Compare June 30, 2026 18:31
Replace the single-threshold ToolRepetitionDetector with a two-tier system:

- Soft block (default 2nd identical call): the tool is not executed and the
  model receives an error asking it to justify the repeat. The user is not
  involved and the counter keeps incrementing toward the hard limit.
- Hard stop: execution stops and the user is asked for guidance (previous behavior).
@p12tic p12tic force-pushed the repetitive-calls-soft-block branch from 8bbfa84 to 1b37dec Compare June 30, 2026 18:32
@p12tic

p12tic commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai Please review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@p12tic Reviewing the changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@p12tic p12tic changed the title WIP: feat: add tiered tool-repetition detection (soft warning + hard stop) feat: add tiered tool-repetition detection (soft warning + hard stop) Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add soft warning for repeated tool execution that doesn't require human intervention

1 participant