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

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
L
LangChain Blog
Jina AI
Jina AI
爱范儿
爱范儿
C
Check Point Blog
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
月光博客
月光博客
GbyAI
GbyAI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题

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: honor no-completion subagent cleanup · openclaw/open...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -9,6 +9,10 @@ const taskExecutorMocks = vi.hoisted(() => ({

99

setDetachedTaskDeliveryStatusByRunId: vi.fn(),

1010

}));

111112+

const gatewayMocks = vi.hoisted(() => ({

13+

callGateway: vi.fn(async () => ({})),

14+

}));

15+1216

const helperMocks = vi.hoisted(() => ({

1317

persistSubagentSessionTiming: vi.fn(async () => {}),

1418

safeRemoveAttachmentsDir: vi.fn(async () => {}),

@@ -117,6 +121,7 @@ function createLifecycleController({

117121

emitSubagentEndedHookForRun: vi.fn(async () => {}),

118122

notifyContextEngineSubagentEnded: vi.fn(async () => {}),

119123

resumeSubagentRun: vi.fn(),

124+

callGateway: gatewayMocks.callGateway,

120125

captureSubagentCompletionReply: vi.fn(async () => "final completion reply"),

121126

runSubagentAnnounceFlow: vi.fn(async () => true),

122127

warn: vi.fn(),

@@ -127,6 +132,11 @@ function createLifecycleController({

127132

describe("subagent registry lifecycle hardening", () => {

128133

beforeEach(() => {

129134

vi.clearAllMocks();

135+

taskExecutorMocks.completeTaskRunByRunId.mockReset();

136+

taskExecutorMocks.failTaskRunByRunId.mockReset();

137+

taskExecutorMocks.setDetachedTaskDeliveryStatusByRunId.mockReset();

138+

gatewayMocks.callGateway.mockReset();

139+

gatewayMocks.callGateway.mockResolvedValue({});

130140

browserLifecycleCleanupMocks.cleanupBrowserSessionsForLifecycleEnd.mockClear();

131141

bundleMcpRuntimeMocks.retireSessionMcpRuntimeForSessionKey.mockClear();

132142

bundleMcpRuntimeMocks.retireSessionMcpRuntimeForSessionKey.mockResolvedValue(true);

@@ -214,7 +224,7 @@ describe("subagent registry lifecycle hardening", () => {

214224

it("cleans up tracked browser sessions before subagent cleanup flow", async () => {

215225

const persist = vi.fn();

216226

const entry = createRunEntry({

217-

expectsCompletionMessage: false,

227+

expectsCompletionMessage: true,

218228

});

219229

const runSubagentAnnounceFlow = vi.fn(async () => true);

220230

@@ -243,6 +253,92 @@ describe("subagent registry lifecycle hardening", () => {

243253

);

244254

});

245255256+

it("skips announce delivery when completion messages are disabled", async () => {

257+

const persist = vi.fn();

258+

const entry = createRunEntry({

259+

expectsCompletionMessage: false,

260+

retainAttachmentsOnKeep: true,

261+

});

262+

const runSubagentAnnounceFlow = vi.fn(async () => true);

263+264+

const controller = createLifecycleController({ entry, persist, runSubagentAnnounceFlow });

265+266+

await expect(

267+

controller.completeSubagentRun({

268+

runId: entry.runId,

269+

endedAt: 4_000,

270+

outcome: { status: "ok" },

271+

reason: SUBAGENT_ENDED_REASON_COMPLETE,

272+

triggerCleanup: true,

273+

}),

274+

).resolves.toBeUndefined();

275+276+

expect(browserLifecycleCleanupMocks.cleanupBrowserSessionsForLifecycleEnd).toHaveBeenCalledWith(

277+

{

278+

sessionKeys: [entry.childSessionKey],

279+

onWarn: expect.any(Function),

280+

},

281+

);

282+

expect(runSubagentAnnounceFlow).not.toHaveBeenCalled();

283+

expect(taskExecutorMocks.setDetachedTaskDeliveryStatusByRunId).not.toHaveBeenCalledWith(

284+

expect.objectContaining({

285+

runId: entry.runId,

286+

deliveryStatus: "delivered",

287+

}),

288+

);

289+

await vi.waitFor(() => expect(entry.cleanupCompletedAt).toBeTypeOf("number"));

290+

expect(entry.completionAnnouncedAt).toBeUndefined();

291+

});

292+293+

it("archives delete-mode sessions when completion messages are disabled", async () => {

294+

const persist = vi.fn();

295+

const entry = createRunEntry({

296+

cleanup: "delete",

297+

expectsCompletionMessage: false,

298+

spawnMode: "session",

299+

});

300+

const runs = new Map([[entry.runId, entry]]);

301+

const runSubagentAnnounceFlow = vi.fn(async () => true);

302+303+

const controller = createLifecycleController({

304+

entry,

305+

runs,

306+

persist,

307+

runSubagentAnnounceFlow,

308+

});

309+310+

await expect(

311+

controller.completeSubagentRun({

312+

runId: entry.runId,

313+

endedAt: 4_000,

314+

outcome: { status: "ok" },

315+

reason: SUBAGENT_ENDED_REASON_COMPLETE,

316+

triggerCleanup: true,

317+

}),

318+

).resolves.toBeUndefined();

319+320+

await vi.waitFor(() =>

321+

expect(gatewayMocks.callGateway).toHaveBeenCalledWith({

322+

method: "sessions.delete",

323+

params: {

324+

key: entry.childSessionKey,

325+

deleteTranscript: true,

326+

emitLifecycleHooks: true,

327+

},

328+

timeoutMs: 10_000,

329+

}),

330+

);

331+

expect(runSubagentAnnounceFlow).not.toHaveBeenCalled();

332+

expect(taskExecutorMocks.setDetachedTaskDeliveryStatusByRunId).not.toHaveBeenCalledWith(

333+

expect.objectContaining({

334+

runId: entry.runId,

335+

deliveryStatus: "delivered",

336+

}),

337+

);

338+

await vi.waitFor(() => expect(runs.has(entry.runId)).toBe(false));

339+

expect(entry.completionAnnouncedAt).toBeUndefined();

340+

});

341+246342

it("retires bundle MCP runtimes when run-mode cleanup completes", async () => {

247343

const entry = createRunEntry({

248344

endedAt: 4_000,

@@ -296,7 +392,7 @@ describe("subagent registry lifecycle hardening", () => {

296392

const runSubagentAnnounceFlow = vi.fn(async () => true);

297393

const entry = createRunEntry({

298394

startedAt: 2_000,

299-

expectsCompletionMessage: false,

395+

expectsCompletionMessage: true,

300396

});

301397302398

const controller = createLifecycleController({ entry, persist, runSubagentAnnounceFlow });

@@ -531,7 +627,7 @@ describe("subagent registry lifecycle hardening", () => {

531627

const emitSubagentEndedHookForRun = vi.fn(async () => {});

532628

const entry = createRunEntry({

533629

endedAt: 4_000,

534-

expectsCompletionMessage: false,

630+

expectsCompletionMessage: true,

535631

retainAttachmentsOnKeep: false,

536632

});

537633

taskExecutorMocks.setDetachedTaskDeliveryStatusByRunId.mockImplementation(() => {