The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(weixin): scope split_multiline_messages under multiplex profiles
EloquentBrush0x33c872e52ec2
diff --git a/gateway/platforms/weixin.py b/gateway/platforms/weixin.pyindex 604ce565c2c..28e7986ec82 100644--- a/gateway/platforms/weixin.py+++ b/gateway/platforms/weixin.py@@ -710,7 +710,7 @@ class WeixinAdapter(OwnAccessPolicyMixin, BasePlatformAdapter):allow_from, group_allow_from = extra.get("allow_from"), extra.get("group_allow_from")self._allow_from = self._coerce_list(_wx_secret("WEIXIN_ALLOWED_USERS", "") if allow_from is None else allow_from)self._group_allow_from = self._coerce_list(_wx_secret("WEIXIN_GROUP_ALLOWED_USERS", "") if group_allow_from is None else group_allow_from)- self._split_multiline_messages = _coerce_bool(extra.get("split_multiline_messages") or os.getenv("WEIXIN_SPLIT_MULTILINE_MESSAGES"), default=False)+ self._split_multiline_messages = _coerce_bool(_extra_or_secret(extra, "split_multiline_messages", ""), default=False)# Text debounce batching (Telegram pattern): iLink delivers messages individually, so rapid bursts would each# trigger a separate agent run. 3s / 5s (after a ~2048-char split chunk) suit iLink's cadence.self._text_batch_delay_seconds = self._coerce_float_extra("text_batch_delay_seconds", 3.0)diff --git a/tests/gateway/test_weixin_secret_scope.py b/tests/gateway/test_weixin_secret_scope.pyindex 231020b4b29..e07ff738119 100644--- a/tests/gateway/test_weixin_secret_scope.py+++ b/tests/gateway/test_weixin_secret_scope.py@@ -147,3 +147,38 @@ class TestWeixinAdapterAuthzScope:assert adapter._dm_policy == "pairing"assert adapter._allow_from == []assert adapter._is_dm_allowed("default-user") is False+++class TestWeixinAdapterSplitMultilineScope:+ """``split_multiline_messages`` must follow the same scoped-secret rules+ as every other WEIXIN_* tunable in this block (missed by the+ scoped-reader retrofit): a secondary profile's own scope is+ authoritative, and the default profile's process-env value must not+ leak into it."""++ def test_scoped_construction_reads_split_multiline_from_scope_not_environ(+ self, multiplex_on, monkeypatch+ ):+ monkeypatch.setenv("WEIXIN_SPLIT_MULTILINE_MESSAGES", "false")+ token = secret_scope.set_secret_scope(+ {"WEIXIN_SPLIT_MULTILINE_MESSAGES": "true"}+ )+ try:+ adapter = WeixinAdapter(PlatformConfig(enabled=True))+ finally:+ secret_scope.reset_secret_scope(token)+ assert adapter._split_multiline_messages is True++ def test_scoped_miss_does_not_borrow_default_profiles_split_multiline(+ self, multiplex_on, monkeypatch+ ):+ """A secondary profile with no split_multiline_messages of its own+ must fall back to the coded default, not inherit the default+ profile's env-only value."""+ monkeypatch.setenv("WEIXIN_SPLIT_MULTILINE_MESSAGES", "true")+ token = secret_scope.set_secret_scope({"SOMETHING_ELSE": "x"})+ try:+ adapter = WeixinAdapter(PlatformConfig(enabled=True))+ finally:+ secret_scope.reset_secret_scope(token)+ assert adapter._split_multiline_messages is False