Skip to content

The agent that grows with you

test(tui): assert an abandoned build registers nothing, and name both causes

kshitijk4poor382c91204d1a
diff --git a/tests/tui_gateway/test_tui_gateway_server.py b/tests/tui_gateway/test_tui_gateway_server.py
index 6c386621b10..a2a19ae11fe 100644
--- a/tests/tui_gateway/test_tui_gateway_server.py
+++ b/tests/tui_gateway/test_tui_gateway_server.py
@@ -15479,7 +15479,7 @@ def test_mirror_slash_compress_honors_here_argument(monkeypatch):
# ---------------------------------------------------------------------------
# session.create / session.close race: fast /new churn must not orphan the
# agent or the global approval-notify registration. (Slash workers are no
-# longer pre-warmed by the build thread - slash.exec spawns them on demand -
+# longer pre-warmed by the build thread — slash.exec spawns them on demand —
# so the build thread must ALSO never construct one here.)
# ---------------------------------------------------------------------------
@@ -15632,6 +15632,9 @@ def test_session_create_close_race_does_not_orphan_resources(monkeypatch):
f"orphan notify registration was not unregistered — "
f"{own_key} not in unregistered_keys={unregistered_keys}"
)
+ assert own_key not in registered_keys, (
+ f"the abandoned build registered {own_key} for a closed session"
+ )
@pytest.mark.real_agent_prewarm
diff --git a/tui_gateway/user_messages.py b/tui_gateway/user_messages.py
index 877fd6d183a..bbfdf274984 100644
--- a/tui_gateway/user_messages.py
+++ b/tui_gateway/user_messages.py
@@ -118,7 +118,7 @@ AGENT_STILL_STARTING = (
# A deferred build that finished WITHOUT attaching an agent (its session record was replaced or
# closed while it ran) leaves ``agent_ready`` set and ``agent`` None; this is the recorded cause.
-AGENT_BUILD_ABANDONED = "agent build aborted: the session record was replaced before the build finished"
+AGENT_BUILD_ABANDONED = "agent build aborted: the session was closed or replaced before the build finished"
# Turn refusal when the record still has no agent at admission time (reason unknown).
AGENT_MISSING_FOR_TURN = (
"Hermes could not start the assistant for this session, so your message was not run. "