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

推荐订阅源

有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
V
V2EX
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
月光博客
月光博客
云风的 BLOG
云风的 BLOG

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
feat(channels): add generic bot loop protection · opencla...
steipete · 2026-05-13 · via Recent Commits to openclaw:main

@@ -634,6 +634,149 @@ describe("preflightDiscordMessage", () => {

634634

).toBe("default");

635635

});

636636637+

it("passes bot-loop protection facts for accepted bot-authored Discord messages (#58789)", async () => {

638+

const channelId = "channel-bot-loop";

639+

const guildId = "guild-bot-loop";

640+

const senderBotId = "relay-bot-1";

641+

const messageTimestamp = "2026-05-13T05:00:00.000Z";

642+643+

const message = createDiscordMessage({

644+

id: "m-loop-1",

645+

channelId,

646+

content: "chatter <@openclaw-bot>",

647+

mentionedUsers: [{ id: "openclaw-bot" }],

648+

author: { id: senderBotId, bot: true, username: "Relay" },

649+

timestamp: messageTimestamp,

650+

});

651+

const result = await preflightDiscordMessage(

652+

createPreflightArgs({

653+

cfg: DEFAULT_PREFLIGHT_CFG,

654+

discordConfig: {

655+

allowBots: true,

656+

botLoopProtection: {

657+

enabled: true,

658+

maxEventsPerWindow: 3,

659+

cooldownSeconds: 60,

660+

},

661+

} as DiscordConfig,

662+

data: createGuildEvent({

663+

channelId,

664+

guildId,

665+

author: message.author,

666+

message,

667+

}),

668+

client: createGuildTextClient(channelId),

669+

}),

670+

);

671+672+

expect(expectPreflightResult(result).botLoopProtection).toEqual({

673+

scopeId: "default",

674+

conversationId: channelId,

675+

senderId: senderBotId,

676+

receiverId: "openclaw-bot",

677+

config: {

678+

enabled: true,

679+

maxEventsPerWindow: 3,

680+

cooldownSeconds: 60,

681+

},

682+

defaultsConfig: undefined,

683+

defaultEnabled: true,

684+

nowMs: Date.parse(messageTimestamp),

685+

});

686+

});

687+688+

it("passes generic channel defaults for Discord bot loop budgets", async () => {

689+

const channelId = "channel-bot-loop-defaults";

690+

const guildId = "guild-bot-loop-defaults";

691+

const discordConfig = { allowBots: true } as DiscordConfig;

692+

const message = createDiscordMessage({

693+

id: "m-loop-default-1",

694+

channelId,

695+

content: "relay <@openclaw-bot>",

696+

mentionedUsers: [{ id: "openclaw-bot" }],

697+

author: { id: "relay-bot-defaults", bot: true, username: "Relay" },

698+

});

699+

const result = await runGuildPreflight({

700+

channelId,

701+

guildId,

702+

message,

703+

discordConfig,

704+

cfg: {

705+

...DEFAULT_PREFLIGHT_CFG,

706+

channels: {

707+

defaults: {

708+

botLoopProtection: {

709+

maxEventsPerWindow: 1,

710+

cooldownSeconds: 60,

711+

},

712+

},

713+

},

714+

},

715+

});

716+717+

expect(expectPreflightResult(result).botLoopProtection?.defaultsConfig).toEqual({

718+

maxEventsPerWindow: 1,

719+

cooldownSeconds: 60,

720+

});

721+

});

722+723+

it("does not prepare loop-guard facts for bot messages that later preflight gates drop (#58789)", async () => {

724+

const channelId = "channel-bot-loop-dropped";

725+

const guildId = "guild-bot-loop-dropped";

726+

const senderBotId = "relay-bot-dropped";

727+

const discordConfig = {

728+

allowBots: true,

729+

botLoopProtection: {

730+

enabled: true,

731+

maxEventsPerWindow: 1,

732+

cooldownSeconds: 60,

733+

},

734+

} as DiscordConfig;

735+

const guildEntries = {

736+

[guildId]: {

737+

requireMention: false,

738+

ignoreOtherMentions: true,

739+

},

740+

};

741+742+

for (const messageId of ["m-dropped-1", "m-dropped-2"]) {

743+

const message = createDiscordMessage({

744+

id: messageId,

745+

channelId,

746+

content: `cc <@999> ${messageId}`,

747+

mentionedUsers: [{ id: "999" }],

748+

author: { id: senderBotId, bot: true, username: "Relay" },

749+

});

750+751+

expect(

752+

await runGuildPreflight({

753+

channelId,

754+

guildId,

755+

message,

756+

discordConfig,

757+

guildEntries,

758+

}),

759+

).toBeNull();

760+

}

761+762+

const validMessage = createDiscordMessage({

763+

id: "m-valid-after-dropped",

764+

channelId,

765+

content: "legitimate bot relay",

766+

author: { id: senderBotId, bot: true, username: "Relay" },

767+

});

768+769+

expect(

770+

await runGuildPreflight({

771+

channelId,

772+

guildId,

773+

message: validMessage,

774+

discordConfig,

775+

guildEntries,

776+

}),

777+

).not.toBeNull();

778+

});

779+637780

it("keeps bound-thread regular bot messages flowing when allowBots=true", async () => {

638781

const threadBinding = createThreadBinding({

639782

targetKind: "session",