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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
S
SegmentFault 最新的问题
博客园 - Franky
博客园_首页
T
Tailwind CSS 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: guard cli bootstrap imports · openclaw/openclaw@a0aedea
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -20,6 +20,15 @@ const getProgramContextMock = vi.hoisted(() => vi.fn(() => null));

2020

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

2121

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

2222

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

23+

const hasEnvHttpProxyConfiguredMock = vi.hoisted(() => vi.fn(() => false));

24+

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

25+

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

26+

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

27+

const createCliProgressMock = vi.hoisted(() =>

28+

vi.fn(() => ({

29+

done: progressDoneMock,

30+

})),

31+

);

2332

const maybeRunCliInContainerMock = vi.hoisted(() =>

2433

vi.fn<

2534

(argv: string[]) => { handled: true; exitCode: number } | { handled: false; argv: string[] }

@@ -96,12 +105,29 @@ vi.mock("../terminal/restore.js", () => ({

96105

restoreTerminalState: restoreTerminalStateMock,

97106

}));

98107108+

vi.mock("../infra/net/proxy-env.js", () => ({

109+

hasEnvHttpProxyConfigured: hasEnvHttpProxyConfiguredMock,

110+

}));

111+112+

vi.mock("../infra/net/undici-global-dispatcher.js", () => ({

113+

ensureGlobalUndiciEnvProxyDispatcher: ensureGlobalUndiciEnvProxyDispatcherMock,

114+

}));

115+116+

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

117+

runCrestodian: runCrestodianMock,

118+

}));

119+120+

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

121+

createCliProgress: createCliProgressMock,

122+

}));

123+99124

describe("runCli exit behavior", () => {

100125

beforeEach(() => {

101126

vi.clearAllMocks();

102127

hasMemoryRuntimeMock.mockReturnValue(false);

103128

outputPrecomputedBrowserHelpTextMock.mockReturnValue(false);

104129

outputPrecomputedRootHelpTextMock.mockReturnValue(false);

130+

hasEnvHttpProxyConfiguredMock.mockReturnValue(false);

105131

getProgramContextMock.mockReturnValue(null);

106132

delete process.env.OPENCLAW_DISABLE_CLI_STARTUP_HELP_FAST_PATH;

107133

});

@@ -146,6 +172,17 @@ describe("runCli exit behavior", () => {

146172

exitSpy.mockRestore();

147173

});

148174175+

it("keeps root help on the precomputed path without proxy bootstrap", async () => {

176+

outputPrecomputedRootHelpTextMock.mockReturnValueOnce(true);

177+178+

await runCli(["node", "openclaw", "--help"]);

179+180+

expect(outputPrecomputedRootHelpTextMock).toHaveBeenCalledTimes(1);

181+

expect(hasEnvHttpProxyConfiguredMock).not.toHaveBeenCalled();

182+

expect(ensureGlobalUndiciEnvProxyDispatcherMock).not.toHaveBeenCalled();

183+

expect(runCrestodianMock).not.toHaveBeenCalled();

184+

});

185+149186

it("renders root help without building the full program", async () => {

150187

const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => {

151188

throw new Error(`unexpected process.exit(${String(code)})`);

@@ -163,6 +200,52 @@ describe("runCli exit behavior", () => {

163200

exitSpy.mockRestore();

164201

});

165202203+

it("bootstraps env proxy before bare Crestodian startup", async () => {

204+

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

205+

const stdinTty = Object.getOwnPropertyDescriptor(process.stdin, "isTTY");

206+

const stdoutTty = Object.getOwnPropertyDescriptor(process.stdout, "isTTY");

207+

Object.defineProperty(process.stdin, "isTTY", { configurable: true, value: true });

208+

Object.defineProperty(process.stdout, "isTTY", { configurable: true, value: true });

209+210+

try {

211+

await runCli(["node", "openclaw"]);

212+

} finally {

213+

if (stdinTty) {

214+

Object.defineProperty(process.stdin, "isTTY", stdinTty);

215+

} else {

216+

delete (process.stdin as { isTTY?: boolean }).isTTY;

217+

}

218+

if (stdoutTty) {

219+

Object.defineProperty(process.stdout, "isTTY", stdoutTty);

220+

} else {

221+

delete (process.stdout as { isTTY?: boolean }).isTTY;

222+

}

223+

}

224+225+

expect(ensureGlobalUndiciEnvProxyDispatcherMock).toHaveBeenCalledTimes(1);

226+

expect(runCrestodianMock).toHaveBeenCalledWith({ onReady: expect.any(Function) });

227+

expect(ensureGlobalUndiciEnvProxyDispatcherMock.mock.invocationCallOrder[0]).toBeLessThan(

228+

runCrestodianMock.mock.invocationCallOrder[0],

229+

);

230+

});

231+232+

it("bootstraps env proxy before modern onboard Crestodian startup", async () => {

233+

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

234+235+

await runCli(["node", "openclaw", "onboard", "--modern", "--json"]);

236+237+

expect(ensureGlobalUndiciEnvProxyDispatcherMock).toHaveBeenCalledTimes(1);

238+

expect(runCrestodianMock).toHaveBeenCalledWith({

239+

message: undefined,

240+

yes: false,

241+

json: true,

242+

interactive: true,

243+

});

244+

expect(ensureGlobalUndiciEnvProxyDispatcherMock.mock.invocationCallOrder[0]).toBeLessThan(

245+

runCrestodianMock.mock.invocationCallOrder[0],

246+

);

247+

});

248+166249

it("closes memory managers when a runtime was registered", async () => {

167250

tryRouteCliMock.mockResolvedValueOnce(true);

168251

hasMemoryRuntimeMock.mockReturnValue(true);