fix: refresh context ring after compression - #2188
Merged
1 commit merged intoMay 13, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
f5be6e3
pull Bot
pushed a commit
to TKaxv-7S/hermes-webui
that referenced
this pull request
May 13, 2026
fix: refresh context ring after compression (LumenYoung)
SysAdminDoc
pushed a commit
to SysAdminDoc/hermes-webui
that referenced
this pull request
Jun 26, 2026
fix: refresh context ring after compression (LumenYoung)
bernyforce
pushed a commit
to bernyforce/hermes-webui
that referenced
this pull request
Jul 29, 2026
fix: refresh context ring after compression (LumenYoung)
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.
Summary
Refresh the context progress indicator immediately when automatic context compression completes.
Before this change, the auto-compression
compressedSSE event only updated the compression card/toast. The context progress ring continued to show the pre-compression token usage until a latermetering/doneupdate or the next message. This made the UI look like compression had completed but the session was still near the context limit.Problem
When a turn triggers automatic context compression:
compressing.compressed.This is confusing because the compression status and the token indicator disagree immediately after compression finishes.
Fix
The backend now includes a live usage snapshot in the
compressedSSE payload:session_idusageThe frontend
compressedevent handler now:d.usageintoS.lastUsage_syncCtxIndicator(S.lastUsage)before rendering the completed compression cardThis keeps the progress ring in sync as soon as compression completes, without waiting for a later event.
Summary
Fix the context progress ring staying stale after automatic context compression completes.
Before this change, the WebUI showed the automatic compression completion card/toast when the
compressedSSE event arrived, but the context indicator still reflected the pre-compression token usage. It only refreshed later when another usage-bearing event arrived, usually after the next assistant/model step. This made compression look incomplete even though the backend had already compacted the session.Problem
Automatic compression updates the persisted session state immediately, but the
compressedSSE payload did not include the refreshed token usage snapshot.The frontend
compressedevent handler only updated the compression UI state:It did not call
_syncCtxIndicator(), so the context progress ring could remain at the old high-water usage until a latermeteringordoneevent.Fix
This PR makes the compression completion event carry enough state for the UI to refresh immediately.
Backend:
session_idto thecompressedSSE payload so the frontend can ignore stale/cross-session events.usage: _live_usage_snapshot()to thecompressedSSE payload after auto-compression is detected.Frontend:
compressedlistener now ignores events whosesession_iddoes not match the active session.d.usageis present, it merges the usage intoS.lastUsage._syncCtxIndicator(S.lastUsage)before rendering the compression completion card.This keeps the context ring in sync as soon as compression completes, without waiting for the next model/tool/metering event.
Testing