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
[Bug]: mXXXX</parameter> hallucinated at end of responses — not stripped, creates feedback loop #555
In sessions with substantial context, the model occasionally appends mXXXX as a trailing line (where XXXX is the current message number). I confirmed this is LLM-generated by patching createTextCompleteHandler to log output.text before stripHallucinationsFromString runs — the artifact is present in the pre-strip text.
stripHallucinationsFromString only matches `` opening tags, so this passes through, gets stored, and is fed back into subsequent context. Once it's in history the model reproduces it consistently — feedback loop.
This is a different root cause than #488, which theorized XML renderer garbling. This is hallucination.
Expected Behavior
No trailing mXXXX in stored or rendered responses.
Suggested fix in stripHallucinationsFromString:
text.replace(/\nm\d+</parameter>\s*$/, '')
Pattern is anchored to end-of-string with a required leading newline — can only ever remove the very last line, not mid-text content.
Activity
fix: address bugs Tarquinen#555, Tarquinen#556, Tarquinen#560 and ach…
fix: address bugs Tarquinen#555, Tarquinen#556, Tarquinen#560 with te…
fix: strip trailing mXXXX</parameter> hallucinations
Tarquinen commentedon Aug 16, 2026
fixed in #600
fix: strip trailing mXXXX</parameter> hallucinations