The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui_gateway): /compress --aggressive and --preview skip the busy claim
kshitijk4poorc2c23f665c0d
diff --git a/tests/tui_gateway/test_busy_compression_demotion.py b/tests/tui_gateway/test_busy_compression_demotion.pyindex acec96f843b..bb7d3ba041f 100644--- a/tests/tui_gateway/test_busy_compression_demotion.py+++ b/tests/tui_gateway/test_busy_compression_demotion.py@@ -220,6 +220,9 @@ def test_submit_during_manual_compress_is_queued_and_reply_persists(monkeypatch)assert session["running"] is Truesecond = server._methods["session.compress"]("r3", {"session_id": "sid"}) # the locked claim maps to busyassert second["error"]["code"] == 4009+ # "/compress --aggressive" never touches history: answered without claiming (or draining) the busy session+ assert server._compress_live_with_feedback("sid", session, agent, "--aggressive", snapshot_kwargs=True) == \+ ccm.AGGRESSIVE_UNSUPPORTEDresp = server._handle_busy_submit("r2", "sid", session, "question", "ws-1")gate.set()rpc.join(5)diff --git a/tui_gateway/methods_slash.py b/tui_gateway/methods_slash.pyindex 9865d115a77..9a10f940648 100644--- a/tui_gateway/methods_slash.py+++ b/tui_gateway/methods_slash.py@@ -359,15 +359,18 @@ def _compress_live_with_feedback(sid: str, session: dict, agent, arg: str, *, snAGGRESSIVE_UNSUPPORTED, compress_now, parse_compress_args, render_compress_result)from agent.manual_compression_feedback import describe_compression_lock_skip, summarize_manual_compressionfrom agent.model_metadata import estimate_request_tokens_rough+ request = parse_compress_args(arg)+ if request.aggressive:+ return AGGRESSIVE_UNSUPPORTED+ if request.preview: # report only — history, agent and session key untouched, so no busy claim+ with session["history_lock"]:+ preview_messages = list(session.get("history", []))+ with _session_profile_runtime_scope(session):+ return "\n".join(render_compress_result(compress_now(agent, preview_messages, request)))with _session_profile_runtime_scope(session), _manual_compress_turn(sid, session):with session["history_lock"]:before_messages = list(session.get("history", []))history_version = int(session.get("history_version", 0))- request = parse_compress_args(arg)- if request.aggressive:- return AGGRESSIVE_UNSUPPORTED- if request.preview: # report only — history, agent and session key untouched- return "\n".join(render_compress_result(compress_now(agent, before_messages, request)))sys_prompt = getattr(agent, "_cached_system_prompt", "") or ""tools = getattr(agent, "tools", None) or None