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

推荐订阅源

博客园_首页
H
Help Net Security
量子位
The Cloudflare Blog
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
罗磊的独立博客
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
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
fix(migrate): use resolved provider for options (#83323) ...
giodl73-repo · 2026-05-19 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -0,0 +1,75 @@

1+

import { mkdtempSync } from "node:fs";

2+

import { tmpdir } from "node:os";

3+

import path from "node:path";

4+

import { describe, expect, it, vi } from "vitest";

5+

import type { MigrationPlan, MigrationProviderPlugin } from "../../plugins/types.js";

6+

import { createNonExitingRuntime } from "../../runtime.js";

7+

import { runMigrationApply } from "./apply.js";

8+
9+

const stateDir = mkdtempSync(path.join(tmpdir(), "openclaw-migrate-apply-"));

10+
11+

vi.mock("../../config/paths.js", () => ({

12+

resolveStateDir: () => stateDir,

13+

}));

14+
15+

function buildEmptyPlan(): MigrationPlan {

16+

return {

17+

providerId: "codex",

18+

source: "/tmp/codex",

19+

summary: {

20+

total: 0,

21+

planned: 0,

22+

migrated: 0,

23+

skipped: 0,

24+

conflicts: 0,

25+

errors: 0,

26+

sensitive: 0,

27+

},

28+

items: [],

29+

};

30+

}

31+
32+

describe("runMigrationApply", () => {

33+

it("uses the resolved provider id when forwarding Codex options", async () => {

34+

const plan = vi.fn(async () => buildEmptyPlan());

35+

const apply = vi.fn(async () => buildEmptyPlan());

36+

const provider: MigrationProviderPlugin = {

37+

id: "codex",

38+

label: "Codex",

39+

plan,

40+

apply,

41+

};

42+
43+

await runMigrationApply({

44+

runtime: createNonExitingRuntime(),

45+

opts: {

46+

yes: true,

47+

json: true,

48+

noBackup: true,

49+

configOverride: {},

50+

configPatchMode: "return",

51+

verifyPluginApps: true,

52+

},

53+

providerId: "codex",

54+

provider,

55+

});

56+
57+

expect(plan).toHaveBeenCalledWith(

58+

expect.objectContaining({

59+

providerOptions: {

60+

configPatchMode: "return",

61+

verifyPluginApps: true,

62+

},

63+

}),

64+

);

65+

expect(apply).toHaveBeenCalledWith(

66+

expect.objectContaining({

67+

providerOptions: {

68+

configPatchMode: "return",

69+

verifyPluginApps: true,

70+

},

71+

}),

72+

expect.anything(),

73+

);

74+

});

75+

});

Original file line numberDiff line numberDiff line change

@@ -69,7 +69,7 @@ export async function runMigrationApply(params: {

6969

includeSecrets: params.opts.includeSecrets,

7070

overwrite: params.opts.overwrite,

7171

configOverride: params.opts.configOverride,

72-

providerOptions: buildMigrationProviderOptions(params.opts),

72+

providerOptions: buildMigrationProviderOptions(params.opts, params.providerId),

7373

runtime: params.runtime,

7474

json: params.opts.json,

7575

}),

@@ -99,7 +99,7 @@ export async function runMigrationApply(params: {

9999

includeSecrets: params.opts.includeSecrets,

100100

overwrite: params.opts.overwrite,

101101

configOverride: params.opts.configOverride,

102-

providerOptions: buildMigrationProviderOptions(params.opts),

102+

providerOptions: buildMigrationProviderOptions(params.opts, params.providerId),

103103

runtime: params.runtime,

104104

backupPath,

105105

reportDir,

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,32 @@

1+

import { describe, expect, it } from "vitest";

2+

import { buildMigrationProviderOptions } from "./providers.js";

3+
4+

describe("buildMigrationProviderOptions", () => {

5+

it("uses the resolved provider id for Codex options", () => {

6+

expect(

7+

buildMigrationProviderOptions(

8+

{

9+

configPatchMode: "return",

10+

verifyPluginApps: true,

11+

},

12+

"codex",

13+

),

14+

).toEqual({

15+

configPatchMode: "return",

16+

verifyPluginApps: true,

17+

});

18+

});

19+
20+

it("omits Codex-only options for other providers", () => {

21+

expect(

22+

buildMigrationProviderOptions(

23+

{

24+

configPatchMode: "return",

25+

provider: "other",

26+

verifyPluginApps: true,

27+

},

28+

"other",

29+

),

30+

).toBeUndefined();

31+

});

32+

});

Original file line numberDiff line numberDiff line change

@@ -28,12 +28,13 @@ export function resolveMigrationProvider(

2828
2929

export function buildMigrationProviderOptions(

3030

opts: MigrateCommonOptions,

31+

providerId = opts.provider,

3132

): Record<string, unknown> | undefined {

3233

const options: Record<string, unknown> = {};

33-

if (opts.provider === "codex" && opts.verifyPluginApps === true) {

34+

if (providerId === "codex" && opts.verifyPluginApps === true) {

3435

options.verifyPluginApps = true;

3536

}

36-

if (opts.provider === "codex" && opts.configPatchMode) {

37+

if (providerId === "codex" && opts.configPatchMode) {

3738

options.configPatchMode = opts.configPatchMode;

3839

}

3940

return Object.keys(options).length > 0 ? options : undefined;