Skip to content

Commit fc20106

Browse files
committed
fix: normalize Feishu delivery.to before comparing with messaging tool targets
- Add normalizeDeliveryTarget helper to strip user:/chat: prefixes for Feishu - Apply normalization in matchesMessagingToolDeliveryTarget before comparison - This ensures cron duplicate suppression works when session uses prefixed targets (user:ou_xxx) but messaging tool extract uses normalized bare IDs (ou_xxx) Fixes review comment on PR openclaw#32755
1 parent e2899ee commit fc20106

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/cron/isolated-agent/delivery-dispatch.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ import {
2121
waitForDescendantSubagentSummary,
2222
} from "./subagent-followup.js";
2323

24+
function normalizeDeliveryTarget(channel: string, to: string): string {
25+
const channelLower = channel.trim().toLowerCase();
26+
const toTrimmed = to.trim();
27+
if (channelLower === "feishu" || channelLower === "lark") {
28+
const lowered = toTrimmed.toLowerCase();
29+
if (lowered.startsWith("user:")) {
30+
return toTrimmed.slice("user:".length).trim();
31+
}
32+
if (lowered.startsWith("chat:")) {
33+
return toTrimmed.slice("chat:".length).trim();
34+
}
35+
}
36+
return toTrimmed;
37+
}
38+
2439
export function matchesMessagingToolDeliveryTarget(
2540
target: { provider?: string; to?: string; accountId?: string },
2641
delivery: { channel?: string; to?: string; accountId?: string },
@@ -36,7 +51,8 @@ export function matchesMessagingToolDeliveryTarget(
3651
if (target.accountId && delivery.accountId && target.accountId !== delivery.accountId) {
3752
return false;
3853
}
39-
return target.to === delivery.to;
54+
const normalizedDeliveryTo = normalizeDeliveryTarget(channel, delivery.to);
55+
return target.to === normalizedDeliveryTo;
4056
}
4157

4258
export function resolveCronDeliveryBestEffort(job: CronJob): boolean {

0 commit comments

Comments
 (0)