Skip to content

The agent that grows with you

fix: de-punctuate autonomous silence candidates like the interactive rule

teknium1cc6b6aa8fd03
diff --git a/gateway/response_filters.py b/gateway/response_filters.py
index 49473a7f922..c847668e398 100644
--- a/gateway/response_filters.py
+++ b/gateway/response_filters.py
@@ -89,8 +89,10 @@ def is_autonomous_silence_response(response: Any) -> bool:
return False
lines = [ln for ln in stripped.splitlines() if ln.strip()]
# Bracketed form only for the prefix rule, so a bare "Silent retry succeeded" is NOT swallowed.
+ # Same de-punctuating forms as the interactive rule, so ``【静默】`` / ``静默。`` cannot
+ # be suppressed in chat yet delivered by cron.
return stripped.upper().startswith(_BRACKETED_SILENCE_MARKERS) or any(
- _canonical_silence_candidate(c) in LIVE_GATEWAY_SILENT_MARKERS for c in (stripped, lines[0], lines[-1])
+ is_intentional_silence_response(c) for c in (stripped, lines[0], lines[-1])
)
diff --git a/tests/gateway/test_response_filters.py b/tests/gateway/test_response_filters.py
index 752deae9db4..35cf35f2e53 100644
--- a/tests/gateway/test_response_filters.py
+++ b/tests/gateway/test_response_filters.py
@@ -33,3 +33,11 @@ def test_translated_sentinel_is_silence_in_every_form_the_english_one_is():
def test_prose_mentioning_the_translated_sentinel_is_delivered():
assert not is_intentional_silence_response("status: 静默 means the lane is quiet")
assert not is_autonomous_silence_response("the lane said 静默 mid-sentence and kept talking")
+
+
+def test_autonomous_lane_agrees_with_interactive_lane_on_cjk_punctuation_variants():
+ """A Chinese lane emits fullwidth brackets or a trailing ``。``; cron/webhook must suppress
+ exactly what the interactive predicate suppresses, or the two lanes drift on the new tokens."""
+ for variant in ("【静默】", "静默。", "【沉默】", "沉默。", "**[静默]**", "NO_REPLY."):
+ assert is_intentional_silence_response(variant)
+ assert is_autonomous_silence_response(variant) == is_intentional_silence_response(variant), variant