Fix stale stream exception writeback guards - #2158
Merged
1 commit merged intoMay 13, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
fdbbb0d
franksong2702
pushed a commit
to franksong2702/hermes-webui-fork
that referenced
this pull request
May 13, 2026
Fix stale stream exception writeback guards (closes nesquena#2154) # Conflicts: # CHANGELOG.md
SysAdminDoc
pushed a commit
to SysAdminDoc/hermes-webui
that referenced
this pull request
Jun 26, 2026
Fix stale stream exception writeback guards (closes nesquena#2154) # Conflicts: # CHANGELOG.md
bernyforce
pushed a commit
to bernyforce/hermes-webui
that referenced
this pull request
Jul 29, 2026
Fix stale stream exception writeback guards (closes nesquena#2154) # Conflicts: # CHANGELOG.md
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.
Thinking Path
Closes #2154. The issue identified two remaining stale-stream writeback sites after PR #2136: the credential self-heal retry success path and the outer exception error persistence path. Both paths can run after
active_stream_idhas rotated to a newer stream, so they need the same ownership check already used by the normal success path.What Changed
_stream_writeback_is_current(s, stream_id)guards before the self-heal retry success writeback mutatescontext_messages, display messages, or saves the session.active_stream_id, appends an error marker, or writes a turn journal event.CHANGELOG.mdunder Unreleased.Why It Matters
A stale worker should never be able to write retry results or error markers into a newer active stream's transcript. This keeps
messages,context_messages, turn journal state, andactive_stream_idownership aligned after cancel/retry or stream rotation races.Verification
/Users/xuefusong/hermes-webui/.venv_test/bin/python -m pytest -q tests/test_stale_stream_writeback.py/Users/xuefusong/hermes-webui/.venv_test/bin/python -m py_compile api/streaming.pygit diff --checkRisks / Follow-ups
Low risk. The new guards reuse the existing ownership predicate and only short-circuit non-ephemeral stale streams after ownership has rotated. I did not change the normal success path or cancel path behavior.
Model Used
OpenAI GPT-5.4-Codex