惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
B
Blog
博客园_首页
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
量子位
V
V2EX
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
I
InfoQ
博客园 - 【当耐特】

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(telegram): delete retired dispatch dedupe buckets aft...
obviyus · 2026-06-10 · via Recent Commits to openclaw:main

@@ -5,7 +5,6 @@ import type { ChannelLegacyStateMigrationPlan } from "openclaw/plugin-sdk/channe

55

import { resolveChannelAllowFromPath } from "openclaw/plugin-sdk/channel-pairing";

66

import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";

77

import {

8-

type PersistentDedupeEntry,

98

type PersistentDedupeLegacyJsonImportEntry,

109

createPersistentDedupeImportEntry,

1110

listPersistentDedupeLegacyJsonFileEntries,

@@ -130,28 +129,45 @@ function remainingMessageDispatchDedupeTtlMs(seenAt: number, now: number): numbe

130129

return ttlMs > 0 ? ttlMs : undefined;

131130

}

132131133-

function listTelegramLegacyMessageDispatchPluginStateEntries(params: {

134-

accountId: string;

135-

env: NodeJS.ProcessEnv;

136-

now?: number;

137-

}): PersistentDedupeLegacyJsonImportEntry[] {

138-

const store = createPluginStateSyncKeyedStore<unknown>("telegram", {

132+

function openTelegramLegacyMessageDispatchBucketStore(env: NodeJS.ProcessEnv) {

133+

return createPluginStateSyncKeyedStore<unknown>("telegram", {

139134

namespace: TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_NAMESPACE,

140135

maxEntries: TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_MAX_ENTRIES,

141-

env: params.env,

136+

env,

142137

});

138+

}

139+140+

function readTelegramLegacyMessageDispatchBuckets(params: {

141+

accountId: string;

142+

env: NodeJS.ProcessEnv;

143+

now?: number;

144+

}): { importEntries: PersistentDedupeLegacyJsonImportEntry[]; recordKeys: string[] } {

145+

const store = openTelegramLegacyMessageDispatchBucketStore(params.env);

143146

const latestSeenAtByKey = new Map<string, number>();

147+

const recordKeys: string[] = [];

144148

for (const entry of store.entries()) {

145149

const record = readLegacyMessageDispatchDedupeRecord(entry.value);

146-

if (!record || record.namespace !== params.accountId) {

150+

if (!record) {

151+

continue;

152+

}

153+

// Lock rows persist as `<accountId>:lock` buckets without dedupe entries;

154+

// track them as removable so cleanup empties the retired namespace.

155+

const ownsRecord =

156+

record.namespace === params.accountId ||

157+

record.namespace.startsWith(`${params.accountId}:`);

158+

if (!ownsRecord) {

159+

continue;

160+

}

161+

recordKeys.push(entry.key);

162+

if (record.namespace !== params.accountId) {

147163

continue;

148164

}

149165

for (const [key, seenAt] of Object.entries(record.entries)) {

150166

latestSeenAtByKey.set(key, Math.max(latestSeenAtByKey.get(key) ?? 0, seenAt));

151167

}

152168

}

153169

const now = params.now ?? Date.now();

154-

return [...latestSeenAtByKey.entries()].flatMap(([key, seenAt]) => {

170+

const importEntries = [...latestSeenAtByKey.entries()].flatMap(([key, seenAt]) => {

155171

const ttlMs = remainingMessageDispatchDedupeTtlMs(seenAt, now);

156172

return ttlMs == null

157173

? []

@@ -166,33 +182,17 @@ function listTelegramLegacyMessageDispatchPluginStateEntries(params: {

166182

}),

167183

];

168184

});

185+

return { importEntries, recordKeys };

169186

}

170187171-

function hasCurrentMessageDispatchDedupeTargets(params: {

172-

namespace: string;

173-

entries: PersistentDedupeLegacyJsonImportEntry[];

188+

function removeTelegramLegacyMessageDispatchBuckets(params: {

189+

accountId: string;

174190

env: NodeJS.ProcessEnv;

175-

}): boolean {

176-

const store = createPluginStateSyncKeyedStore<PersistentDedupeEntry>(

177-

TELEGRAM_MESSAGE_DISPATCH_DEDUPE_STATE_PLUGIN_ID,

178-

{

179-

namespace: params.namespace,

180-

maxEntries: TELEGRAM_MESSAGE_DISPATCH_DEDUPE_STATE_MAX_ENTRIES,

181-

defaultTtlMs: TELEGRAM_MESSAGE_DISPATCH_DEDUPE_TTL_MS,

182-

env: params.env,

183-

},

184-

);

185-

const existingByKey = new Map(store.entries().map((entry) => [entry.key, entry.value]));

186-

return params.entries.every((entry) => {

187-

const existingValue = existingByKey.get(entry.key);

188-

return (

189-

existingValue != null &&

190-

!shouldReplacePersistentDedupeEntry({

191-

existingValue,

192-

incomingValue: entry.value,

193-

})

194-

);

195-

});

191+

}): void {

192+

const store = openTelegramLegacyMessageDispatchBucketStore(params.env);

193+

for (const key of readTelegramLegacyMessageDispatchBuckets(params).recordKeys) {

194+

store.delete(key);

195+

}

196196

}

197197198198

function mapTelegramMessageDispatchDedupeImportEntries(params: {

@@ -491,19 +491,15 @@ function detectTelegramMessageDispatchLegacyStateMigration(params: {

491491

}),

492492

};

493493

});

494-

let pluginStateEntries: PersistentDedupeLegacyJsonImportEntry[];

494+

let legacyRecordKeys: string[];

495495

try {

496-

pluginStateEntries = listTelegramLegacyMessageDispatchPluginStateEntries({

497-

accountId,

498-

env,

499-

});

496+

legacyRecordKeys = readTelegramLegacyMessageDispatchBuckets({ accountId, env }).recordKeys;

500497

} catch {

501-

pluginStateEntries = [];

498+

legacyRecordKeys = [];

502499

}

503-

if (

504-

pluginStateEntries.length === 0 ||

505-

hasCurrentMessageDispatchDedupeTargets({ namespace, entries: pluginStateEntries, env })

506-

) {

500+

// Emit the plan while any retired bucket rows remain (even TTL-expired ones)

501+

// so doctor --fix imports live entries and then deletes the legacy source.

502+

if (legacyRecordKeys.length === 0) {

507503

return jsonPlans;

508504

}

509505

const pluginStatePlan: ChannelLegacyStateMigrationPlan = {

@@ -516,14 +512,12 @@ function detectTelegramMessageDispatchLegacyStateMigration(params: {

516512

maxEntries: TELEGRAM_MESSAGE_DISPATCH_DEDUPE_STATE_MAX_ENTRIES,

517513

defaultTtlMs: TELEGRAM_MESSAGE_DISPATCH_DEDUPE_TTL_MS,

518514

scopeKey: "",

515+

cleanupWhenEmpty: true,

519516

preview: `- Telegram message dispatch dedupe: plugin state (${TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_NAMESPACE}) → plugin state (${namespace})`,

520517

shouldReplaceExistingEntry: ({ existingValue, incomingValue }) =>

521518

shouldReplacePersistentDedupeEntry({ existingValue, incomingValue }),

522-

readEntries: () =>

523-

listTelegramLegacyMessageDispatchPluginStateEntries({

524-

accountId,

525-

env,

526-

}),

519+

readEntries: () => readTelegramLegacyMessageDispatchBuckets({ accountId, env }).importEntries,

520+

removeSource: () => removeTelegramLegacyMessageDispatchBuckets({ accountId, env }),

527521

};

528522

return jsonPlans.concat(pluginStatePlan);

529523

});