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

推荐订阅源

J
Java Code Geeks
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
A
About on SuperTechFans
Vercel News
Vercel News
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
V
Visual Studio Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
美团技术团队

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
chore(deadcode): remove obsolete session maintenance wrap...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -206,13 +206,6 @@ export function pruneStaleEntries(

206206

export const DEFAULT_QUOTA_SUSPENSION_TTL_MS = 30 * 60 * 1000; // 30 minutes

207207

const QUOTA_SUSPENSION_CLEANUP_FACTOR = 2; // entries beyond N*ttl are deleted outright

208208
209-

export interface QuotaSuspensionMaintenanceResult {

210-

/** Suspensions whose state was advanced from "suspended" to "resuming" so the next attempt injects a handoff. */

211-

resumed: Array<{ sessionKey: string; laneId?: string }>;

212-

/** Entries whose `quotaSuspension` field was removed entirely (already-resumed records past 2x TTL). */

213-

cleared: number;

214-

}

215-
216209

export type QuotaSuspensionEntryMaintenanceResult = {

217210

/** Patch to apply to the entry, or null when no TTL transition is due. */

218211

patch: Partial<SessionEntry> | null;

@@ -253,54 +246,6 @@ export function resolveQuotaSuspensionEntryMaintenance(params: {

253246

return { patch: null, cleared: false };

254247

}

255248
256-

/**

257-

* Two-stage TTL maintenance for `quotaSuspension` records:

258-

* 1. After `ttlMs`, transition `state: "suspended" → "resuming"` so the next

259-

* attempt for that session sees the resume marker and injects a handoff.

260-

* 2. After `2 * ttlMs`, drop the field entirely (the record has done its job).

261-

*

262-

* Mutates `store` in-place. The caller is responsible for translating the

263-

* returned `resumed[]` into in-process lane-concurrency restoration calls,

264-

* which keeps this module free of `process/*` dependencies.

265-

*/

266-

export function pruneQuotaSuspensions(params: {

267-

store: Record<string, SessionEntry>;

268-

now: number;

269-

ttlMs?: number;

270-

log?: boolean;

271-

}): QuotaSuspensionMaintenanceResult {

272-

const ttlMs = params.ttlMs ?? DEFAULT_QUOTA_SUSPENSION_TTL_MS;

273-

const resumed: Array<{ sessionKey: string; laneId?: string }> = [];

274-

let cleared = 0;

275-

for (const [sessionKey, entry] of Object.entries(params.store)) {

276-

const result = resolveQuotaSuspensionEntryMaintenance({

277-

entry,

278-

now: params.now,

279-

ttlMs,

280-

});

281-

if (!result.patch) {

282-

continue;

283-

}

284-

if (result.cleared) {

285-

delete entry.quotaSuspension;

286-

cleared++;

287-

} else if (result.patch.quotaSuspension) {

288-

entry.quotaSuspension = result.patch.quotaSuspension;

289-

}

290-

if (result.resumed) {

291-

resumed.push({ sessionKey, laneId: result.resumed.laneId });

292-

}

293-

}

294-

if ((resumed.length > 0 || cleared > 0) && params.log !== false) {

295-

log.info("processed quota-suspension TTLs", {

296-

resumed: resumed.length,

297-

cleared,

298-

ttlMs,

299-

});

300-

}

301-

return { resumed, cleared };

302-

}

303-
304249

function getEntryUpdatedAt(entry?: SessionEntry): number {

305250

return entry?.updatedAt ?? Number.NEGATIVE_INFINITY;

306251

}

Original file line numberDiff line numberDiff line change

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

1010

import {

1111

isProtectedSessionMaintenanceEntry,

1212

resolveMaintenanceConfigFromInput,

13-

pruneQuotaSuspensions,

1413

resolveQuotaSuspensionEntryMaintenance,

1514

resolveSessionEntryMaintenanceHighWater,

1615

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

@@ -146,57 +145,6 @@ describe("resolveQuotaSuspensionEntryMaintenance", () => {

146145

});

147146

});

148147
149-

describe("pruneQuotaSuspensions", () => {

150-

it("returns whole-store resume and clear results from the storage-neutral operation", () => {

151-

const now = Date.now();

152-

const store = makeStore([

153-

[

154-

"suspended",

155-

{

156-

...makeEntry(now),

157-

quotaSuspension: {

158-

schemaVersion: 1,

159-

suspendedAt: now - 30_000,

160-

expectedResumeBy: now - 1,

161-

state: "suspended",

162-

reason: "quota_exhausted",

163-

failedProvider: "anthropic",

164-

failedModel: "claude-opus-4-6",

165-

laneId: "main",

166-

},

167-

},

168-

],

169-

[

170-

"expired",

171-

{

172-

...makeEntry(now),

173-

quotaSuspension: {

174-

schemaVersion: 1,

175-

suspendedAt: now - 61_000,

176-

expectedResumeBy: now - 31_000,

177-

state: "active",

178-

reason: "circuit_open",

179-

failedProvider: "anthropic",

180-

failedModel: "claude-opus-4-6",

181-

laneId: "fallback",

182-

},

183-

},

184-

],

185-

]);

186-
187-

const result = pruneQuotaSuspensions({

188-

store,

189-

now,

190-

ttlMs: 30_000,

191-

log: false,

192-

});

193-
194-

expect(result).toEqual({ resumed: [{ sessionKey: "suspended", laneId: "main" }], cleared: 1 });

195-

expect(store.suspended.quotaSuspension?.state).toBe("resuming");

196-

expect(store.expired.quotaSuspension).toBeUndefined();

197-

});

198-

});

199-
200148

describe("applyFileBackedSessionStoreMaintenance", () => {

201149

it("preserves the active session and cleans artifacts using the final referenced session set", async () => {

202150

const now = Date.now();