惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
D
Docker
IT之家
IT之家
博客园_首页
罗磊的独立博客
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
美团技术团队
Y
Y Combinator Blog
博客园 - 聂微东
量子位
阮一峰的网络日志
阮一峰的网络日志
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
Martin Fowler
Martin Fowler
Jina AI
Jina AI
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
月光博客
月光博客
G
Google Developers Blog
B
Blog
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(discord): route guild text commands (#78080) · opencl...
steipete · 2026-05-06 · via Recent Commits to openclaw:main

@@ -1,5 +1,5 @@

11

import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

2-

import { ChannelType } from "../internal/discord.js";

2+

import { ChannelType, MessageType } from "../internal/discord.js";

33

import { createPartialDiscordChannelWithThrowingGetters } from "../test-support/partial-channel.js";

4455

const transcribeFirstAudioMock = vi.hoisted(() => vi.fn());

@@ -966,6 +966,95 @@ describe("preflightDiscordMessage", () => {

966966

expect(result).not.toBeNull();

967967

});

968968969+

it("routes ordinary guild text control commands through authorization instead of dropping them", async () => {

970+

const channelId = "channel-text-control-command";

971+

const guildId = "guild-text-control-command";

972+

const message = createDiscordMessage({

973+

id: "m-text-control-command",

974+

channelId,

975+

content: "/steer keep digging",

976+

author: {

977+

id: "user-1",

978+

bot: false,

979+

username: "Alice",

980+

},

981+

});

982+983+

const result = await preflightDiscordMessage({

984+

...createPreflightArgs({

985+

cfg: DEFAULT_PREFLIGHT_CFG,

986+

discordConfig: {} as DiscordConfig,

987+

data: createGuildEvent({

988+

channelId,

989+

guildId,

990+

author: message.author,

991+

message,

992+

}),

993+

client: createGuildTextClient(channelId),

994+

}),

995+

allowFrom: ["discord:user-1"],

996+

guildEntries: {

997+

[guildId]: {

998+

channels: {

999+

[channelId]: {

1000+

enabled: true,

1001+

requireMention: true,

1002+

},

1003+

},

1004+

},

1005+

},

1006+

});

1007+1008+

expect(result).not.toBeNull();

1009+

expect(result?.baseText).toBe("/steer keep digging");

1010+

expect(result?.commandAuthorized).toBe(true);

1011+

expect(result?.shouldRequireMention).toBe(true);

1012+

expect(result?.shouldBypassMention).toBe(true);

1013+

});

1014+1015+

it("still drops Discord native command echo messages", async () => {

1016+

const channelId = "channel-native-command-echo";

1017+

const guildId = "guild-native-command-echo";

1018+

const message = createDiscordMessage({

1019+

id: "m-native-command-echo",

1020+

channelId,

1021+

content: "/steer keep digging",

1022+

type: MessageType.ChatInputCommand,

1023+

author: {

1024+

id: "user-1",

1025+

bot: false,

1026+

username: "Alice",

1027+

},

1028+

});

1029+1030+

const result = await preflightDiscordMessage({

1031+

...createPreflightArgs({

1032+

cfg: DEFAULT_PREFLIGHT_CFG,

1033+

discordConfig: {} as DiscordConfig,

1034+

data: createGuildEvent({

1035+

channelId,

1036+

guildId,

1037+

author: message.author,

1038+

message,

1039+

}),

1040+

client: createGuildTextClient(channelId),

1041+

}),

1042+

allowFrom: ["discord:user-1"],

1043+

guildEntries: {

1044+

[guildId]: {

1045+

channels: {

1046+

[channelId]: {

1047+

enabled: true,

1048+

requireMention: true,

1049+

},

1050+

},

1051+

},

1052+

},

1053+

});

1054+1055+

expect(result).toBeNull();

1056+

});

1057+9691058

it("does not mask mention gating when bot id is missing but mention patterns can detect", async () => {

9701059

const channelId = "channel-missing-bot-id-mention-gate";

9711060

const guildId = "guild-missing-bot-id-mention-gate";