Skip to content

fix(utils): honor loop repeat thresholds above ten - #290

Open
xyi74976-del wants to merge 2 commits into
HKUDS:mainfrom
xyi74976-del:fix/configured-loop-repeat-window
Open

xyi74976-del wants to merge 2 commits into
HKUDS:mainfrom
xyi74976-del:fix/configured-loop-repeat-window

Conversation

@xyi74976-del

@xyi74976-del xyi74976-del commented Oct 31, 2026 •

Copy link
Copy Markdown

Description

Explicitly configuring LoopDetector(max_repeats=12) never detects a repeated tool call: history is capped at ten entries, so the requested window cannot be reached. Retain at least the configured window while keeping history bounded and preserving the ten-entry floor. The workflow's default threshold is unchanged.

Related Issues

No linked issue. This is separate from the empty status-probe history pollution fixed in #177.

Changes Made

  • Honor explicitly configured repeat thresholds above ten.
  • Test thresholds 5, 10, 12 and 20, status probes, and sequences interrupted by another tool.
  • Add English and Chinese changelog entries.

Validation

Python 3.12 with the official CI lock and editable package:

  • Focused tests: 10 passed; the same tests against the original source: 4 failed, 6 passed.
  • Full suite: 3139 passed, 12 skipped, 1 failed. Remaining failure: tests/test_tui_input_safety.py::test_ctrl_c_clears_a_draft_before_it_interrupts. It also fails after restoring all four changed files to the clean upstream baseline.
  • Added alternating-call histories to verify bounded history and the latest-five summary at default and larger thresholds. A deliberate test-only clipping-removal mutation causes both new cases to fail; the published implementation passes them.
  • Native pre-commit run --all-files --show-diff-on-failure: all six automatic hooks passed; a Go module mirror was needed to install actionlint.
  • uv pip check: installed dependencies compatible.
  • Desktop on Node 24.21.0: 435 tests passed, ESLint, TypeScript, protocol check and Web build passed. An initial Node 26 run failed on undefined localStorage; no frontend changes were made.

Windows/native Desktop and browser end-to-end checks were not run. No live model calls were needed.

Checklist

  • Changes tested locally (full-suite baseline failure disclosed above)
  • Code reviewed (independent read-only AI review)
  • Documentation updated
  • Unit tests added

Additional Notes

Implementation and tests are AI-assisted. The independent review found no blocking code issues; it does not represent human review or upstream CI approval.

This branch has not been deployed

No deployments
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.

1 participant