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

推荐订阅源

博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
爱范儿
爱范儿
月光博客
月光博客
The GitHub Blog
The GitHub Blog
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
T
Tailwind CSS Blog
美团技术团队
D
Docker
V
Visual Studio Blog
Martin Fowler
Martin Fowler
博客园 - 聂微东
The Cloudflare 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(agents): append text turns asynchronously · open...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -6,9 +6,13 @@ import {

66

resolveSessionFilePathOptions,

77

resolveStorePath,

88

} from "../../config/sessions.js";

9+

import type { SessionEntry } from "../../config/sessions/types.js";

910

import type { OpenClawConfig } from "../../config/types.openclaw.js";

1011

import { callGateway } from "../../gateway/call.js";

11-

import { deriveSessionTitle } from "../../gateway/session-utils.js";

12+

import {

13+

deriveSessionTitle,

14+

readSessionTitleFieldsFromTranscriptAsync,

15+

} from "../../gateway/session-utils.js";

1216

import { resolveAgentIdFromSessionKey } from "../../routing/session-key.js";

1317

import { normalizeOptionalLowercaseString, readStringValue } from "../../shared/string-coerce.js";

1418

import {

@@ -45,6 +49,8 @@ const SessionsListToolSchema = Type.Object({

45494650

type GatewayCaller = typeof callGateway;

475152+

const SESSIONS_LIST_TRANSCRIPT_FIELD_ROWS = 100;

53+4854

function readSessionRunStatus(value: unknown): SessionRunStatus | undefined {

4955

return value === "running" ||

5056

value === "done" ||

@@ -109,6 +115,8 @@ export function createSessionsListTool(opts?: {

109115

const includeDerivedTitles = params.includeDerivedTitles === true;

110116

const includeLastMessage = params.includeLastMessage === true;

111117

const gatewayCall = opts?.callGateway ?? callGateway;

118+

const a2aPolicy = createAgentToAgentPolicy(cfg);

119+

const hydrateTranscriptFieldsAfterFiltering = includeDerivedTitles || includeLastMessage;

112120113121

const list = await gatewayCall<{ sessions: Array<SessionListRow>; path: string }>({

114122

method: "sessions.list",

@@ -118,8 +126,8 @@ export function createSessionsListTool(opts?: {

118126

label,

119127

agentId,

120128

search,

121-

includeDerivedTitles,

122-

includeLastMessage,

129+

includeDerivedTitles: false,

130+

includeLastMessage: false,

123131

includeGlobal: !restrictToSpawned,

124132

includeUnknown: !restrictToSpawned,

125133

spawnedBy: restrictToSpawned ? effectiveRequesterKey : undefined,

@@ -128,7 +136,6 @@ export function createSessionsListTool(opts?: {

128136129137

const sessions = Array.isArray(list?.sessions) ? list.sessions : [];

130138

const storePath = typeof list?.path === "string" ? list.path : undefined;

131-

const a2aPolicy = createAgentToAgentPolicy(cfg);

132139

const visibilityGuard = await createSessionVisibilityGuard({

133140

action: "list",

134141

requesterSessionKey: effectiveRequesterKey,

@@ -137,6 +144,13 @@ export function createSessionsListTool(opts?: {

137144

});

138145

const rows: SessionListRow[] = [];

139146

const historyTargets: Array<{ row: SessionListRow; resolvedKey: string }> = [];

147+

const titleTargets: Array<{

148+

row: SessionListRow;

149+

titleEntry: SessionEntry;

150+

sessionId: string;

151+

sessionFile?: string;

152+

agentId: string;

153+

}> = [];

140154141155

for (const entry of sessions) {

142156

if (!entry || typeof entry !== "object") {

@@ -310,17 +324,24 @@ export function createSessionsListTool(opts?: {

310324

lastAccountId,

311325

transcriptPath,

312326

};

313-

if (sessionId && includeDerivedTitles && !row.derivedTitle) {

314-

row.derivedTitle = deriveSessionTitle(

315-

{

327+

if (

328+

sessionId &&

329+

hydrateTranscriptFieldsAfterFiltering &&

330+

titleTargets.length < SESSIONS_LIST_TRANSCRIPT_FIELD_ROWS

331+

) {

332+

titleTargets.push({

333+

row,

334+

titleEntry: {

316335

sessionId,

317336

displayName: row.displayName,

318337

label: row.label,

319338

subject: readStringValue((entry as { subject?: unknown }).subject),

320339

updatedAt: typeof row.updatedAt === "number" ? row.updatedAt : 0,

321340

},

322-

undefined,

323-

);

341+

sessionId,

342+

...(sessionFile ? { sessionFile } : {}),

343+

agentId: resolvedAgentId,

344+

});

324345

}

325346

if (messageLimit > 0) {

326347

const resolvedKey = resolveInternalSessionKey({

@@ -333,6 +354,37 @@ export function createSessionsListTool(opts?: {

333354

rows.push(row);

334355

}

335356357+

if (titleTargets.length > 0) {

358+

const maxConcurrent = Math.min(4, titleTargets.length);

359+

let index = 0;

360+

const worker = async () => {

361+

while (true) {

362+

const next = index;

363+

index += 1;

364+

if (next >= titleTargets.length) {

365+

return;

366+

}

367+

const target = titleTargets[next];

368+

const fields = await readSessionTitleFieldsFromTranscriptAsync(

369+

target.sessionId,

370+

storePath,

371+

target.sessionFile,

372+

target.agentId,

373+

);

374+

if (includeDerivedTitles && !target.row.derivedTitle) {

375+

target.row.derivedTitle = deriveSessionTitle(

376+

target.titleEntry,

377+

fields.firstUserMessage,

378+

);

379+

}

380+

if (includeLastMessage && fields.lastMessagePreview) {

381+

target.row.lastMessagePreview = fields.lastMessagePreview;

382+

}

383+

}

384+

};

385+

await Promise.all(Array.from({ length: maxConcurrent }, () => worker()));

386+

}

387+336388

if (messageLimit > 0 && historyTargets.length > 0) {

337389

const maxConcurrent = Math.min(4, historyTargets.length);

338390

let index = 0;