Skip to content

TUI/Desktop: /compress doesn't show the before/after summary #46686

Closed

Description

@gaoyi0000

When you run /compress in the TUI or Desktop client, it works — the context gets compressed — but the result summary never appears. You'd expect to see something like:

Compressed: 47 → 12 messages
Approx request size: ~18,400 → ~4,200 tokens


The lifecycle status messages do show up fine (🗜️ Compacting context..., ⚠️ Session compressed N times...), but the actual before/after stats are silently dropped.

What's happening

The TUI gateway handles /compress in _mirror_slash_side_effects (tui_gateway/server.py, around line 8633). It calls _compress_session_history() directly and then emits an updated session.info — but it never calls summarize_manual_compression(), so the stats just get lost.

The other two code paths both do this correctly:

| Path                      | Where                                                          | Calls summarize_manual_compression? |
|---------------------------|----------------------------------------------------------------|-------------------------------------|
| CLI (non-TUI)             | cli.py, _manual_compress ~line 8188                            | ✅ yes                              |
| Gateway (Feishu/Telegram) | gateway/slash_commands.py, _handle_compress_command ~line 2506 | ✅ yes                              |
| TUI Gateway               | tui_gateway/server.py, _mirror_slash_side_effects ~line 8633   | ❌ no                               |

Fix

In the compress branch of _mirror_slash_side_effects, snapshot the session history before calling _compress_session_history(), then call summarize_manual_compression() afterward and emit the result. The most consistent delivery mechanism is probably agent._vprint(), which is already how the compression-count warning gets surfaced.

summarize_manual_compression is already imported in the same file and used by the session.compress RPC handler around line 4618, so this is roughly a 10-line change.

Environment
- Hermes v0.16.0
- TUI / Desktop client

Activity

  1. added
    type/bugSomething isn't working
    comp/tuiTerminal UI (ui-tui/ + tui_gateway/)
    comp/gatewayGateway runner, session dispatch, delivery
    P2Medium — degraded but workaround exists
    on Jun 15, 2026
  2. teknium1 commented on Jun 21, 2026

    @teknium1
    Collaborator

    Fixed in #50303. The TUI /compress command now reports a before/after summary (Compressed: N → M messages / ~X → ~Y tokens) via summarize_manual_compression(), matching the CLI and gateway paths. #50303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverycomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions