From 0bee3f337ae5d089dee294fde2beb3d4e5f52a3b Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sat, 21 Feb 2026 16:57:50 +0900 Subject: [PATCH] MSTeams: dedupe sent-message cache storage (#22514) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 88e14dcbe13006c4d1f353c0e7e196175747a4c8 Co-authored-by: TaKO8Ki <41065217+TaKO8Ki@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus --- CHANGELOG.md | 1 + extensions/msteams/src/sent-message-cache.ts | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac27e22411..439b213ccd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Docs: https://docs.openclaw.ai - Security/Unused Dependencies: fix A2UI bundle resolution for removed root `lit` deps by resolving `lit`, `@lit/context`, `@lit-labs/signals`, and `signal-utils` from UI workspace dependencies in `rolldown.config.mjs` during bundling. (#22481) Thanks @vincentkoc. - Security/Unused Dependencies: simplify `canvas-a2ui` bundling script by removing temporary vendored `node_modules` symlink logic now that `ui` workspace dependencies are explicit. (#22481) Thanks @vincentkoc. - Security/Unused Dependencies: remove unused `@microsoft/agents-hosting-express` and `@microsoft/agents-hosting-extensions-teams` from `extensions/msteams` because current code only uses `@microsoft/agents-hosting`. Thanks @vincentkoc. +- MSTeams: dedupe sent-message cache storage by removing duplicate per-message Set storage and using timestamps Map keys as the single membership source. (#22514) Thanks @TaKO8Ki. - Security/Unused Dependencies: remove unused plugin-local `openclaw` devDependencies from `extensions/open-prose`, `extensions/lobster`, and `extensions/llm-task` after removing this dependency from build-time requirements. (#22495) Thanks @vincentkoc. - Agents/Subagents: default subagent spawn depth now uses shared `maxSpawnDepth=2`, enabling depth-1 orchestrator spawning by default while keeping depth policy checks consistent across spawn and prompt paths. (#22223) Thanks @tyler6204. - Channels/CLI: add per-account/channel `defaultTo` outbound routing fallback so `openclaw agent --deliver` can send without explicit `--reply-to` when a default target is configured. (#16985) Thanks @KirillShchetinin. diff --git a/extensions/msteams/src/sent-message-cache.ts b/extensions/msteams/src/sent-message-cache.ts index 1085d096bcc..f31647cefc9 100644 --- a/extensions/msteams/src/sent-message-cache.ts +++ b/extensions/msteams/src/sent-message-cache.ts @@ -1,7 +1,6 @@ const TTL_MS = 24 * 60 * 60 * 1000; // 24 hours type CacheEntry = { - messageIds: Set; timestamps: Map; }; @@ -11,7 +10,6 @@ function cleanupExpired(entry: CacheEntry): void { const now = Date.now(); for (const [msgId, timestamp] of entry.timestamps) { if (now - timestamp > TTL_MS) { - entry.messageIds.delete(msgId); entry.timestamps.delete(msgId); } } @@ -23,12 +21,11 @@ export function recordMSTeamsSentMessage(conversationId: string, messageId: stri } let entry = sentMessages.get(conversationId); if (!entry) { - entry = { messageIds: new Set(), timestamps: new Map() }; + entry = { timestamps: new Map() }; sentMessages.set(conversationId, entry); } - entry.messageIds.add(messageId); entry.timestamps.set(messageId, Date.now()); - if (entry.messageIds.size > 200) { + if (entry.timestamps.size > 200) { cleanupExpired(entry); } } @@ -39,7 +36,7 @@ export function wasMSTeamsMessageSent(conversationId: string, messageId: string) return false; } cleanupExpired(entry); - return entry.messageIds.has(messageId); + return entry.timestamps.has(messageId); } export function clearMSTeamsSentMessageCache(): void {