Release v0.51.235 — Release HC (stage-q5): no duplicate transcript replay on repeated questions after compression - #3490
Merged
Conversation
No duplicate transcript replay on repeated questions after compression. - #3468 _find_current_user_turn returns the LAST matching user turn (not first), so post-compression result_messages carrying full history no longer replays the whole conversation when the user repeats a similar question (@jasonjcwu). + regression test (fails against the pre-fix first-match logic). Co-authored-by: jasonjcwu <jasonjcwu@users.noreply.github.com>
SysAdminDoc
pushed a commit
to SysAdminDoc/hermes-webui
that referenced
this pull request
Jun 26, 2026
## Release v0.51.235 — Release HC (stage-q5) Single fix in the data-sensitive transcript-merge path, with a Codex-found MUST-FIX applied. ### Fix | PR | Author | Fix | |----|--------|-----| | nesquena#3468 | @jasonjcwu | `_find_current_user_turn` returns the **last** matching user turn instead of the first, so post-compression `result_messages` (which carries the full history) no longer replays the entire conversation when the user repeats a similar question (137-msg session → 89 duplicate replays). | ### Pre-release review caught a CORE issue (fixed before ship) Codex's regression gate found that a naive last-match could be overridden by a **synthetic `role:"user"` continuation prompt** (the agent loop injects "Continue"/empty-recovery nudges — verified at `conversation_loop.py:1763/4183/4356`) that only *substring*-matches the user text — anchoring the merge **past** the real turn and dropping the assistant/tool output in between. Applied the fix: track **strong** (exact `_looks_like_current_user_turn`) and **weak** (substring) matches separately and return `last_strong → last_weak → fallback`. The real turn (strong) always wins over a later synthetic continuation (weak). Opus reviewed the original and said ship; the applied fix is strictly safer than what it reviewed. ### Gate results - **Full pytest suite**: 7465 passed, 8 skipped, 3 xpassed, **0 failed** - **ruff forward gate**: CLEAN - **browser-smoke gate**: CLEAN - **Codex (regression)**: SHIP ONLY WITH FIXES → fix applied → re-reviewed **SAFE TO SHIP** - **Opus (correctness)**: SHIP IT (on the pre-fix code; applied fix is strictly safer) - **Regression test** (`tests/test_issue3468_duplicate_after_compression.py`, 7 cases): pins the last-match behavior, the strong-beats-later-weak invariant, and the end-to-end no-duplicate-replay invariant — each **verified to fail against the pre-fix logic**. Co-authored-by: jasonjcwu <jasonjcwu@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release v0.51.235 — Release HC (stage-q5)
Single fix in the data-sensitive transcript-merge path, with a Codex-found MUST-FIX applied.
Fix
_find_current_user_turnreturns the last matching user turn instead of the first, so post-compressionresult_messages(which carries the full history) no longer replays the entire conversation when the user repeats a similar question (137-msg session → 89 duplicate replays).Pre-release review caught a CORE issue (fixed before ship)
Codex's regression gate found that a naive last-match could be overridden by a synthetic
role:"user"continuation prompt (the agent loop injects "Continue"/empty-recovery nudges — verified atconversation_loop.py:1763/4183/4356) that only substring-matches the user text — anchoring the merge past the real turn and dropping the assistant/tool output in between. Applied the fix: track strong (exact_looks_like_current_user_turn) and weak (substring) matches separately and returnlast_strong → last_weak → fallback. The real turn (strong) always wins over a later synthetic continuation (weak).Opus reviewed the original and said ship; the applied fix is strictly safer than what it reviewed.
Gate results
tests/test_issue3468_duplicate_after_compression.py, 7 cases): pins the last-match behavior, the strong-beats-later-weak invariant, and the end-to-end no-duplicate-replay invariant — each verified to fail against the pre-fix logic.Co-authored-by: jasonjcwu jasonjcwu@users.noreply.github.com