test(signal): cover group mention gating defaults · openclaw/openclaw@a322897
steipete
·
2026-04-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -332,6 +332,7 @@ Replying to a bot message counts as an implicit mention when the channel support
|
332 | 332 | - Surfaces that provide explicit mentions still pass; patterns are a fallback. |
333 | 333 | - Per-agent override: `agents.list[].groupChat.mentionPatterns` (useful when multiple agents share a group). |
334 | 334 | - Mention gating is only enforced when mention detection is possible (native mentions or `mentionPatterns` are configured). |
| 335 | +- Allowlisting a group or sender does not disable mention gating; set that group's `requireMention` to `false` when all messages should trigger. |
335 | 336 | - Group chat prompt context carries the resolved silent-reply instruction every turn; workspace files should not duplicate `NO_REPLY` mechanics. |
336 | 337 | - Groups where silent replies are allowed treat clean empty or reasoning-only model turns as silent, equivalent to `NO_REPLY`. Direct chats do the same only when direct silent replies are explicitly allowed; otherwise empty replies remain failed agent turns. |
337 | 338 | - Discord defaults live in `channels.discord.guilds."*"` (overridable per guild/channel). |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -197,6 +197,7 @@ Groups:
|
197 | 197 | - `channels.signal.groupAllowFrom` controls which groups or senders can trigger group replies when `allowlist` is set; entries can be Signal group IDs (raw, `group:<id>`, or `signal:group:<id>`), sender phone numbers, or `uuid:<id>` values. |
198 | 198 | - `channels.signal.groups["<group-id>" | "*"]` can override group behavior with `requireMention`, `tools`, and `toolsBySender`. |
199 | 199 | - Use `channels.signal.accounts.<id>.groups` for per-account overrides in multi-account setups. |
| 200 | +- Allowlisting a Signal group does not disable mention gating. To process every message in an allowlisted group, set `channels.signal.groups["<group-id>"].requireMention=false` or use the `"*"` group default. |
200 | 201 | - Runtime note: if `channels.signal` is completely missing, runtime falls back to `groupPolicy="allowlist"` for group checks (even if `channels.defaults.groupPolicy` is set). |
201 | 202 | |
202 | 203 | ## How it works (behavior) |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -248,6 +248,44 @@ describe("signal createSignalEventHandler inbound context", () => {
|
248 | 248 | expect(capture.ctx?.From).toBe("group:g1"); |
249 | 249 | }); |
250 | 250 | |
| 251 | +it("keeps mention gating enabled for group-id allowlists by default", async () => { |
| 252 | +const groupHistories = new Map(); |
| 253 | +const handler = createSignalEventHandler( |
| 254 | +createBaseSignalEventHandlerDeps({ |
| 255 | +cfg: { |
| 256 | +messages: { |
| 257 | +inbound: { debounceMs: 0 }, |
| 258 | +groupChat: { mentionPatterns: ["@bot"] }, |
| 259 | +}, |
| 260 | +channels: { |
| 261 | +signal: { |
| 262 | +groupPolicy: "allowlist", |
| 263 | +groupAllowFrom: ["g1"], |
| 264 | +}, |
| 265 | +}, |
| 266 | +}, |
| 267 | +groupPolicy: "allowlist", |
| 268 | +groupAllowFrom: ["g1"], |
| 269 | + groupHistories, |
| 270 | +historyLimit: 5, |
| 271 | +}), |
| 272 | +); |
| 273 | + |
| 274 | +await handler( |
| 275 | +createSignalReceiveEvent({ |
| 276 | +dataMessage: { |
| 277 | +message: "hello without mention", |
| 278 | +groupInfo: { groupId: "g1", groupName: "Test Group" }, |
| 279 | +attachments: [], |
| 280 | +}, |
| 281 | +}), |
| 282 | +); |
| 283 | + |
| 284 | +expect(capture.ctx).toBeUndefined(); |
| 285 | +expect(dispatchInboundMessageMock).not.toHaveBeenCalled(); |
| 286 | +expect(groupHistories.get("g1")?.[0]?.body).toBe("hello without mention"); |
| 287 | +}); |
| 288 | + |
251 | 289 | it("blocks Signal groups whose id is not listed in groupAllowFrom", async () => { |
252 | 290 | const handler = createSignalEventHandler( |
253 | 291 | createBaseSignalEventHandlerDeps({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。