fix(cron): the silence instruction names [SILENT] as an untranslatable ASCII token; docs + trim tests
Follow-up to the salvaged #110940 commit: - `cron/scheduler_prompt.py::_CRON_HINT` tells the model the sentinel is a literal ASCII control token that must never be translated or rephrased — the prompt-side half of the fix, so a lane answering in any other language is steered to the canonical token instead of relying on the filter knowing that language. - Docs: the supported-token list ('Intentional Silence Tokens') gains the zh-Hans forms in the English page and the zh-Hans mirror gets the section it lacked. - Tests trimmed to two invariants (translated forms match in every shape the English ones do; prose that mentions the word is still delivered), proven red on origin/main.
This commit is contained in:
@@ -197,6 +197,8 @@ _CRON_HINT = (
|
||||
"final response and the system handles the rest. "
|
||||
"SILENT: If there is genuinely nothing new to report, respond "
|
||||
"with exactly \"[SILENT]\" (nothing else) to suppress delivery. "
|
||||
"[SILENT] is a literal ASCII control token — never translate or "
|
||||
"rephrase it, whatever language the rest of your answer uses. "
|
||||
"Never combine [SILENT] with content — either report your "
|
||||
"findings normally, or say [SILENT] and nothing more. "
|
||||
"RECURSION: This is a run of an EXISTING scheduled job — execute "
|
||||
|
||||
@@ -19,24 +19,15 @@ def test_autonomous_silence_accepts_marker_with_own_line_note():
|
||||
assert is_autonomous_silence_response("[SILENT] No changes detected")
|
||||
|
||||
|
||||
def test_translated_sentinel_suppresses_delivery():
|
||||
"""Regression: a non-English lane answers the silence instruction in its own language.
|
||||
|
||||
2026-09-14 — a deepseek cron lane had nothing to report and answered the cron
|
||||
instruction ("respond with exactly [SILENT]") with "[静默]". The control token
|
||||
was not a known marker, so the whole token was delivered to the user's DM as
|
||||
content.
|
||||
"""
|
||||
def test_translated_sentinel_is_silence_in_every_form_the_english_one_is():
|
||||
"""#110935: a lane that answers the cron instruction in its own language translates the
|
||||
sentinel; ``[静默]`` must suppress delivery exactly like ``[SILENT]`` (exact, own-line note,
|
||||
reordered lines, bracketless, edge punctuation)."""
|
||||
assert is_intentional_silence_response("[静默]")
|
||||
assert is_autonomous_silence_response("[静默]")
|
||||
|
||||
|
||||
def test_translated_sentinel_takes_the_same_forms_as_the_english_one():
|
||||
"""Same loose rule: own-line note, reordered lines, bracketless; the exact rule strips punctuation."""
|
||||
assert is_intentional_silence_response("**沉默**")
|
||||
assert is_autonomous_silence_response("[静默]\n\nNothing new this tick.")
|
||||
assert is_autonomous_silence_response("2 deals filtered\n\n[沉默]")
|
||||
assert is_autonomous_silence_response("静默")
|
||||
assert is_intentional_silence_response("**沉默**")
|
||||
|
||||
|
||||
def test_prose_mentioning_the_translated_sentinel_is_delivered():
|
||||
|
||||
@@ -140,6 +140,7 @@ Supported tokens:
|
||||
- `SILENT`
|
||||
- `NO_REPLY`
|
||||
- `NO REPLY`
|
||||
- `[静默]` / `静默` and `[沉默]` / `沉默` — the Chinese renderings a model produces when it translates the sentinel instead of emitting it literally
|
||||
|
||||
Whitespace and case are normalized, but the whole final response must be the token. A sentence like "Use `[SILENT]` when nothing changed" is delivered normally.
|
||||
|
||||
|
||||
@@ -102,6 +102,22 @@ flowchart TB
|
||||
|
||||
每个平台适配器接收消息,通过每个聊天的会话存储进行路由,并将其分发给 AIAgent 处理。网关还运行 cron 调度器,每 60 秒触发一次以执行到期任务。
|
||||
|
||||
## 有意静默令牌
|
||||
|
||||
在群聊、hooks 和自动化流程中,Hermes 支持显式的静默令牌。若 agent 的最终回复恰好只是一个受支持的令牌,网关会抑制外发投递,不向聊天发送任何内容。
|
||||
|
||||
支持的令牌:
|
||||
|
||||
- `[SILENT]`
|
||||
- `SILENT`
|
||||
- `NO_REPLY`
|
||||
- `NO REPLY`
|
||||
- `[静默]` / `静默` 与 `[沉默]` / `沉默` —— 模型把哨兵翻译成中文而非原样输出时产生的形式
|
||||
|
||||
空白与大小写会被规范化,但整条最终回复必须只是该令牌。像"没有变化时请用 `[SILENT]`"这样的句子会正常投递。
|
||||
|
||||
静默只是投递层面的决定:Hermes 仍会把这条静默回复保存在会话记录中,因此对话依旧正常交替。失败的回合仍会以错误形式呈现;不会因为文本形似静默令牌而隐藏失败。
|
||||
|
||||
## 快速配置
|
||||
|
||||
配置消息平台最简单的方式是使用交互式向导:
|
||||
|
||||
Reference in New Issue
Block a user