mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-20 06:30:27 +00:00
f4b2cf033b
When the agent's role-sequence repair concatenates the prior context-tail user row with the submitted current turn as <stale>\n\n<current>, that polluted pair was persisted into both the model context and the visible transcript. Add a _detect_stale_user_merge detector (requires the literal \n\n repair boundary + exact tail/current match after sentinel stripping) and funnel context-merge and display-merge through one _strip_stale_user_merge_from_messages so a single rule governs persistence. The strip is scoped to the new-turn candidate slice only — historical rows in the already-committed previous_context prefix are never rewritten. Co-authored-by: starship-s <starship-s@users.noreply.github.com>