mirror of https://github.com/openclaw/openclaw.git
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 #32755
This commit is contained in:
parent
e2899ee393
commit
fc20106f16
|
|
@ -21,6 +21,21 @@ import {
|
|||
waitForDescendantSubagentSummary,
|
||||
} from "./subagent-followup.js";
|
||||
|
||||
function normalizeDeliveryTarget(channel: string, to: string): string {
|
||||
const channelLower = channel.trim().toLowerCase();
|
||||
const toTrimmed = to.trim();
|
||||
if (channelLower === "feishu" || channelLower === "lark") {
|
||||
const lowered = toTrimmed.toLowerCase();
|
||||
if (lowered.startsWith("user:")) {
|
||||
return toTrimmed.slice("user:".length).trim();
|
||||
}
|
||||
if (lowered.startsWith("chat:")) {
|
||||
return toTrimmed.slice("chat:".length).trim();
|
||||
}
|
||||
}
|
||||
return toTrimmed;
|
||||
}
|
||||
|
||||
export function matchesMessagingToolDeliveryTarget(
|
||||
target: { provider?: string; to?: string; accountId?: string },
|
||||
delivery: { channel?: string; to?: string; accountId?: string },
|
||||
|
|
@ -36,7 +51,8 @@ export function matchesMessagingToolDeliveryTarget(
|
|||
if (target.accountId && delivery.accountId && target.accountId !== delivery.accountId) {
|
||||
return false;
|
||||
}
|
||||
return target.to === delivery.to;
|
||||
const normalizedDeliveryTo = normalizeDeliveryTarget(channel, delivery.to);
|
||||
return target.to === normalizedDeliveryTo;
|
||||
}
|
||||
|
||||
export function resolveCronDeliveryBestEffort(job: CronJob): boolean {
|
||||
|
|
|
|||
Loading…
Reference in New Issue