The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): trim silence machinery kinds to what the gateway produces
kshitijk4poor8d382fbf0361
diff --git a/gateway/response_filters.py b/gateway/response_filters.pyindex 522ede28930..51152d4535d 100644--- a/gateway/response_filters.py+++ b/gateway/response_filters.py@@ -14,9 +14,10 @@ from typing import Any# error/empty-response path, not silence.LIVE_GATEWAY_SILENT_MARKERS = frozenset({"[SILENT]", "SILENT", "NO_REPLY", "NO REPLY"})-# only these persisted turn kinds are allowed to disappear when they emit a bare marker.-# ordinary user turns must still get a visible fallback if a model emits one by mistake.-MACHINERY_DISPLAY_KINDS = frozenset({"internal_notification", "model_switch", "auto_continue"})+# Only these persisted user-row kinds may vanish on a bare marker; a human turn must get a+# visible fallback instead. "internal_notification" is the only value gateway/run_turn.py+# ever passes as persist_user_display_kind (self-injected MessageEvent(internal=True) turns).+MACHINERY_DISPLAY_KINDS = frozenset({"internal_notification"})# Longer than any marker could plausibly be, even with stray punctuation._MARKER_LENGTH_CAP = 64diff --git a/gateway/run_turn.py b/gateway/run_turn.pyindex a4de367a12b..61c7d649210 100644--- a/gateway/run_turn.py+++ b/gateway/run_turn.py@@ -1407,10 +1407,6 @@ class GatewayTurnMixin:)_intentional_silence = Falseresponse = _UNEXPECTED_SILENCE_REPLY- # a stream consumer may have seen the marker before the final filter. make sure the- # visible fallback still goes through the normal final-send path.- if isinstance(agent_result, dict):- agent_result["already_sent"] = False# "(empty)" = the model produced no visible content after exhausting all retries.if response == "(empty)" and not _intentional_silence:diff --git a/tests/gateway/test_gateway_silence_tokens.py b/tests/gateway/test_gateway_silence_tokens.pyindex aabe5da4021..1204e9d3d4c 100644--- a/tests/gateway/test_gateway_silence_tokens.py+++ b/tests/gateway/test_gateway_silence_tokens.py@@ -97,10 +97,9 @@ def test_failed_agent_result_never_counts_as_intentional_silence():def test_only_synthetic_turns_can_swallow_silence():result = {"failed": False}- for display_kind in ("internal_notification", "model_switch", "auto_continue"):- assert should_swallow_silence(result, "NO_REPLY", display_kind=display_kind)+ assert should_swallow_silence(result, "NO_REPLY", display_kind="internal_notification")- for display_kind in (None, "steer", ""):+ for display_kind in (None, "steer", "", "model_switch"):assert not should_swallow_silence(result, "NO_REPLY", display_kind=display_kind)