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

推荐订阅源

Martin Fowler
Martin Fowler
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园_首页
宝玉的分享
宝玉的分享
S
SegmentFault 最新的问题
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
美团技术团队
IT之家
IT之家
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
博客园 - 叶小钗
M
MIT News - Artificial intelligence
B
Blog RSS Feed
有赞技术团队
有赞技术团队
Y
Y Combinator 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: preserve whatsapp inbound batch order · openclaw/ope...
steipete · 2026-05-27 · via Recent Commits to openclaw:main

@@ -239,6 +239,7 @@ export async function attachWebInboxToSocket(

239239

debounceKey?: string;

240240

durableId?: string;

241241

readReceipt?: WhatsAppReadReceiptTarget;

242+

receiveOrder?: number;

242243

};

243244

const durableInboundJournal = createWhatsAppDurableInboundReceiveJournal(options.accountId);

244245

const inboundDebounceMs = Math.max(0, Math.trunc(options.debounceMs ?? 0));

@@ -262,6 +263,14 @@ export async function attachWebInboxToSocket(

262263

};

263264

const shouldDebounceInboundMessage = (msg: WebInboundMessage): boolean =>

264265

options.shouldDebounce?.(msg) ?? true;

266+

const orderDebouncedInboundEntries = (entries: QueuedInboundMessage[]) =>

267+

entries.toSorted((a, b) => {

268+

const timestampDiff = (a.timestamp ?? 0) - (b.timestamp ?? 0);

269+

if (timestampDiff !== 0) {

270+

return timestampDiff;

271+

}

272+

return (a.receiveOrder ?? 0) - (b.receiveOrder ?? 0);

273+

});

265274266275

const finalizeInboundDelivery = async (

267276

entries: QueuedInboundMessage[],

@@ -312,23 +321,24 @@ export async function attachWebInboxToSocket(

312321

});

313322

activeInboundFlushes.add(flushTask);

314323

try {

315-

const last = entries.at(-1);

324+

const orderedEntries = orderDebouncedInboundEntries(entries);

325+

const last = orderedEntries.at(-1);

316326

if (!last) {

317327

return;

318328

}

319329

try {

320-

if (entries.length === 1) {

330+

if (orderedEntries.length === 1) {

321331

await options.onMessage(last);

322-

await finalizeInboundDelivery(entries);

332+

await finalizeInboundDelivery(orderedEntries);

323333

return;

324334

}

325335

const mentioned = new Set<string>();

326-

for (const entry of entries) {

336+

for (const entry of orderedEntries) {

327337

for (const jid of entry.mentions ?? entry.mentionedJids ?? []) {

328338

mentioned.add(jid);

329339

}

330340

}

331-

const combinedBody = entries

341+

const combinedBody = orderedEntries

332342

.map((entry) => entry.body)

333343

.filter(Boolean)

334344

.join("\n");

@@ -340,9 +350,9 @@ export async function attachWebInboxToSocket(

340350

isBatched: true,

341351

};

342352

await options.onMessage(combinedMessage);

343-

await finalizeInboundDelivery(entries);

353+

await finalizeInboundDelivery(orderedEntries);

344354

} catch (error) {

345-

await finalizeInboundDelivery(entries, error);

355+

await finalizeInboundDelivery(orderedEntries, error);

346356

throw error;

347357

}

348358

} finally {

@@ -739,6 +749,7 @@ export async function attachWebInboxToSocket(

739749

const processDurableInboundMessage = async (

740750

msg: WAMessage,

741751

upsertType: string | undefined,

752+

receiveOrder: number | undefined,

742753

stored?: {

743754

id: string;

744755

payload: WhatsAppDurableInboundPayload;

@@ -827,6 +838,7 @@ export async function attachWebInboxToSocket(

827838

await enqueueInboundMessage(msg, inbound, enriched, {

828839

durableId,

829840

readReceipt: deliveryReadReceipt,

841+

receiveOrder,

830842

});

831843

};

832844

@@ -836,6 +848,7 @@ export async function attachWebInboxToSocket(

836848

await processDurableInboundMessage(

837849

deserializeWhatsAppDurableInboundMessage(record.payload.message),

838850

record.payload.upsertType,

851+

record.payload.receivedAt,

839852

{

840853

id: record.id,

841854

payload: record.payload,

@@ -917,6 +930,7 @@ export async function attachWebInboxToSocket(

917930

durable: {

918931

durableId?: string;

919932

readReceipt?: WhatsAppReadReceiptTarget;

933+

receiveOrder?: number;

920934

},

921935

) => {

922936

const chatJid = inbound.remoteJid;

@@ -1023,6 +1037,7 @@ export async function attachWebInboxToSocket(

10231037

dedupeKey: inbound.id ? `${options.accountId}:${inbound.remoteJid}:${inbound.id}` : undefined,

10241038

durableId: durable.durableId,

10251039

readReceipt: durable.readReceipt,

1040+

receiveOrder: durable.receiveOrder,

10261041

};

10271042

const debounceKey = buildInboundDebounceKey(inboundMessage);

10281043

if (debounceKey) {

@@ -1053,11 +1068,13 @@ export async function attachWebInboxToSocket(

10531068

};

1054106910551070

const pendingMessageHandlers = new Set<Promise<void>>();

1071+

let nextReceiveOrder = 0;

10561072

const handleMessagesUpsert = async (upsert: { type?: string; messages?: Array<WAMessage> }) => {

10571073

if (upsert.type !== "notify" && upsert.type !== "append") {

10581074

return;

10591075

}

10601076

for (const msg of upsert.messages ?? []) {

1077+

const receiveOrder = nextReceiveOrder++;

10611078

if (

10621079

await maybeResolveWhatsAppApprovalReaction({

10631080

cfg: options.loadConfig?.() ?? options.cfg,

@@ -1072,7 +1089,7 @@ export async function attachWebInboxToSocket(

10721089

continue;

10731090

}

107410911075-

await processDurableInboundMessage(msg, upsert.type);

1092+

await processDurableInboundMessage(msg, upsert.type, receiveOrder);

10761093

}

10771094

};

10781095

const handleMessagesUpsertEvent = (upsert: { type?: string; messages?: Array<WAMessage> }) => {