Fix duplicate assistant transcript merge - #2055
1 commit merged into
Conversation
3ad0126 to
5a445e7
Compare
f00cb74
|
Shipped via stage-337 → master in v0.51.44 (commit The adjacent-only dedup choice is the right framing: it targets the provider-replay case ( A follow-up worth filing: the negative test only exercises content-identity collisions; a more adversarial test would include identical Release: https://github.com/nesquena/hermes-webui/releases/tag/v0.51.44 |
Release T (v0.51.44): 5-PR batch (nesquena#2048 + nesquena#2052 + nesquena#2053 + nesquena#2055 + nesquena#1970) + test-suite network isolation
Release T (v0.51.44): 5-PR batch (nesquena#2048 + nesquena#2052 + nesquena#2053 + nesquena#2055 + nesquena#1970) + test-suite network isolation
Thinking Path
donehandler replaces local state with the server session payload, so if the browser renders two assistant bubbles, the first layer to check is the server-side transcript merge._merge_display_messages_after_agent_result()already avoids duplicating an eager-checkpointed current user turn, but it did not guard against the same assistant message being replayed twice in the current result delta.What Changed
api/streaming.pyfor adjacent duplicate assistant messages.Why It Matters
This prevents duplicate assistant bubbles from being persisted into
s.messagesand then sent back to the browser in thedoneSSE payload. Keeping the guard adjacent-only avoids silently rewriting legitimate history where two separate turns happen to produce the same visible assistant text.Closes #2051.
Verification
pytest -q tests/test_session_save_mode.py::test_duplicate_assistant_delta_is_not_persisted_twice tests/test_session_save_mode.py::test_same_assistant_text_across_different_turns_is_preservedpytest -q tests/test_session_save_mode.py::test_duplicate_assistant_delta_is_not_persisted_twice tests/test_session_save_mode.py::test_same_assistant_text_across_different_turns_is_preserved2 passedpytest -q tests/test_session_save_mode.py tests/test_issue1217_transcript_compaction.py tests/test_session_lineage_full_transcript.py tests/test_issue1361_cancel_data_loss.py40 passedpython -m py_compile api/streaming.pygit diff --checkRisks / Follow-ups
Model Used
AI-assisted with OpenAI Codex in Codex desktop. Model: GPT-5.3 Codex.