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

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
D
DataBreaches.Net
腾讯CDC
I
InfoQ
F
Fortinet All Blogs
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
月光博客
月光博客
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog

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
refactor: remove Feishu runtime dedupe JSON fallback · op...
steipete · 2026-06-04 · via Recent Commits to openclaw:main

@@ -1,7 +1,4 @@

11

import { createHash } from "node:crypto";

2-

import os from "node:os";

3-

import path from "node:path";

4-

import { loadJsonFile } from "openclaw/plugin-sdk/json-store";

52

import type { PluginStateSyncKeyedStore } from "openclaw/plugin-sdk/plugin-state-runtime";

63

import {

74

releaseFeishuMessageProcessing,

@@ -20,11 +17,8 @@ type FeishuDedupStoreEntry = {

2017

};

21182219

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

23-

const importedLegacyNamespaces = new Set<string>();

2420

const cachedDedupStores = new Map<string, PluginStateSyncKeyedStore<FeishuDedupStoreEntry>>();

252126-

type LegacyDedupeData = Record<string, number>;

27-2822

function normalizeMessageId(messageId: string | undefined | null): string | null {

2923

const trimmed = messageId?.trim();

3024

return trimmed ? trimmed : null;

@@ -34,22 +28,6 @@ function normalizeNamespace(namespace?: string): string {

3428

return namespace?.trim() || "global";

3529

}

363037-

function resolveLegacyStateDir(env: NodeJS.ProcessEnv = process.env): string {

38-

const stateOverride = env.OPENCLAW_STATE_DIR?.trim();

39-

if (stateOverride) {

40-

return stateOverride;

41-

}

42-

if (env.VITEST || env.NODE_ENV === "test") {

43-

return path.join(os.tmpdir(), ["openclaw-vitest", String(process.pid)].join("-"));

44-

}

45-

return path.join(os.homedir(), ".openclaw");

46-

}

47-48-

function resolveLegacyNamespaceFilePath(namespace: string): string {

49-

const safe = namespace.replace(/[^a-zA-Z0-9_-]/g, "_");

50-

return path.join(resolveLegacyStateDir(), "feishu", "dedup", `${safe}.json`);

51-

}

52-5331

function pluginStateNamespace(namespace: string): string {

5432

return `dedup.${namespace.replace(/[^a-zA-Z0-9_-]/g, "_")}`;

5533

}

@@ -116,52 +94,6 @@ function hasMemory(namespace: string, messageId: string, now = Date.now()): bool

11694

return false;

11795

}

11896119-

function sanitizeLegacyDedupeData(value: unknown): LegacyDedupeData {

120-

if (!value || typeof value !== "object" || Array.isArray(value)) {

121-

return {};

122-

}

123-

const out: LegacyDedupeData = {};

124-

for (const [key, seenAt] of Object.entries(value as Record<string, unknown>)) {

125-

if (typeof seenAt === "number" && Number.isFinite(seenAt) && seenAt > 0) {

126-

out[key] = seenAt;

127-

}

128-

}

129-

return out;

130-

}

131-132-

function importLegacyDedupNamespace(

133-

namespace: string,

134-

now = Date.now(),

135-

log?: (...args: unknown[]) => void,

136-

): void {

137-

if (importedLegacyNamespaces.has(namespace)) {

138-

return;

139-

}

140-141-

try {

142-

const data = sanitizeLegacyDedupeData(loadJsonFile(resolveLegacyNamespaceFilePath(namespace)));

143-

const store = openDedupStore(namespace);

144-

for (const [messageId, seenAt] of Object.entries(data)) {

145-

if (!isRecent(seenAt, now)) {

146-

continue;

147-

}

148-

const key = dedupeStoreKey(namespace, messageId);

149-

if (store.lookup(key) != null) {

150-

continue;

151-

}

152-

store.register(

153-

key,

154-

{ namespace, messageId, seenAt },

155-

{ ttlMs: Math.max(1, DEDUP_TTL_MS - (now - seenAt)) },

156-

);

157-

}

158-

importedLegacyNamespaces.add(namespace);

159-

} catch (error) {

160-

importedLegacyNamespaces.delete(namespace);

161-

log?.(`feishu-dedup: legacy state import failed: ${String(error)}`);

162-

}

163-

}

164-16597

export { releaseFeishuMessageProcessing, tryBeginFeishuMessageProcessing };

1669816799

export async function claimUnprocessedFeishuMessage(params: {

@@ -259,7 +191,6 @@ export async function tryRecordMessagePersistent(

259191

return true;

260192

}

261193

const now = Date.now();

262-

importLegacyDedupNamespace(normalizedNamespace, now, log);

263194

if (hasMemory(normalizedNamespace, normalizedMessageId, now)) {

264195

return false;

265196

}

@@ -318,7 +249,6 @@ async function hasRecordedMessagePersistent(

318249

return false;

319250

}

320251

const now = Date.now();

321-

importLegacyDedupNamespace(normalizedNamespace, now, log);

322252

if (hasMemory(normalizedNamespace, normalizedMessageId, now)) {

323253

return true;

324254

}

@@ -337,15 +267,14 @@ async function hasRecordedMessagePersistent(

337267

}

338268

}

339269340-

export async function warmupDedupFromDisk(

270+

export async function warmupDedupFromPluginState(

341271

namespace: string,

342272

log?: (...args: unknown[]) => void,

343273

): Promise<number> {

344274

const normalizedNamespace = normalizeNamespace(namespace);

345275

try {

346276

let loaded = 0;

347277

const now = Date.now();

348-

importLegacyDedupNamespace(normalizedNamespace, now, log);

349278

for (const entry of openDedupStore(normalizedNamespace).entries()) {

350279

if (entry.value.namespace !== normalizedNamespace || !isRecent(entry.value.seenAt, now)) {

351280

continue;

@@ -363,7 +292,6 @@ export async function warmupDedupFromDisk(

363292

export const testingHooks = {

364293

resetFeishuDedupForTests() {

365294

memory.clear();

366-

importedLegacyNamespaces.clear();

367295

for (const store of cachedDedupStores.values()) {

368296

store.clear();

369297

}