Skip to content

The agent that grows with you

fix(tui_gateway): a second session.compress during a manual /compress says to wait

kshitijk4poor61844a56f299
diff --git a/tests/tui_gateway/test_busy_compression_demotion.py b/tests/tui_gateway/test_busy_compression_demotion.py
index 1e024a58d71..9c44feb9e1d 100644
--- a/tests/tui_gateway/test_busy_compression_demotion.py
+++ b/tests/tui_gateway/test_busy_compression_demotion.py
@@ -222,6 +222,7 @@ def test_submit_during_manual_compress_is_queued_and_reply_persists(monkeypatch)
assert session["running"] is True
second = server._methods["session.compress"]("r3", {"session_id": "sid"}) # the locked claim maps to busy
assert second["error"]["code"] == 4009
+ assert "/compress" in second["error"]["message"] and "Stop" not in second["error"]["message"] # double-click
# tools.configure rebuilds the agent (history_version bump): refused before it reads the action
refused = server._methods["tools.configure"]("r4", {"session_id": "sid"})["error"]
assert refused["code"] == 4009
diff --git a/tui_gateway/session_compression.py b/tui_gateway/session_compression.py
index 022234f287f..23b1cbb89a3 100644
--- a/tui_gateway/session_compression.py
+++ b/tui_gateway/session_compression.py
@@ -231,7 +231,7 @@ def _manual_compress_turn(sid: str, session: dict):
about to bump, which dropped the turn's reply (#133504). The queued prompt drains on release."""
with session["history_lock"]:
if session.get("running"):
- raise CompressionBusy(busy_message("compress"))
+ raise CompressionBusy(busy_message("compress", bool(session.get("_manual_compress_active"))))
session["running"] = session["_manual_compress_active"] = True
try:
yield