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

推荐订阅源

MyScale Blog
MyScale Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
C
Cisco Blogs
量子位
WordPress大学
WordPress大学
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
C
Comments on: Blog
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Martin Fowler
Martin Fowler
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
D
DataBreaches.Net
T
The Exploit Database - CXSecurity.com
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Troy Hunt's Blog
L
Lohrmann on Cybersecurity
L
LangChain Blog
Security Latest
Security Latest
A
Arctic Wolf
博客园 - Franky
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Check Point Blog
V
Vulnerabilities – Threatpost
博客园 - 聂微东
SecWiki News
SecWiki News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
News and Events Feed by Topic
E
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
Recorded Future
Recorded Future
C
CERT Recently Published Vulnerability Notes
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件

Recent Commits to openclaw:main

ci: harden beta release validation flakes · openclaw/openclaw@391f29b test: type codex thread request mocks · openclaw/openclaw@86a0502 test: avoid codex heartbeat lifecycle timeout · openclaw/openclaw@85664f8 fix(scripts): run Windows check commands through shims · openclaw/openclaw@8a94e82 fix: aggressively prune retired model catalogs fix: harden package URL downloads (#85578) ci: retry npm Telegram release dispatch test: isolate Telegram spooled timeout from stall watchdog · openclaw/openclaw@a04566d fix(exec-approvals): add .catch() to expiry delivery fire-and-forget … fix(memory-core): avoid double bulleting promoted snippets (#85724) · openclaw/openclaw@983a3b9 fix(doctor): skip empty entries and memoize routes in plugin session … ci: avoid duplicate release-check auth headers · openclaw/openclaw@6191750 fix: prune retired model catalog entries ci: authenticate release-check reachability fetches · openclaw/openclaw@0c192e2 docs(changelog): note Telegram attachment action fix · openclaw/openclaw@c5f1344 fix(telegram): send attachment paths as media · openclaw/openclaw@fdf01db refactor(telegram): simplify action media sends · openclaw/openclaw@0540025 fix(doctor): canonicalize git checkout detection (#85735) test(ci): update plugin prerelease checkout expectation ci: persist checkout credentials for release validation test(codex): avoid searchable-tool registration flake · openclaw/openclaw@5e8c71b refactor: simplify doctor repair checks (#83753) docs(changelog): credit landed bug sweep PRs · openclaw/openclaw@24de304 perf(utils): preserve message identity in stripInlineDirectiveTagsFro… · openclaw/openclaw@bf84b30 fix(agents): add openai-responses family to non-visible turn retry gu… · openclaw/openclaw@49e9c3e fix(status): show configured cost for aws-sdk models (#85619) · openclaw/openclaw@6e289b4 fix(microsoft-foundry): DeepSeek V4 models incorrectly use openai-com… · openclaw/openclaw@ec43acb fix(skills): show empty state notice in config wizard (#85032) · openclaw/openclaw@74e65f4 test(codex): avoid forced-tool allowlist flake · openclaw/openclaw@ef7e652 fix: avoid gateway startup event-loop stalls test(codex): type forced-tool request mock · openclaw/openclaw@f6ab188 test(codex): avoid forced-tool turn flake · openclaw/openclaw@8d1ab83 test(codex): avoid startup cleanup socket flake fix(gateway): pin relative state dir at startup · openclaw/openclaw@2e5be0c fix(whatsapp): persist inbound delivery in plugin state (#85506) · openclaw/openclaw@b47bace test(codex): make sandbox cleanup proof deterministic fix(cron): route topic targets through channel plugins · openclaw/openclaw@9175491 fix(agents): simplify subagent completion handoff ci(release): isolate npm publish concurrency · openclaw/openclaw@9c26b87 ci(release): allow beta publish after npm preflight · openclaw/openclaw@0e37263 fix(release): allow large beta smoke run lists ci(release): retry child workflow polling · openclaw/openclaw@c689f71 ci(release): poll child workflows through actions api · openclaw/openclaw@e5dab55 fix(bootstrap): guard bootstrap name checks against undefined names (… · openclaw/openclaw@25fa46b fix(cli): waitForever must keep the event loop alive (#85694) · openclaw/openclaw@eca9645 fix(cli-output): ignore cumulative usage from result events in stream… · openclaw/openclaw@84229d9 fix(secrets): show irreversible warning after interactive apply confi… · openclaw/openclaw@bb52b54 fix(agents/harness): pass CLI runtime aliases through to PI in select… · openclaw/openclaw@2c3b7ea docs: add bug-sweep changelog entries fix(release): run npm shims on Windows · openclaw/openclaw@1f32a48 fix(ci): repair crabbox hydrate replay (#85706) · openclaw/openclaw@0d7d99b feat(auth): support named model login profiles fix(gateway): restore WebChat image understanding routing · openclaw/openclaw@55a0c9b fix(anthropic): migrate 1M context to GA handling fix(scripts): resolve Crabbox shims on Windows · openclaw/openclaw@5c535df test(ci): harden installer smoke coverage · openclaw/openclaw@68bcd4e fix(status): bound deep docker audit probes (#85476) · openclaw/openclaw@f7c05dc docs: expand meeting notes docs · openclaw/openclaw@a7e0fa0 fix(cli): validate tasks audit limit (#84901) · openclaw/openclaw@44d470f fix(twitch): preserve newer message handler during cleanup (#85425) · openclaw/openclaw@71ddc01 fix(ci): require live docker credentials by resource · openclaw/openclaw@1e21121 fix(diagnostics): drop snake case otel ids (#72645) · openclaw/openclaw@e0bafc5 fix(ci): clear signal and docs guard blockers (#85693) · openclaw/openclaw@3a1d4dd fix(ci): require factory auth for droid live docker · openclaw/openclaw@cc6c372 fix: honor disabled synthetic auth lookup · openclaw/openclaw@a4a1abb fix(scripts): repair live docker auth shellcheck · openclaw/openclaw@4e34ac4 fix(docker): avoid printing gateway token · openclaw/openclaw@5db773f fix(cli): keep logs follow on live gateway state · openclaw/openclaw@6e3b318 fix(e2e): prefer x64 MinGit on Windows · openclaw/openclaw@15d9134 feat: add meeting notes plugin docs: update changelog for memory artifacts (#85060) (thanks @brokema… · openclaw/openclaw@9e55383 fix(memory-lancedb): expose public memory artifacts · openclaw/openclaw@aac1abe fix(memory): preserve sidecar capability hooks · openclaw/openclaw@e6288ca fix(e2e): scrub Windows update config on PowerShell 5.1 · openclaw/openclaw@6657b49 docs: absorb documentation PR sweep · openclaw/openclaw@2c536a8 fix(agents): stabilize Linux fallback tests · openclaw/openclaw@6b04170 fix(codex): preserve native web search action metadata (#85378) · openclaw/openclaw@bcf756c test: refresh Codex prompt snapshots · openclaw/openclaw@492d656 docs: absorb hook and subagent guidance PRs fix(agents): audit tool policy blocks (#85673) · openclaw/openclaw@09dd051 ci: fix plugin npm bundled dependency install · openclaw/openclaw@d485464 feat(diagnostics): classify skill and tool usage (#80370) docs(skills): clarify control ui recording proof (#85568) · openclaw/openclaw@0b476b9 test(agents): repair main failure fixtures · openclaw/openclaw@c29967b feat(diagnostics): trace gateway secret preparation (#83019) · openclaw/openclaw@4f0c902 fix(diagnostics): harden observability exports and smokes (#85371) · openclaw/openclaw@7f05be0 fix(stepfun): drop stale auth choice metadata · openclaw/openclaw@0b2ab6c test(e2e): sample kitchen sink RSS on Windows · openclaw/openclaw@73c1e37 test(plugins): fail gauntlet on load diagnostics fix(build): preserve tsdown heap floor · openclaw/openclaw@9ff1a43 fix(tools): honor config apiKey in media tool preflight (#85570) · openclaw/openclaw@31c269f fix(e2e): support macOS script wrappers fix(ci): scope changed shrinkwrap checks · openclaw/openclaw@743fd4c chore(ui): refresh fa control ui locale chore(ui): refresh nl control ui locale · openclaw/openclaw@908464b chore(ui): refresh vi control ui locale · openclaw/openclaw@62b75f4 chore(ui): refresh th control ui locale · openclaw/openclaw@fc4ba31 chore(ui): refresh id control ui locale · openclaw/openclaw@5b1bdd1 chore(ui): refresh pl control ui locale · openclaw/openclaw@534d4b1 chore(ui): refresh uk control ui locale · openclaw/openclaw@055c3bd
perf(gateway): defer startup-idle runtime work · openclaw/openclaw@f1226ae
steipete · 2026-05-24 · via Recent Commits to openclaw:main

@@ -1,7 +1,12 @@

11

import {

22

getAcpRuntimeBackend,

3+

registerAcpRuntimeBackend,

34

unregisterAcpRuntimeBackend,

45

type AcpRuntime,

6+

type AcpRuntimeEvent,

7+

type AcpRuntimeTurn,

8+

type AcpRuntimeTurnInput,

9+

type AcpRuntimeTurnResult,

510

} from "openclaw/plugin-sdk/acp-runtime-backend";

611

import type { OpenClawPluginService, OpenClawPluginServiceContext } from "openclaw/plugin-sdk/core";

712

@@ -22,6 +27,89 @@ type DeferredServiceState = {

22272328

let serviceModulePromise: Promise<RealAcpxServiceModule> | null = null;

242930+

function createDeferredResult<T>() {

31+

let resolve!: (value: T) => void;

32+

let reject!: (error: unknown) => void;

33+

const promise = new Promise<T>((resolvePromise, rejectPromise) => {

34+

resolve = resolvePromise;

35+

reject = rejectPromise;

36+

});

37+

return { promise, resolve, reject };

38+

}

39+40+

class LegacyRunTurnEventQueue {

41+

private readonly items: AcpRuntimeEvent[] = [];

42+

private readonly waits: Array<{

43+

resolve: (value: AcpRuntimeEvent | null) => void;

44+

reject: (error: unknown) => void;

45+

}> = [];

46+

private closed = false;

47+

private error: unknown;

48+49+

push(item: AcpRuntimeEvent): void {

50+

if (this.closed) {

51+

return;

52+

}

53+

const waiter = this.waits.shift();

54+

if (waiter) {

55+

waiter.resolve(item);

56+

return;

57+

}

58+

this.items.push(item);

59+

}

60+61+

clear(): void {

62+

this.items.length = 0;

63+

}

64+65+

close(): void {

66+

if (this.closed) {

67+

return;

68+

}

69+

this.closed = true;

70+

for (const waiter of this.waits.splice(0)) {

71+

waiter.resolve(null);

72+

}

73+

}

74+75+

fail(error: unknown): void {

76+

if (this.closed) {

77+

return;

78+

}

79+

this.error = error;

80+

this.closed = true;

81+

for (const waiter of this.waits.splice(0)) {

82+

waiter.reject(error);

83+

}

84+

}

85+86+

private async next(): Promise<AcpRuntimeEvent | null> {

87+

const item = this.items.shift();

88+

if (item) {

89+

return item;

90+

}

91+

if (this.error) {

92+

throw this.error;

93+

}

94+

if (this.closed) {

95+

return null;

96+

}

97+

return await new Promise<AcpRuntimeEvent | null>((resolve, reject) => {

98+

this.waits.push({ resolve, reject });

99+

});

100+

}

101+102+

async *iterate(): AsyncIterable<AcpRuntimeEvent> {

103+

for (;;) {

104+

const item = await this.next();

105+

if (!item) {

106+

return;

107+

}

108+

yield item;

109+

}

110+

}

111+

}

112+25113

function loadServiceModule(): Promise<RealAcpxServiceModule> {

26114

serviceModulePromise ??= import("./src/service.js");

27115

return serviceModulePromise;

@@ -46,7 +134,143 @@ async function startRealService(state: DeferredServiceState): Promise<AcpRuntime

46134

state.realRuntime = backend.runtime;

47135

return state.realRuntime;

48136

})();

49-

return await state.startPromise;

137+

try {

138+

return await state.startPromise;

139+

} catch (error) {

140+

state.startPromise = null;

141+

state.realService = null;

142+

throw error;

143+

}

144+

}

