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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
量子位
S
SegmentFault 最新的问题
博客园 - 聂微东
博客园 - 【当耐特】
J
Java Code Geeks
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
V
V2EX
人人都是产品经理
人人都是产品经理
博客园 - Franky
罗磊的独立博客
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

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: preserve wrapper env during gateway reinstall · open...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -30,13 +30,22 @@ const resolveGatewayAuthMock = vi.hoisted(() =>

3030

);

3131

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

3232

const randomTokenMock = vi.hoisted(() => vi.fn(() => "generated-token"));

33-

const buildGatewayInstallPlanMock = vi.hoisted(() =>

34-

vi.fn(async () => ({

35-

programArguments: ["openclaw", "gateway", "run"],

36-

workingDirectory: "/tmp",

37-

environment: {},

38-

})),

39-

);

33+

const createInstallPlanFixture = vi.hoisted(() => {

34+

return async (params?: { wrapperPath?: string; env?: Record<string, string | undefined> }) => {

35+

const environment: Record<string, string | undefined> = {};

36+

if (params?.wrapperPath || params?.env?.OPENCLAW_WRAPPER) {

37+

environment.OPENCLAW_WRAPPER = params.wrapperPath ?? params.env?.OPENCLAW_WRAPPER;

38+

}

39+

return {

40+

programArguments: params?.wrapperPath

41+

? [params.wrapperPath, "gateway", "run"]

42+

: ["openclaw", "gateway", "run"],

43+

workingDirectory: "/tmp",

44+

environment,

45+

};

46+

};

47+

});

48+

const buildGatewayInstallPlanMock = vi.hoisted(() => vi.fn(createInstallPlanFixture));

4049

const parsePortMock = vi.hoisted(() => vi.fn(() => null));

4150

const isGatewayDaemonRuntimeMock = vi.hoisted(() => vi.fn(() => true));

4251

const installDaemonServiceAndEmitMock = vi.hoisted(() => vi.fn(async () => {}));

@@ -108,6 +117,11 @@ vi.mock("../../commands/daemon-install-helpers.js", () => ({

108117

buildGatewayInstallPlan: buildGatewayInstallPlanMock,

109118

}));

110119120+

vi.mock("../../daemon/program-args.js", () => ({

121+

OPENCLAW_WRAPPER_ENV_KEY: "OPENCLAW_WRAPPER",

122+

resolveOpenClawWrapperPath: async (value: string | undefined) => value?.trim() || undefined,

123+

}));

124+111125

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

112126

parsePort: parsePortMock,

113127

createDaemonInstallActionContext: (jsonFlag: unknown) => {

@@ -188,6 +202,7 @@ describe("runDaemonInstall", () => {

188202

installDaemonServiceAndEmitMock.mockReset();

189203

service.isLoaded.mockReset();

190204

service.stage.mockReset();

205+

service.readCommand.mockReset();

191206

resetRuntimeCapture();

192207

actionState.warnings.length = 0;

193208

actionState.emitted.length = 0;

@@ -211,11 +226,7 @@ describe("runDaemonInstall", () => {

211226

});

212227

resolveSecretRefValuesMock.mockResolvedValue(new Map());

213228

randomTokenMock.mockReturnValue("generated-token");

214-

buildGatewayInstallPlanMock.mockResolvedValue({

215-

programArguments: ["openclaw", "gateway", "run"],

216-

workingDirectory: "/tmp",

217-

environment: {},

218-

});

229+

buildGatewayInstallPlanMock.mockImplementation(createInstallPlanFixture);

219230

parsePortMock.mockReturnValue(null);

220231

isGatewayDaemonRuntimeMock.mockReturnValue(true);

221232

installDaemonServiceAndEmitMock.mockResolvedValue(undefined);

@@ -402,6 +413,50 @@ describe("runDaemonInstall", () => {

402413

expect(actionState.emitted.at(-1)).toMatchObject({ result: "already-installed" });

403414

});

404415416+

it("preserves wrapper env from an installed but unloaded service during forced reinstall", async () => {

417+

service.isLoaded.mockResolvedValue(false);

418+

service.readCommand.mockResolvedValue({

419+

programArguments: ["/usr/local/bin/openclaw-doppler", "gateway", "run"],

420+

environment: {

421+

OPENCLAW_WRAPPER: "/usr/local/bin/openclaw-doppler",

422+

},

423+

} as never);

424+425+

await runDaemonInstall({ json: true, force: true });

426+427+

expect(service.readCommand).toHaveBeenCalledTimes(1);

428+

expect(buildGatewayInstallPlanMock).toHaveBeenCalledWith(

429+

expect.objectContaining({

430+

wrapperPath: "/usr/local/bin/openclaw-doppler",

431+

existingEnvironment: expect.objectContaining({

432+

OPENCLAW_WRAPPER: "/usr/local/bin/openclaw-doppler",

433+

}),

434+

env: expect.objectContaining({

435+

OPENCLAW_WRAPPER: "/usr/local/bin/openclaw-doppler",

436+

}),

437+

}),

438+

);

439+

expect(installDaemonServiceAndEmitMock).toHaveBeenCalledTimes(1);

440+

});

441+442+

it("reinstalls when wrapper command matches but wrapper env is missing", async () => {

443+

service.isLoaded.mockResolvedValue(true);

444+

service.readCommand.mockResolvedValue({

445+

programArguments: ["/usr/local/bin/openclaw-doppler", "gateway", "run"],

446+

environment: {},

447+

} as never);

448+449+

await runDaemonInstall({

450+

json: true,

451+

wrapper: "/usr/local/bin/openclaw-doppler",

452+

});

453+454+

expect(installDaemonServiceAndEmitMock).toHaveBeenCalledTimes(1);

455+

expect(actionState.warnings).toContain(

456+

"Gateway service OPENCLAW_WRAPPER differs from the current wrapper install plan; refreshing the install.",

457+

);

458+

});

459+405460

it("reinstalls when the embedded gateway token differs from the install plan", async () => {

406461

service.isLoaded.mockResolvedValue(true);

407462

service.readCommand.mockResolvedValue({