Add stagnation + validation-retry detection to loopDetectionService, plus loop-type labelling on the LoopDetected event for better observability.
Upstream PRs
Why
Catches new loop patterns (same tool repeated without progress, repeated chant outputs, validation-retry cycles). Also tells users why a loop was flagged in the LoopDetected event payload — better UX when triage'ing why a turn was stopped.
Scope / effort
Medium. Per prior investigation:
Prerequisites
Port QwenLM#3236 first. QwenLM#3178 builds on it.
Links
Add stagnation + validation-retry detection to
loopDetectionService, plus loop-type labelling on theLoopDetectedevent for better observability.Upstream PRs
feat(core): enhanced loop detection with stagnation + validation-retry checks— main featurefeat(core): detect tool validation retry loops and inject stop directive— depends on feat(core): enhanced loop detection with stagnation + validation-retry checks QwenLM/qwen-code#3236; injects a stop directive when validation rejection cycle is detected. (port both as a bundle.)Why
Catches new loop patterns (same tool repeated without progress, repeated chant outputs, validation-retry cycles). Also tells users why a loop was flagged in the LoopDetected event payload — better UX when triage'ing why a turn was stopped.
Scope / effort
Medium. Per prior investigation:
loopDetectionService.ts(+234 lines logic, +370 test lines),client.ts,nonInteractiveCli.ts,turn.ts. Conflicts: minor — we have local changes to loopDetectionService but the new detection paths are orthogonal to existing checks.coreToolScheduler.ts(heavily modified in our fork). Adds retry-count tracking. Should land after feat(core): enhanced loop detection with stagnation + validation-retry checks QwenLM/qwen-code#3236.Prerequisites
Port QwenLM#3236 first. QwenLM#3178 builds on it.
Links