Skip to content

feat(soul): escalate repeated-tool-call reminders and force-stop on dead-end streak#2466

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
jackfish212:feat/tool-dedup-escalating-reminders
Jun 22, 2026
Merged

feat(soul): escalate repeated-tool-call reminders and force-stop on dead-end streak#2466
sailist merged 1 commit into
MoonshotAI:mainfrom
jackfish212:feat/tool-dedup-escalating-reminders

Conversation

@jackfish212

@jackfish212 jackfish212 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

N/A

Description

Port kimi-code's repeated-tool-call handling into kimi-cli. Once a call is
repeated 3+ times consecutively, a reminder is now injected on every repeat
with escalating tiers (r1/r2/r3), and the turn is force-stopped when the
streak hits 12 so the loop cannot spin on the same call indefinitely. Repeat
telemetry is aligned with kimi-code.


1. Escalating repeat reminders

Problem: The previous dedup only injected a reminder at exactly streak
3/5/8, leaving streaks 4/6/7/9/10/11 with no guidance to the model.

What was done:

  • Added the r3 (dead-end) reminder text.
  • Inject on every repeat from streak 3: r1 (3-4), r2 (5-7), r3 (8+).

2. Force-stop on dead-end streak

Problem: A stuck model could loop on the same tool call until
max_steps_per_turn was hit.

What was done:

  • KimiToolset exposes force_stop_turn, set when the streak reaches 12.
  • _step stops the turn with stop_reason="tool_call_repeat" after the
    dead-end reminder is grown into context.

3. Telemetry alignment with kimi-code

Problem: Repeat telemetry diverged from kimi-code.

What was done:

  • Emit tool_call_repeat{tool_name, repeat_count, action} for every
    consecutive repeat (streak >= 2), with action in none/r1/r2/r3/stop.
  • Drop the same-step dedup telemetry event (kimi-code emits none) and remove
    the now-dead step_no/turn_id state from the dedup path.

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.
  • I have run make gen-docs to update the user documentation.

Open in Devin Review

…ead-end streak

- Inject a reminder on every consecutive repeat from streak 3 (was sparse at exactly 3/5/8)
- Add the r3 dead-end reminder (streak 8+) and force-stop the turn at streak 12
- Align repeat telemetry to kimi-code: tool_call_repeat{tool_name, repeat_count, action}; drop same-step dedup telemetry

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

Open in Devin Review

@sailist sailist added this pull request to the merge queue Jun 22, 2026
Merged via the queue into MoonshotAI:main with commit b0e08c5 Jun 22, 2026
26 of 29 checks passed
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.

2 participants