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

推荐订阅源

V
V2EX
IT之家
IT之家
博客园 - 叶小钗
雷峰网
雷峰网
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
博客园 - 【当耐特】
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - 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(memory): abort orphaned qmd search subprocess when me...
Alix-007 · 2026-06-24 · via Recent Commits to openclaw:main

@@ -90,6 +90,23 @@ type SqliteDatabase = import("node:sqlite").DatabaseSync;

90909191

const log = createSubsystemLogger("memory");

929293+

/**

94+

* Normalize an already-aborted search signal into the error thrown before any

95+

* qmd work starts. Prefers the caller-supplied abort reason (so a deadline

96+

* message such as "memory_search timed out after 15s" survives) and falls back

97+

* to a stable abort error.

98+

*/

99+

function asAbortError(signal: AbortSignal): Error {

100+

const reason = signal.reason;

101+

if (reason instanceof Error) {

102+

return reason;

103+

}

104+

if (typeof reason === "string" && reason.length > 0) {

105+

return new Error(reason);

106+

}

107+

return new Error("qmd search aborted");

108+

}

109+93110

const SNIPPET_HEADER_RE = /@@\s*-([0-9]+),([0-9]+)/;

94111

const SEARCH_PENDING_UPDATE_WAIT_MS = 500;

95112

const MAX_QMD_OUTPUT_CHARS = 200_000;

@@ -1280,12 +1297,23 @@ export class QmdMemoryManager implements MemorySearchManager {

12801297

qmdSearchModeOverride?: "query" | "search" | "vsearch";

12811298

onDebug?: (debug: MemorySearchRuntimeDebug) => void;

12821299

sources?: MemorySource[];

1300+

/**

1301+

* Caller-owned cancellation. When the caller stops waiting (e.g. the

1302+

* memory_search tool deadline fires), abort kills the in-flight qmd

1303+

* subprocess instead of leaving it running orphaned for the full qmd

1304+

* timeout.

1305+

*/

1306+

signal?: AbortSignal;

12831307

},

12841308

): Promise<MemorySearchResult[]> {

12851309

if (!this.isScopeAllowed(opts?.sessionKey)) {

12861310

this.logScopeDenied(opts?.sessionKey);

12871311

return [];

12881312

}

1313+

const searchSignal = opts?.signal;

1314+

if (searchSignal?.aborted) {

1315+

throw asAbortError(searchSignal);

1316+

}

12891317

const trimmed = query.trim();

12901318

if (!trimmed) {

12911319

return [];

@@ -1374,7 +1402,7 @@ export class QmdMemoryManager implements MemorySearchManager {

13741402

}

13751403

const args = this.buildSearchArgs(qmdSearchCommand, trimmed, limit);

13761404

args.push(...this.buildCollectionFilterArgs(collectionGroups[0] ?? collectionNames));

1377-

return await this.runQmdSearch(args, qmdSearchCommand);

1405+

return await this.runQmdSearch(args, qmdSearchCommand, searchSignal);

13781406

} catch (err) {

13791407

if (allowMissingCollectionRepair && this.isMissingCollectionSearchError(err)) {

13801408

throw err;

@@ -1403,7 +1431,7 @@ export class QmdMemoryManager implements MemorySearchManager {

14031431

fallbackArgs.push(

14041432

...this.buildCollectionFilterArgs(collectionGroups[0] ?? collectionNames),

14051433

);

1406-

return await this.runQmdSearch(fallbackArgs, "query");

1434+

return await this.runQmdSearch(fallbackArgs, "query", searchSignal);

14071435

} catch (fallbackErr) {

14081436

log.warn(`qmd query fallback failed: ${String(fallbackErr)}`);

14091437

throw fallbackErr instanceof Error ? fallbackErr : new Error(String(fallbackErr));

@@ -2137,7 +2165,7 @@ export class QmdMemoryManager implements MemorySearchManager {

2137216521382166

private async runQmd(

21392167

args: string[],

2140-

opts?: { timeoutMs?: number; discardOutput?: boolean },

2168+

opts?: { timeoutMs?: number; discardOutput?: boolean; signal?: AbortSignal },

21412169

): Promise<{ stdout: string; stderr: string }> {

21422170

return await runCliCommand({

21432171

commandSummary: `qmd ${args.join(" ")}`,

@@ -2153,15 +2181,17 @@ export class QmdMemoryManager implements MemorySearchManager {

21532181

maxOutputChars: this.maxQmdOutputChars,

21542182

// Large `qmd update` runs can easily exceed the output cap; keep only stderr.

21552183

discardStdout: opts?.discardOutput,

2184+

signal: opts?.signal,

21562185

});

21572186

}

2158218721592188

private async runQmdSearch(

21602189

args: string[],

21612190

command: "query" | "search" | "vsearch",

2191+

signal?: AbortSignal,

21622192

): Promise<QmdQueryResult[]> {

21632193

try {

2164-

const result = await this.runQmd(args, { timeoutMs: this.qmd.limits.timeoutMs });

2194+

const result = await this.runQmd(args, { timeoutMs: this.qmd.limits.timeoutMs, signal });

21652195

return parseQmdQueryJson(result.stdout, result.stderr);

21662196

} catch (err) {

21672197

const recovered = this.parseFailedQmdSearchJson(err, command);