nesquena/hermes-webui

Regression: content-based context dedup drops legitimate repeated turns and desynchronizes context_messages from state.db

Open

#6,310 opened on Jul 19, 2026

 (2 comments) (0 reactions) (0 assignees)Python (2,309 forks)github user discovery
bughelp wantedprioritysprint-candidate

Repository metrics

Stars
 (16,904 stars)
PR merge metrics
 (Avg merge 14h 31m) (314 merged PRs in 30d)

Description

Summary

WebUI can remove distinct conversation turns from model-facing context when they share the same role and text.

Repeated feedback is common in interactive workflows. Each occurrence belongs to a different turn and must retain its position in the conversation history.

Reproduction

  1. Start a WebUI conversation.
  2. Ask the assistant to guess a number.
  3. Provide the same directional feedback across multiple guesses, such as higher, higher, and lower.
  4. Continue the conversation.

Expected behavior

Model-facing context preserves every committed turn in chronological order.

Messages with identical text remain distinct when they originate from different turns.

Actual behavior

The WebUI sidecar context can omit interior turns whose text matches earlier messages.

The durable session history retains those turns. The sidecar context and durable history then describe different conversation sequences.

A later model request can receive incomplete game state and respond from an earlier point in the interaction.

Root cause

_deduplicate_context_messages() uses a content-derived identity to suppress replayed messages.

This identity conflates separate turns with the same role and normalized text.

The reconciliation path assumes that context_messages is an ordered retained prefix plus a durable delta. Removing an interior repeated turn breaks that assumption.

Proposed direction

Use stable per-message identity for replay suppression when available.

Preserve same-text messages from separate turns.

Treat a non-compressed, non-truncated sidecar context that is a non-prefix subsequence of durable history as a recovery case.

Add regression coverage for repeated user feedback across separate turns.

Related work

  • #2705 introduced context-message deduplication.
  • #2361 tracks consistency between transcript, model context, streams, and replay.
  • #6187 tracks provenance-safe deduplication for live-stream events.

Contributor guide