fix(compaction): show status message + re-emit context pressure bar at 95%#5963
Closed
KUSH42 wants to merge 2 commits into
Closed
fix(compaction): show status message + re-emit context pressure bar at 95%#5963KUSH42 wants to merge 2 commits into
KUSH42 wants to merge 2 commits into
Conversation
- Print "⟳ compacting context…" before _compress_context() fires so users aren't staring at a frozen prompt during the LLM summarization call (which can take 10–30 s silently). - Replace bool _context_pressure_warned with float _context_pressure_warned_at so the context pressure bar re-emits at the 95% threshold even after already firing at 85%. Previously the once-only gate meant users never saw the bar change from orange→red as context climbed from 88% to 97%. - Add tests: flag re-emits at 95%, no double-emit at same level, field initialises to 0.0 and resets to 0.0 after successful compression.
… case Previous test only verified the happy path (compression brings tokens below 85% → flag resets). Add test_flag_not_reset_when_compression_insufficient to verify the flag is preserved when post-compression tokens remain >= 85% of threshold (e.g. fat system prompt dominates the budget).
|
Friendly bump on this PR in case it fell through the cracks \u2014 would love a review when someone has a minute. Thanks! |
teknium1
added a commit
that referenced
this pull request
Apr 9, 2026
Combines the approaches from PR #6309 (duan78) and PR #5963 (KUSH42): Tiered warnings (from #5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from #6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes #6309. Fixes #5963.
saxster
pushed a commit
to saxster/hermes-agent
that referenced
this pull request
Apr 9, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…earch#6411) Combines the approaches from PR NousResearch#6309 (duan78) and PR NousResearch#5963 (KUSH42): Tiered warnings (from NousResearch#5963): - Replaces boolean _context_pressure_warned with float _context_pressure_warned_at - Fires at 85% (orange) and re-fires at 95% (red/critical) - Adds 'compacting context...' status message before compression Gateway dedup (from NousResearch#6309): - Class-level dict _context_pressure_last_warned survives across AIAgent instances (gateway creates a new instance per message) - 5-minute cooldown per session prevents warning spam - Higher-tier warnings bypass the cooldown (85% → 95% always fires) - Compression reset clears the dedup entry for the session - Stale entries evicted (older than 2x cooldown) to prevent memory leak Does NOT inject into messages — purely user-facing via _safe_print (CLI) and status_callback (gateway). Zero prompt cache impact. Fixes NousResearch#6309. Fixes NousResearch#5963.
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.
What does this PR do?
Two small UX fixes for context compaction feedback:
Missing status message during compression: When auto-compaction fired, the agent went silent for 10–30 s while the context summarisation LLM call ran — no spinner, no message. A
⟳ compacting context…line is now printed before_compress_context()so the user knows what's happening.Context pressure bar only showed once: The progress bar was gated on a boolean
_context_pressure_warnedthat latchedTrueat 85% and never re-fired. Users climbing from 88% → 97% never saw the bar update or change colour (orange → red). The bool is replaced with a float_context_pressure_warned_atthat tracks the highest threshold already shown (0.85 or 0.95), allowing a second emit at the critical 95% tier.Related Issue
Fixes #
Type of Change
Changes Made
run_agent.py: replace_context_pressure_warned: boolwith_context_pressure_warned_at: float; add two-tier warning logic (0.85, 0.95); print⟳ compacting context…before compression firestests/test_context_pressure.py: update two existing tests for renamed field; addtest_flag_reemits_at_95andtest_flag_no_double_emit_same_levelHow to Test
⟳ compacting context…is printed before the next prompt appearspytest tests/test_context_pressure.py -q— all 25 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A