tao-shen Claude Opus 4.6 commited on
Commit
82cff1a
·
1 Parent(s): 0b89684

fix: update monitor.ts patch for upstream refactor

Browse files

Upstream OpenClaw refactored monitorWebInbox into smaller functions
(normalizeInboundMessage, enrichInboundMessage, enqueueInboundMessage).
Update the patch to match the new code structure — still moves
recordChannelActivity to after message enrichment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

patches/web-inbound-record-activity-after-body.patch CHANGED
@@ -1,6 +1,8 @@
 
 
1
  --- a/src/web/inbound/monitor.ts
2
  +++ b/src/web/inbound/monitor.ts
3
- @@ -155,11 +155,6 @@ export async function monitorWebInbox(options: {
4
  return;
5
  }
6
  for (const msg of upsert.messages ?? []) {
@@ -9,19 +11,18 @@
9
  - accountId: options.accountId,
10
  - direction: "inbound",
11
  - });
12
- const id = msg.key?.id ?? undefined;
13
- const remoteJid = msg.key?.remoteJid;
14
- if (!remoteJid) {
15
- @@ -328,6 +323,11 @@ export async function monitorWebInbox(options: {
16
- mediaPath,
17
- mediaType,
18
- mediaFileName,
19
- };
20
  + recordChannelActivity({
21
  + channel: "whatsapp",
22
  + accountId: options.accountId,
23
  + direction: "inbound",
24
  + });
25
- try {
26
- const task = Promise.resolve(debouncer.enqueue(inboundMessage));
27
- void task.catch((err) => {
 
1
+ diff --git a/src/web/inbound/monitor.ts b/src/web/inbound/monitor.ts
2
+ index 6dc2ce5..982e5a5 100644
3
  --- a/src/web/inbound/monitor.ts
4
  +++ b/src/web/inbound/monitor.ts
5
+ @@ -399,11 +399,6 @@ export async function monitorWebInbox(options: {
6
  return;
7
  }
8
  for (const msg of upsert.messages ?? []) {
 
11
  - accountId: options.accountId,
12
  - direction: "inbound",
13
  - });
14
+ const inbound = await normalizeInboundMessage(msg);
15
+ if (!inbound) {
16
+ continue;
17
+ @@ -421,6 +416,11 @@ export async function monitorWebInbox(options: {
18
+ continue;
19
+ }
20
+
 
21
  + recordChannelActivity({
22
  + channel: "whatsapp",
23
  + accountId: options.accountId,
24
  + direction: "inbound",
25
  + });
26
+ await enqueueInboundMessage(msg, inbound, enriched);
27
+ }
28
+ };