fix(reply): narrow cross-run suppression and harden dedupe-state persistence

This commit is contained in:
Kim 2026-02-27 13:51:30 +08:00 committed by KimGLee
parent 15dd43f6bc
commit a1e6f0f943
2 changed files with 21 additions and 14 deletions

View File

@ -440,16 +440,24 @@ export async function runReplyAgent(params: {
activeSessionStore[sessionKey] = sessionDedupeEntry;
}
if (sessionKey && storePath) {
await updateSessionStoreEntry({
storePath,
sessionKey,
update: async () => ({
lastMessagingToolSentAt: sessionDedupeEntry.lastMessagingToolSentAt,
lastMessagingToolSentTexts: sessionDedupeEntry.lastMessagingToolSentTexts,
lastMessagingToolSentMediaUrls: sessionDedupeEntry.lastMessagingToolSentMediaUrls,
lastMessagingToolSentTargets: sessionDedupeEntry.lastMessagingToolSentTargets,
}),
});
try {
await updateSessionStoreEntry({
storePath,
sessionKey,
update: async () => ({
lastMessagingToolSentAt: sessionDedupeEntry.lastMessagingToolSentAt,
lastMessagingToolSentTexts: sessionDedupeEntry.lastMessagingToolSentTexts,
lastMessagingToolSentMediaUrls: sessionDedupeEntry.lastMessagingToolSentMediaUrls,
lastMessagingToolSentTargets: sessionDedupeEntry.lastMessagingToolSentTargets,
}),
});
} catch (error) {
logger.warning(
"Failed to persist messaging-tool dedupe state for session {}: {}",
sessionKey,
error,
);
}
}
}

View File

@ -330,10 +330,9 @@ export function createFollowupRunner(params: {
...(runResult.messagingToolSentMediaUrls ?? []),
...(recentWindowActive ? (sessionEntry?.lastMessagingToolSentMediaUrls ?? []) : []),
];
const sentTargets = [
...(runResult.messagingToolSentTargets ?? []),
...(recentWindowActive ? (sessionEntry?.lastMessagingToolSentTargets ?? []) : []),
];
// Keep target-based suppression scoped to the current run only.
// Session-level dedupe state is used for text/media duplicate filtering.
const sentTargets = runResult.messagingToolSentTargets ?? [];
const dedupedPayloads = filterMessagingToolDuplicates({
payloads: replyTaggedPayloads,