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

推荐订阅源

罗磊的独立博客
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
A
About on SuperTechFans
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
D
DataBreaches.Net
B
Blog
博客园 - 【当耐特】
爱范儿
爱范儿
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
WordPress大学
WordPress大学
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
I
InfoQ
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
Microsoft Azure Blog
Microsoft Azure Blog
雷峰网
雷峰网
量子位
G
Google Developers 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
fix(sessions): batch store cap maintenance · openclaw/ope...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -40,6 +40,7 @@ import {

4040

getActiveSessionMaintenanceWarning,

4141

pruneStaleEntries,

4242

rotateSessionFile,

43+

shouldRunSessionEntryMaintenance,

4344

type ResolvedSessionMaintenanceConfig,

4445

type SessionMaintenanceWarning,

4546

} from "./store-maintenance.js";

@@ -243,10 +244,16 @@ async function saveSessionStoreUnlocked(

243244

: { ...resolveMaintenanceConfig(), ...opts?.maintenanceOverride };

244245

const shouldWarnOnly = maintenance.mode === "warn";

245246

const beforeCount = Object.keys(store).length;

247+

const forceMaintenance = opts?.maintenanceOverride !== undefined;

248+

const shouldRunEntryMaintenance = shouldRunSessionEntryMaintenance({

249+

entryCount: beforeCount,

250+

maxEntries: maintenance.maxEntries,

251+

force: forceMaintenance,

252+

});

246253247254

if (shouldWarnOnly) {

248255

const activeSessionKey = opts?.activeSessionKey?.trim();

249-

if (activeSessionKey) {

256+

if (activeSessionKey && shouldRunEntryMaintenance) {

250257

const warning = getActiveSessionMaintenanceWarning({

251258

store,

252259

activeSessionKey,

@@ -292,12 +299,21 @@ async function saveSessionStoreUnlocked(

292299

},

293300

preserveKeys: preserveSessionKeys,

294301

});

295-

const capped = capEntryCount(store, maintenance.maxEntries, {

296-

onCapped: ({ entry }) => {

297-

rememberRemovedSessionFile(removedSessionFiles, entry);

298-

},

299-

preserveKeys: preserveSessionKeys,

300-

});

302+

const countAfterPrune = Object.keys(store).length;

303+

const shouldRunCapMaintenance =

304+

forceMaintenance ||

305+

shouldRunSessionEntryMaintenance({

306+

entryCount: countAfterPrune,

307+

maxEntries: maintenance.maxEntries,

308+

});

309+

const capped = shouldRunCapMaintenance

310+

? capEntryCount(store, maintenance.maxEntries, {

311+

onCapped: ({ entry }) => {

312+

rememberRemovedSessionFile(removedSessionFiles, entry);

313+

},

314+

preserveKeys: preserveSessionKeys,

315+

})

316+

: 0;

301317

const archivedDirs = new Set<string>();

302318

const referencedSessionIds = new Set(

303319

Object.values(store)

@@ -425,7 +441,7 @@ export async function updateSessionStore<T>(

425441

): Promise<T> {

426442

return await withSessionStoreLock(storePath, async () => {

427443

// Always re-read inside the lock to avoid clobbering concurrent writers.

428-

const store = loadSessionStore(storePath, { skipCache: true });

444+

const store = loadSessionStore(storePath, { skipCache: true, clone: false });

429445

const previousAcpByKey = collectAcpMetadataSnapshot(store);

430446

const result = await mutator(store);

431447

preserveExistingAcpMetadata({

@@ -648,7 +664,7 @@ export async function updateSessionStoreEntry(params: {

648664

}): Promise<SessionEntry | null> {

649665

const { storePath, sessionKey, update } = params;

650666

return await withSessionStoreLock(storePath, async () => {

651-

const store = loadSessionStore(storePath, { skipCache: true });

667+

const store = loadSessionStore(storePath, { skipCache: true, clone: false });

652668

const resolved = resolveSessionStoreEntry({ store, sessionKey });

653669

const existing = resolved.existing;

654670

if (!existing) {