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

推荐订阅源

S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
博客园_首页
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
博客园 - 司徒正美
有赞技术团队
有赞技术团队
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
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
feat(onboarding): auto-install missing provider and chann...
vincentkoc · 2026-04-23 · via Recent Commits to openclaw:main

@@ -8,6 +8,11 @@ import type { ProviderPlugin } from "../plugins/types.js";

88

import type { ProviderAuthMethod } from "../plugins/types.js";

99

import type { ApplyAuthChoiceParams } from "./auth-choice.apply.types.js";

101011+

type ResolveProviderInstallCatalogEntry =

12+

typeof import("../plugins/provider-install-catalog.js").resolveProviderInstallCatalogEntry;

13+

type EnsureOnboardingPluginInstalled =

14+

typeof import("../commands/onboarding-plugin-install.js").ensureOnboardingPluginInstalled;

15+1116

const resolvePluginProviders = vi.hoisted(() => vi.fn<() => ProviderPlugin[]>(() => []));

1217

const resolveProviderPluginChoice = vi.hoisted(() =>

1318

vi.fn<() => { provider: ProviderPlugin; method: ProviderAuthMethod } | null>(),

@@ -60,6 +65,30 @@ vi.mock("../plugins/provider-oauth-flow.js", () => ({

6065

createVpsAwareOAuthHandlers,

6166

}));

626768+

const resolveProviderInstallCatalogEntry = vi.hoisted(() =>

69+

vi.fn<ResolveProviderInstallCatalogEntry>(() => undefined),

70+

);

71+

vi.mock("../plugins/provider-install-catalog.js", () => ({

72+

resolveProviderInstallCatalogEntry,

73+

}));

74+75+

const ensureOnboardingPluginInstalled = vi.hoisted(() =>

76+

vi.fn<EnsureOnboardingPluginInstalled>(async ({ cfg, entry }) => ({

77+

cfg,

78+

installed: false,

79+

pluginId: entry?.pluginId ?? "missing-plugin",

80+

status: "skipped",

81+

})),

82+

);

83+

vi.mock("../commands/onboarding-plugin-install.js", () => ({

84+

ensureOnboardingPluginInstalled,

85+

}));

86+87+

const clearPluginDiscoveryCache = vi.hoisted(() => vi.fn());

88+

vi.mock("../plugins/discovery.js", () => ({

89+

clearPluginDiscoveryCache,

90+

}));

91+6392

const LOCAL_PROVIDER_ID = "local-provider";

6493

const LOCAL_PROVIDER_LABEL = "Local Provider";

6594

const LOCAL_AUTH_METHOD_ID = "local";

@@ -111,6 +140,13 @@ describe("applyAuthChoiceLoadedPluginProvider", () => {

111140

beforeEach(() => {

112141

vi.clearAllMocks();

113142

applyAuthProfileConfig.mockImplementation((config) => config);

143+

resolveProviderInstallCatalogEntry.mockReturnValue(undefined);

144+

ensureOnboardingPluginInstalled.mockImplementation(async ({ cfg, entry }) => ({

145+

cfg,

146+

installed: false,

147+

pluginId: entry?.pluginId ?? "missing-plugin",

148+

status: "skipped",

149+

}));

114150

});

115151116152

it("returns an agent model override when default model application is deferred", async () => {

@@ -252,6 +288,125 @@ describe("applyAuthChoiceLoadedPluginProvider", () => {

252288

});

253289

});

254290291+

it("installs a missing provider plugin and retries setup resolution", async () => {

292+

const provider = buildProvider();

293+

resolveProviderInstallCatalogEntry.mockReturnValue({

294+

pluginId: "local-provider-plugin",

295+

providerId: LOCAL_PROVIDER_ID,

296+

methodId: LOCAL_AUTH_METHOD_ID,

297+

choiceId: LOCAL_PROVIDER_ID,

298+

choiceLabel: LOCAL_PROVIDER_LABEL,

299+

label: LOCAL_PROVIDER_LABEL,

300+

origin: "bundled",

301+

install: {

302+

npmSpec: "@openclaw/local-provider",

303+

},

304+

});

305+

ensureOnboardingPluginInstalled.mockResolvedValue({

306+

cfg: {

307+

plugins: {

308+

entries: {

309+

"local-provider-plugin": {

310+

enabled: true,

311+

},

312+

},

313+

},

314+

},

315+

installed: true,

316+

pluginId: "local-provider-plugin",

317+

status: "installed",

318+

});

319+

resolvePluginProviders.mockReturnValue([provider]);

320+

resolveProviderPluginChoice.mockReturnValueOnce(null).mockReturnValueOnce({

321+

provider,

322+

method: provider.auth[0],

323+

});

324+325+

const result = await applyAuthChoiceLoadedPluginProvider(buildParams());

326+327+

expect(ensureOnboardingPluginInstalled).toHaveBeenCalledWith(

328+

expect.objectContaining({

329+

entry: expect.objectContaining({

330+

pluginId: "local-provider-plugin",

331+

label: LOCAL_PROVIDER_LABEL,

332+

}),

333+

workspaceDir: "/tmp/workspace",

334+

}),

335+

);

336+

expect(clearPluginDiscoveryCache).toHaveBeenCalledOnce();

337+

expect(resolvePluginProviders).toHaveBeenCalledTimes(2);

338+

expect(result?.config.agents?.defaults?.model).toEqual({

339+

primary: LOCAL_DEFAULT_MODEL,

340+

});

341+

});

342+343+

it("does not persist plugin enablement when install is skipped", async () => {

344+

resolveProviderInstallCatalogEntry.mockReturnValue({

345+

pluginId: "local-provider-plugin",

346+

providerId: LOCAL_PROVIDER_ID,

347+

methodId: LOCAL_AUTH_METHOD_ID,

348+

choiceId: LOCAL_PROVIDER_ID,

349+

choiceLabel: LOCAL_PROVIDER_LABEL,

350+

label: LOCAL_PROVIDER_LABEL,

351+

origin: "bundled",

352+

install: {

353+

npmSpec: "@openclaw/local-provider",

354+

},

355+

});

356+

resolveProviderPluginChoice.mockReturnValue(null);

357+358+

const result = await applyAuthChoiceLoadedPluginProvider(buildParams());

359+360+

expect(ensureOnboardingPluginInstalled).toHaveBeenCalledOnce();

361+

expect(result).toEqual({ config: {}, retrySelection: true });

362+

});

363+364+

it("preserves install config when the chosen provider still cannot resolve after install", async () => {

365+

resolveProviderInstallCatalogEntry.mockReturnValue({

366+

pluginId: "local-provider-plugin",

367+

providerId: LOCAL_PROVIDER_ID,

368+

methodId: LOCAL_AUTH_METHOD_ID,

369+

choiceId: LOCAL_PROVIDER_ID,

370+

choiceLabel: LOCAL_PROVIDER_LABEL,

371+

label: LOCAL_PROVIDER_LABEL,

372+

origin: "bundled",

373+

install: {

374+

npmSpec: "@openclaw/local-provider",

375+

},

376+

});

377+

ensureOnboardingPluginInstalled.mockResolvedValue({

378+

cfg: {

379+

plugins: {

380+

entries: {

381+

"local-provider-plugin": {

382+

enabled: true,

383+

},

384+

},

385+

},

386+

},

387+

installed: true,

388+

pluginId: "local-provider-plugin",

389+

status: "installed",

390+

});

391+

resolveProviderPluginChoice.mockReturnValue(null);

392+393+

const result = await applyAuthChoiceLoadedPluginProvider(buildParams());

394+395+

expect(clearPluginDiscoveryCache).toHaveBeenCalledOnce();

396+

expect(result).toEqual({

397+

config: {

398+

plugins: {

399+

entries: {

400+

"local-provider-plugin": {

401+

enabled: true,

402+

},

403+

},

404+

},

405+

},

406+

retrySelection: true,

407+

});

408+

});

409+255410

it("merges provider config patches and emits provider notes", async () => {

256411

applyAuthProfileConfig.mockImplementation(((

257412

config: {