feat(cli): wrap /compress in _busy_command to block input during compression

Before this, typing during /compress was accepted by the classic CLI
prompt and landed in the next prompt after compression finished,
effectively consuming a keystroke for a prompt that was about to be
replaced. Wrapping the body in self._busy_command('Compressing
context...') blocks input rendering for the duration, matching the
pattern /skills install and other slow commands already use.

Salvages the useful part of #10303 (@iRonin). The `_compressing` flag
added to run_agent.py in the original PR was dead code (set in 3 spots,
read nowhere — not by cli.py, not by run_agent.py, not by the Ink TUI
which doesn't use _busy_command at all) and was dropped.
This commit is contained in:
Cyprian Kowalczyk 2026-04-24 15:19:44 -07:00 committed by Teknium
parent 8ea389a7f8
commit fd3864d8bd

1
cli.py
View file

@ -7011,6 +7011,7 @@ class HermesCLI:
focus_topic = parts[1].strip() focus_topic = parts[1].strip()
original_count = len(self.conversation_history) original_count = len(self.conversation_history)
with self._busy_command("Compressing context..."):
try: try:
from agent.model_metadata import estimate_messages_tokens_rough from agent.model_metadata import estimate_messages_tokens_rough
from agent.manual_compression_feedback import summarize_manual_compression from agent.manual_compression_feedback import summarize_manual_compression