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

推荐订阅源

Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
D
DataBreaches.Net
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
小众软件
小众软件
美团技术团队
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
D
Docker
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
B
Blog
雷峰网
雷峰网
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
fix(gateway): keep startup sidecars responsive · openclaw...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -47,6 +47,10 @@ type ChannelHealthMonitorConfig = HealthMonitorConfig & {

4747

accounts?: Record<string, HealthMonitorConfig>;

4848

};

494950+

type GatewayStartupTrace = {

51+

measure: <T>(name: string, run: () => T | Promise<T>) => Promise<T>;

52+

};

53+5054

function createRuntimeStore(): ChannelRuntimeStore {

5155

return {

5256

aborts: new Map(),

@@ -161,6 +165,7 @@ type ChannelManagerOptions = {

161165

* `createPluginRuntime().channel` surface.

162166

*/

163167

resolveChannelRuntime?: () => ChannelRuntimeSurface | Promise<ChannelRuntimeSurface>;

168+

startupTrace?: GatewayStartupTrace;

164169

};

165170166171

type StartChannelOptions = {

@@ -187,6 +192,7 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

187192

channelRuntimeEnvs,

188193

channelRuntime,

189194

resolveChannelRuntime,

195+

startupTrace,

190196

} = opts;

191197192198

const channelStores = new Map<ChannelId, ChannelRuntimeStore>();

@@ -286,6 +292,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

286292

const getChannelRuntime = async (): Promise<ChannelRuntimeSurface | undefined> => {

287293

return channelRuntime ?? (await resolveChannelRuntime?.());

288294

};

295+

const measureStartup = async <T>(name: string, run: () => T | Promise<T>): Promise<T> => {

296+

return startupTrace ? startupTrace.measure(name, run) : await run();

297+

};

289298290299

const evictStaleChannelAccountState = (

291300

channelId: ChannelId,

@@ -322,7 +331,11 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

322331

const cfg = getRuntimeConfig();

323332

resetDirectoryCache({ channel: channelId, accountId });

324333

const store = getStore(channelId);

325-

const accountIds = accountId ? [accountId] : plugin.config.listAccountIds(cfg);

334+

const accountIds = accountId

335+

? [accountId]

336+

: await measureStartup(`channels.${channelId}.list-accounts`, () =>

337+

plugin.config.listAccountIds(cfg),

338+

);

326339

if (!accountId) {

327340

evictStaleChannelAccountState(channelId, store, accountIds);

328341

}

@@ -391,7 +404,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

391404392405

let configured = true;

393406

if (plugin.config.isConfigured) {

394-

configured = await plugin.config.isConfigured(account, cfg);

407+

configured = await measureStartup(`channels.${channelId}.is-configured`, () =>

408+

plugin.config.isConfigured!(account, cfg),

409+

);

395410

}

396411

if (!configured) {

397412

setRuntime(channelId, id, {

@@ -420,21 +435,31 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

420435

return;

421436

}

422437423-

scopedChannelRuntime = createTaskScopedChannelRuntime({

424-

channelRuntime: await getChannelRuntime(),

425-

});

438+

scopedChannelRuntime = await measureStartup(`channels.${channelId}.runtime`, async () =>

439+

createTaskScopedChannelRuntime({

440+

channelRuntime: await getChannelRuntime(),

441+

}),

442+

);

426443

channelRuntimeForTask = scopedChannelRuntime.channelRuntime;

427444428445

if (!preserveRestartAttempts) {

429446

restartAttempts.delete(rKey);

430447

}

431-

stopApprovalBootstrap = await startChannelApprovalHandlerBootstrap({

432-

plugin,

433-

cfg,

434-

accountId: id,

435-

channelRuntime: channelRuntimeForTask,

436-

logger: log,

437-

});

448+

try {

449+

stopApprovalBootstrap = await measureStartup(

450+

`channels.${channelId}.approval-bootstrap`,

451+

() =>

452+

startChannelApprovalHandlerBootstrap({

453+

plugin,

454+

cfg,

455+

accountId: id,

456+

channelRuntime: channelRuntimeForTask,

457+

logger: log,

458+

}),

459+

);

460+

} catch (error) {

461+

log.error?.(`[${id}] native approval bootstrap failed: ${formatErrorMessage(error)}`);

462+

}

438463

setRuntime(channelId, id, {

439464

accountId: id,

440465

enabled: true,

@@ -446,17 +471,19 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

446471

reconnectAttempts: preserveRestartAttempts ? (restartAttempts.get(rKey) ?? 0) : 0,

447472

});

448473

const task = Promise.resolve().then(() =>

449-

startAccount({

450-

cfg,

451-

accountId: id,

452-

account,

453-

runtime: channelRuntimeEnvs[channelId],

454-

abortSignal: abort.signal,

455-

log,

456-

getStatus: () => getRuntime(channelId, id),

457-

setStatus: (next) => setRuntime(channelId, id, next),

458-

...(channelRuntimeForTask ? { channelRuntime: channelRuntimeForTask } : {}),

459-

}),

474+

measureStartup(`channels.${channelId}.start-account`, () =>

475+

startAccount({

476+

cfg,

477+

accountId: id,

478+

account,

479+

runtime: channelRuntimeEnvs[channelId],

480+

abortSignal: abort.signal,

481+

log,

482+

getStatus: () => getRuntime(channelId, id),

483+

setStatus: (next) => setRuntime(channelId, id, next),

484+

...(channelRuntimeForTask ? { channelRuntime: channelRuntimeForTask } : {}),

485+

}),

486+

),

460487

);

461488

const trackedPromise = task

462489

.catch((err) => {

@@ -636,7 +663,7 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage

636663

return;

637664

}

638665

try {

639-

await startChannel(plugin.id);

666+

await measureStartup(`channels.${plugin.id}.start`, () => startChannel(plugin.id));

640667

} catch (err) {

641668

channelLogs[plugin.id]?.error?.(

642669

`[${plugin.id}] channel startup failed: ${formatErrorMessage(err)}`,