145+146+

function lazyStartTurn(

147+

resolveRuntime: () => Promise<AcpRuntime>,

148+

input: AcpRuntimeTurnInput,

149+

): AcpRuntimeTurn {

150+

const turnPromise: Promise<AcpRuntimeTurn> = resolveRuntime().then((runtime) => {

151+

if (runtime.startTurn) {

152+

return runtime.startTurn(input);

153+

}

154+

return legacyRunTurnAsStartTurn(runtime, input);

155+

});

156+

return {

157+

requestId: input.requestId,

158+

events: {

159+

async *[Symbol.asyncIterator]() {

160+

yield* (await turnPromise).events;

161+

},

162+

},

163+

result: turnPromise.then((turn) => turn.result),

164+

cancel(inputArgs) {

165+

return turnPromise.then((turn) => turn.cancel(inputArgs));

166+

},

167+

closeStream(inputArgs) {

168+

return turnPromise.then((turn) => turn.closeStream(inputArgs));

169+

},

170+

};

171+

}

172+173+

function legacyRunTurnAsStartTurn(runtime: AcpRuntime, input: AcpRuntimeTurnInput): AcpRuntimeTurn {

174+

const result = createDeferredResult<AcpRuntimeTurnResult>();

175+

result.promise.catch(() => {});

176+

const queue = new LegacyRunTurnEventQueue();

177+

let resultSettled = false;

178+

const settleResult = (next: AcpRuntimeTurnResult) => {

179+

if (resultSettled) {

180+

return;

181+

}

182+

resultSettled = true;

183+

result.resolve(next);

184+

};

185+

void (async () => {

186+

try {

187+

for await (const event of runtime.runTurn(input)) {

188+

if (event.type === "done") {

189+

settleResult({

190+

status: "completed",

191+

...(event.stopReason ? { stopReason: event.stopReason } : {}),

192+

});

193+

continue;

194+

}

195+

if (event.type === "error") {

196+

settleResult({

197+

status: "failed",

198+

error: {

199+

message: event.message,

200+

...(event.code ? { code: event.code } : {}),

201+

...(event.detailCode ? { detailCode: event.detailCode } : {}),

202+

...(event.retryable === undefined ? {} : { retryable: event.retryable }),

203+

},

204+

});

205+

continue;

206+

}

207+

queue.push(event);

208+

}

209+

settleResult({

210+

status: "failed",

211+

error: {

212+

code: "ACP_TURN_FAILED",

213+

message: "ACP turn ended without a terminal done event.",

214+

},

215+

});

216+

} catch (error) {

217+

result.reject(error);

218+

queue.fail(error);

219+

return;

220+

}

221+

queue.close();

222+

})();

223+

return {

224+

requestId: input.requestId,

225+

events: queue.iterate(),

226+

result: result.promise,

227+

async cancel(inputArgs) {

228+

await runtime.cancel({ handle: input.handle, reason: inputArgs?.reason });

229+

},

230+

async closeStream() {

231+

queue.clear();

232+

queue.close();

233+

},

234+

};

235+

}

