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

推荐订阅源

小众软件
小众软件
博客园 - Franky
罗磊的独立博客
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
V
V2EX
F
Fortinet All Blogs
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
U
Unit 42
GbyAI
GbyAI
A
About on SuperTechFans
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
Martin Fowler
Martin Fowler
D
DataBreaches.Net
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MongoDB | Blog
MongoDB | 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
perf(agents): skip idle wait on abort to release session ...
medns · 2026-05-08 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -625,6 +625,7 @@ Docs: https://docs.openclaw.ai

625625

- WhatsApp: stop Gateway-originated outbound echoes from advancing inbound activity in `openclaw channels status`, so outbound self-sends no longer look like handled inbound messages. Fixes #79056. (#79057) Thanks @ai-hpc and @bittoby.

626626

- Gateway/nodes: preserve the live node registry session and invoke ownership when an older same-node WebSocket closes after reconnecting. (#78351) Thanks @samzong.

627627

- Browser/downloads: route explicit and managed browser download output directories through `fs-safe` validation before staging final files, so symlinked output roots are rejected before writes. (#78780) Thanks @jesse-merhi.

628+

- Agents/PI: skip the idle wait during aborted embedded-run cleanup, so stopped or timed-out runs clear pending tool state and release the session lock promptly. (#74919) Thanks @medns.

628629
629630

## 2026.5.3-1

630631
Original file line numberDiff line numberDiff line change

@@ -138,4 +138,43 @@ describe("flushPendingToolResultsAfterIdle", () => {

138138

});

139139

expect(vi.getTimerCount()).toBe(0);

140140

});

141+
142+

it("immediately clears pending tool results without waiting when timeoutMs is 0 or less", async () => {

143+

const sm = guardSessionManager(SessionManager.inMemory());

144+

const appendMessage = sm.appendMessage.bind(sm) as unknown as (message: AgentMessage) => void;

145+
146+

// Agent that never resolves idle

147+

const idle = deferred<void>();

148+

const waitForIdleSpy = vi.fn(() => idle.promise);

149+

const agent = { waitForIdle: waitForIdleSpy };

150+
151+

appendMessage(assistantToolCall("call_orphan_immediate"));

152+
153+

// Should resolve immediately without advancing timers

154+

await flushPendingToolResultsAfterIdle({

155+

agent,

156+

sessionManager: sm,

157+

timeoutMs: 0,

158+

clearPendingOnTimeout: true,

159+

});

160+
161+

// Verify waitForIdle was completely bypassed

162+

expect(waitForIdleSpy).not.toHaveBeenCalled();

163+
164+

// The pending tool result should be cleared immediately.

165+

expect(getMessages(sm).map((m) => m.role)).toEqual(["assistant"]);

166+
167+

// Test negative timeout as well

168+

appendMessage(assistantToolCall("call_orphan_negative"));

169+

await flushPendingToolResultsAfterIdle({

170+

agent,

171+

sessionManager: sm,

172+

timeoutMs: -100,

173+

clearPendingOnTimeout: true,

174+

});

175+
176+

// Verify waitForIdle was still bypassed

177+

expect(waitForIdleSpy).not.toHaveBeenCalled();

178+

expect(getMessages(sm).map((m) => m.role)).toEqual(["assistant", "assistant"]);

179+

});

141180

});

Original file line numberDiff line numberDiff line change

@@ -30,18 +30,23 @@ export async function cleanupEmbeddedAttemptResources(params: {

3030

bundleMcpRuntime?: { dispose(): Promise<void> | void };

3131

bundleLspRuntime?: { dispose(): Promise<void> | void };

3232

sessionLock: { release(): Promise<void> | void };

33+

aborted?: boolean;

3334

}): Promise<void> {

3435

try {

3536

try {

3637

params.removeToolResultContextGuard?.();

3738

} catch {

3839

/* best-effort */

3940

}

41+

// PERF: When the run was aborted (user stop / timeout), skip the expensive

42+

// waitForIdle (up to 30 s) and just clear pending tool results synchronously

43+

// so the session write-lock is released ASAP and the next message is not blocked.

4044

try {

4145

await params.flushPendingToolResultsAfterIdle({

4246

agent: params.session?.agent as IdleAwareAgent | null | undefined,

4347

sessionManager: params.sessionManager as ToolResultFlushManager | null | undefined,

4448

clearPendingOnTimeout: true,

49+

...(params.aborted ? { timeoutMs: 0 } : {}),

4550

});

4651

} catch {

4752

/* best-effort */

Original file line numberDiff line numberDiff line change

@@ -2345,6 +2345,10 @@ export async function runEmbeddedAttempt(

23452345

agent: activeSession?.agent,

23462346

sessionManager,

23472347

clearPendingOnTimeout: true,

2348+

// PERF: If the run was aborted during the setup,

2349+

// skip the idle wait and clear pending results synchronously so we can

2350+

// immediately dispose the session and throw the error without blocking.

2351+

...(params.abortSignal?.aborted ? { timeoutMs: 0 } : {}),

23482352

});

23492353

activeSession.dispose();

23502354

throw err;

@@ -3845,6 +3849,14 @@ export async function runEmbeddedAttempt(

38453849

bundleMcpRuntime,

38463850

bundleLspRuntime,

38473851

sessionLock,

3852+

// PERF: If the run was aborted (user stop, timeout, etc.), skip the idle wait

3853+

// and clear pending results synchronously so we can release the session lock ASAP.

3854+

aborted:

3855+

Boolean(params.abortSignal?.aborted) ||

3856+

aborted ||

3857+

timedOut ||

3858+

idleTimedOut ||

3859+

timedOutDuringCompaction,

38483860

});

38493861

} catch (err) {

38503862

cleanupError = err;

Original file line numberDiff line numberDiff line change

@@ -46,10 +46,14 @@ export async function flushPendingToolResultsAfterIdle(opts: {

4646

timeoutMs?: number;

4747

clearPendingOnTimeout?: boolean;

4848

}): Promise<void> {

49-

const timedOut = await waitForAgentIdleBestEffort(

50-

opts.agent,

51-

opts.timeoutMs ?? DEFAULT_WAIT_FOR_IDLE_TIMEOUT_MS,

52-

);

49+

const isImmediateTimeout = opts.timeoutMs !== undefined && opts.timeoutMs <= 0;

50+

const timedOut =

51+

isImmediateTimeout ||

52+

(await waitForAgentIdleBestEffort(

53+

opts.agent,

54+

opts.timeoutMs ?? DEFAULT_WAIT_FOR_IDLE_TIMEOUT_MS,

55+

));

56+
5357

if (timedOut && opts.clearPendingOnTimeout && opts.sessionManager?.clearPendingToolResults) {

5458

opts.sessionManager.clearPendingToolResults();

5559

return;