fix(hooks): track thread ownership mentions case-insensitively · openclaw/openclaw@dbba830
vincentkoc
·
2026-04-23
·
via Recent Commits to openclaw:main
File tree
extensions/thread-ownership
| Original file line number | Diff line number | Diff line change |
|---|
@@ -306,5 +306,24 @@ describe("thread-ownership plugin", () => {
|
306 | 306 | expect(result).toBeUndefined(); |
307 | 307 | expect(globalThis.fetch).not.toHaveBeenCalled(); |
308 | 308 | }); |
| 309 | + |
| 310 | +it("tracks agent-name mentions case-insensitively", async () => { |
| 311 | +await hooks.message_received( |
| 312 | +{ |
| 313 | +content: "hey @testbot help", |
| 314 | +threadId: "8888.0002", |
| 315 | +metadata: { channelId: "C789" }, |
| 316 | +}, |
| 317 | +{ channelId: "slack", conversationId: "C789" }, |
| 318 | +); |
| 319 | + |
| 320 | +const result = await hooks.message_sending( |
| 321 | +{ content: "On it!", replyToId: "8888.0002", metadata: { channelId: "C789" }, to: "C789" }, |
| 322 | +{ channelId: "slack", conversationId: "C789" }, |
| 323 | +); |
| 324 | + |
| 325 | +expect(result).toBeUndefined(); |
| 326 | +expect(globalThis.fetch).not.toHaveBeenCalled(); |
| 327 | +}); |
309 | 328 | }); |
310 | 329 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -91,6 +91,7 @@ export default definePluginEntry({
|
91 | 91 | } |
92 | 92 | |
93 | 93 | const text = event.content ?? ""; |
| 94 | +const normalizedText = text.toLowerCase(); |
94 | 95 | const threadTs = |
95 | 96 | resolveThreadToken(event.threadId) || |
96 | 97 | resolveThreadToken(event.metadata?.threadId) || |
@@ -104,7 +105,7 @@ export default definePluginEntry({
|
104 | 105 | } |
105 | 106 | |
106 | 107 | const mentioned = |
107 | | -(agentName && text.includes(`@${agentName}`)) || |
| 108 | +(agentName && normalizedText.includes(`@${agentName.toLowerCase()}`)) || |
108 | 109 | (botUserId && text.includes(`<@${botUserId}>`)); |
109 | 110 | if (mentioned) { |
110 | 111 | cleanExpiredMentions(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。