feat(cli): wrap /compress in _busy_command to block input during compression#15388
Merged
Conversation
…ression
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 was referenced Apr 27, 2026
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
/compressnow blocks the CLI input prompt while compression is in-flight, so keystrokes typed during compaction don't land in the next prompt.Changes
cli.py::_manual_compress: wrap the try/except body inwith self._busy_command('Compressing context...'):Attribution
Salvage of #10303 by @iRonin — authorship preserved via cherry-pick. The
_compressingflag added torun_agent.pyin the original PR was dropped: it was set in three spots but read nowhere (not by cli.py, not by run_agent.py, not by the Ink TUI which uses a separate prompt path). The only load-bearing change is the one-line_busy_commandwrap.Validation
scripts/run_tests.sh tests/cli/ tests/hermes_cli/ -k 'compress or busy'→ 33 passedpy_compile cli.py→ okCloses #10303.