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

推荐订阅源

博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
罗磊的独立博客
The GitHub Blog
The GitHub Blog
L
LangChain Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
DataBreaches.Net
宝玉的分享
宝玉的分享
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
N
Netflix TechBlog - Medium
The Cloudflare Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
美团技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | 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
fix(slack): preserve rapid send ordering · openclaw/openc...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -31,6 +31,7 @@ const SLACK_UPLOAD_SSRF_POLICY = {

3131

};

3232

const SLACK_DM_CHANNEL_CACHE_MAX = 1024;

3333

const slackDmChannelCache = new Map<string, string>();

34+

const slackSendQueues = new Map<string, Promise<void>>();

34353536

type SlackRecipient =

3637

| {

@@ -179,6 +180,36 @@ function parseRecipient(raw: string): SlackRecipient {

179180

return { kind: target.kind, id: target.id };

180181

}

181182183+

function createSlackSendQueueKey(params: {

184+

accountId: string;

185+

token: string;

186+

recipient: SlackRecipient;

187+

threadTs?: string;

188+

}): string {

189+

const isUserId = params.recipient.kind === "user" || /^U[A-Z0-9]+$/i.test(params.recipient.id);

190+

const recipientKey = `${isUserId ? "user" : params.recipient.kind}:${params.recipient.id}`;

191+

return `${params.accountId}:${params.token}:${recipientKey}:${params.threadTs ?? ""}`;

192+

}

193+194+

async function runQueuedSlackSend<T>(key: string, task: () => Promise<T>): Promise<T> {

195+

const previous = slackSendQueues.get(key) ?? Promise.resolve();

196+

let releaseCurrent!: () => void;

197+

const current = new Promise<void>((resolve) => {

198+

releaseCurrent = resolve;

199+

});

200+

const queuedCurrent = previous.catch(() => undefined).then(() => current);

201+

slackSendQueues.set(key, queuedCurrent);

202+

await previous.catch(() => undefined);

203+

try {

204+

return await task();

205+

} finally {

206+

releaseCurrent();

207+

if (slackSendQueues.get(key) === queuedCurrent) {

208+

slackSendQueues.delete(key);

209+

}

210+

}

211+

}

212+182213

function createSlackDmCacheKey(params: {

183214

accountId?: string;

184215

token: string;

@@ -236,6 +267,10 @@ export function clearSlackDmChannelCache(): void {

236267

slackDmChannelCache.clear();

237268

}

238269270+

export function clearSlackSendQueuesForTest(): void {

271+

slackSendQueues.clear();

272+

}

273+239274

async function uploadSlackFile(params: {

240275

client: WebClient;

241276

channelId: string;

@@ -332,8 +367,37 @@ export async function sendMessageSlack(

332367

fallbackToken: account.botToken,

333368

fallbackSource: account.botTokenSource,

334369

});

335-

const client = opts.client ?? createSlackWriteClient(token);

336370

const recipient = parseRecipient(to);

371+

const queueKey = createSlackSendQueueKey({

372+

accountId: account.accountId,

373+

token,

374+

recipient,

375+

threadTs: opts.threadTs,

376+

});

377+

return await runQueuedSlackSend(queueKey, () =>

378+

sendMessageSlackQueued({

379+

trimmedMessage,

380+

opts,

381+

cfg,

382+

account,

383+

token,

384+

recipient,

385+

blocks,

386+

}),

387+

);

388+

}

389+390+

async function sendMessageSlackQueued(params: {

391+

trimmedMessage: string;

392+

opts: SlackSendOpts;

393+

cfg: OpenClawConfig;

394+

account: ReturnType<typeof resolveSlackAccount>;

395+

token: string;

396+

recipient: SlackRecipient;

397+

blocks?: (Block | KnownBlock)[];

398+

}): Promise<SlackSendResult> {

399+

const { opts, cfg, account, token, recipient, blocks, trimmedMessage } = params;

400+

const client = opts.client ?? createSlackWriteClient(token);

337401

const { channelId } = await resolveChannelId(client, recipient, {

338402

accountId: account.accountId,

339403

token,