236+237+

function createDeferredRuntime(state: DeferredServiceState): AcpRuntime {

238+

const resolveRuntime = () => startRealService(state);

239+

return {

240+

async ensureSession(input) {

241+

return await (await resolveRuntime()).ensureSession(input);

242+

},

243+

startTurn(input) {

244+

return lazyStartTurn(resolveRuntime, input);

245+

},

246+

async *runTurn(input) {

247+

yield* (await resolveRuntime()).runTurn(input);

248+

},

249+

async getCapabilities(input) {

250+

return (await (await resolveRuntime()).getCapabilities?.(input)) ?? { controls: [] };

251+

},

252+

async getStatus(input) {

253+

return (await (await resolveRuntime()).getStatus?.(input)) ?? {};

254+

},

255+

async setMode(input) {

256+

await (await resolveRuntime()).setMode?.(input);

257+

},

258+

async setConfigOption(input) {

259+

await (await resolveRuntime()).setConfigOption?.(input);

260+

},

261+

async doctor() {

262+

return (await (await resolveRuntime()).doctor?.()) ?? { ok: true, message: "ok" };

263+

},

264+

async prepareFreshSession(input) {

265+

await (await resolveRuntime()).prepareFreshSession?.(input);

266+

},

267+

async cancel(input) {

268+

await (await resolveRuntime()).cancel(input);

269+

},

270+

async close(input) {

271+

await (await resolveRuntime()).close(input);

272+

},

273+

};

50274

}

5127552276

export function createAcpxRuntimeService(

@@ -69,7 +293,11 @@ export function createAcpxRuntimeService(

69293

}

7029471295

state.ctx = ctx;

72-

await startRealService(state);

296+

registerAcpRuntimeBackend({

297+

id: ACPX_BACKEND_ID,

298+

runtime: createDeferredRuntime(state),

299+

});

300+

ctx.logger.info("embedded acpx runtime backend registered lazily");

73301

},

74302

async stop(ctx) {

75303

if (state.realService) {