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

推荐订阅源

C
Check Point Blog
IT之家
IT之家
V
Visual Studio Blog
The Cloudflare Blog
博客园 - 司徒正美
Jina AI
Jina AI
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
S
SegmentFault 最新的问题
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿
博客园 - Franky
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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
perf(gateway): borrow read-only session metadata · opencl...
steipete · 2026-05-27 · via Recent Commits to openclaw:main

@@ -69,6 +69,7 @@ function resolveLegacyMainStoreSessionForDefaultAgent(opts: {

6969

sessionKey?: string;

7070

sessionStore: Record<string, SessionEntry>;

7171

storePath: string;

72+

cloneOnWrite?: boolean;

7273

}): SessionKeyResolution | undefined {

7374

if (opts.defaultAgentId === DEFAULT_AGENT_ID || !opts.sessionKey) {

7475

return undefined;

@@ -92,24 +93,29 @@ function resolveLegacyMainStoreSessionForDefaultAgent(opts: {

9293

for (const legacyKey of legacyKeys) {

9394

const legacyEntry = opts.sessionStore[legacyKey];

9495

if (legacyEntry) {

95-

opts.sessionStore[opts.sessionKey] = { ...legacyEntry };

96+

const sessionStore = opts.cloneOnWrite ? { ...opts.sessionStore } : opts.sessionStore;

97+

sessionStore[opts.sessionKey] = { ...legacyEntry };

9698

return {

9799

sessionKey: opts.sessionKey,

98-

sessionStore: opts.sessionStore,

100+

sessionStore,

99101

storePath: opts.storePath,

100102

};

101103

}

102104

}

103105

return undefined;

104106

}

105-

const legacyStore = loadSessionStore(legacyStorePath);

107+

const legacyStore = loadSessionStore(

108+

legacyStorePath,

109+

opts.cloneOnWrite ? { clone: false } : undefined,

110+

);

106111

for (const legacyKey of legacyKeys) {

107112

const legacyEntry = legacyStore[legacyKey];

108113

if (legacyEntry) {

109-

opts.sessionStore[opts.sessionKey] = { ...legacyEntry };

114+

const sessionStore = opts.cloneOnWrite ? { ...opts.sessionStore } : opts.sessionStore;

115+

sessionStore[opts.sessionKey] = { ...legacyEntry };

110116

return {

111117

sessionKey: opts.sessionKey,

112-

sessionStore: opts.sessionStore,

118+

sessionStore,

113119

storePath: opts.storePath,

114120

};

115121

}

@@ -124,6 +130,7 @@ function collectSessionIdMatchesForRequest(opts: {

124130

storeAgentId?: string;

125131

sessionId: string;

126132

searchOtherAgentStores: boolean;

133+

clone?: boolean;

127134

}): SessionIdMatchSet {

128135

const matches: Array<[string, SessionEntry]> = [];

129136

const primaryStoreMatches: Array<[string, SessionEntry]> = [];

@@ -160,7 +167,10 @@ function collectSessionIdMatchesForRequest(opts: {

160167

continue;

161168

}

162169

const candidateStorePath = resolveStorePath(opts.cfg.session?.store, { agentId });

163-

addMatches(loadSessionStore(candidateStorePath), candidateStorePath);

170+

addMatches(

171+

loadSessionStore(candidateStorePath, opts.clone === false ? { clone: false } : undefined),

172+

candidateStorePath,

173+

);

164174

}

165175166176

return { matches, primaryStoreMatches, storeByKey };

@@ -203,6 +213,7 @@ export function resolveSessionKeyForRequest(opts: {

203213

sessionId?: string;

204214

sessionKey?: string;

205215

agentId?: string;

216+

clone?: boolean;

206217

}): SessionKeyResolution {

207218

const sessionCfg = opts.cfg.session;

208219

const scope = sessionCfg?.scope ?? "per-sender";

@@ -226,7 +237,8 @@ export function resolveSessionKeyForRequest(opts: {

226237

const storePath = resolveStorePath(sessionCfg?.store, {

227238

agentId: storeAgentId,

228239

});

229-

const sessionStore = loadSessionStore(storePath);

240+

const loadOptions = opts.clone === false ? { clone: false as const } : undefined;

241+

const sessionStore = loadSessionStore(storePath, loadOptions);

230242231243

const ctx: MsgContext | undefined = opts.to?.trim() ? { From: opts.to } : undefined;

232244

let sessionKey: string | undefined =

@@ -240,6 +252,7 @@ export function resolveSessionKeyForRequest(opts: {

240252

sessionKey,

241253

sessionStore,

242254

storePath,

255+

cloneOnWrite: opts.clone === false,

243256

});

244257

if (legacyMainSession) {

245258

return legacyMainSession;

@@ -262,6 +275,7 @@ export function resolveSessionKeyForRequest(opts: {

262275

storeAgentId,

263276

sessionId: requestedSessionId,

264277

searchOtherAgentStores: requestedAgentId === undefined,

278+

...(opts.clone === false ? { clone: false } : {}),

265279

});

266280

const preferredSelection = resolveSessionIdMatchSelection(matches, requestedSessionId);

267281

const currentStoreSelection =

@@ -293,6 +307,7 @@ export function resolveSession(opts: {

293307

sessionId?: string;

294308

sessionKey?: string;

295309

agentId?: string;

310+

clone?: boolean;

296311

}): SessionResolution {

297312

const sessionCfg = opts.cfg.session;

298313

const { sessionKey, sessionStore, storePath } = resolveSessionKeyForRequest({

@@ -301,6 +316,7 @@ export function resolveSession(opts: {

301316

sessionId: opts.sessionId,

302317

sessionKey: opts.sessionKey,

303318

agentId: opts.agentId,

319+

...(opts.clone === false ? { clone: false } : {}),

304320

});

305321

const now = Date.now();

306322