You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Add loop / repetition detection to stop runaway model output (e.g., endless emoji stream) #592
I'm using Mcode with BYOK (Bring Your Own Key) and the MiMo-V2.6-Pro model. Partway through a task, the model appeared to hallucinate and started emitting the same emoji over and over. The output never stopped on its own: the session kept showing Running (2min14s and counting) while the terminal filled with hundreds of identical emoji.
Today the only way out is to notice it and press Esc manually. If I'm not watching the session, it keeps generating indefinitely, which wastes tokens/cost on my own API key and blocks the rest of the task.
Question: does Mcode currently have any built-in mechanism to detect and break infinite/degenerate generation loops? If not, I'd like to request one.
Desired behavior
Mcode should detect degenerate, repetitive output and stop it automatically, regardless of which provider/model is used (including BYOK models).
Acceptance criteria:
Detect repetition in the streaming output (e.g., the same token, n-gram, or line repeated beyond a threshold) and abort the current generation.
Enforce a sensible per-turn output cap (max output tokens and/or max wall-clock time) as a safety net.
When a loop is detected, show a clear notice such as: Generation stopped: repetitive output detected (model may be looping). and return control to the user, with options to retry or continue.
Make thresholds configurable (or allow disabling) in settings, since some legitimate outputs may be repetitive.
Optionally pass frequency_penalty / repetition_penalty / max_tokens to providers that support them, configurable per model.
Platform
macOS
Alternatives and additional context
Workaround: manually pressing Esc to stop the run. This only works if I'm actively watching.
Model: MiMo-V2.6-Pro via BYOK. I understand the root cause is model behavior, but a client-side guard would protect users from any model that falls into a loop.
A screenshot of the runaway output is attached below.
Activity