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

推荐订阅源

博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
GbyAI
GbyAI
博客园_首页
V
Visual Studio Blog
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 叶小钗
腾讯CDC
博客园 - Franky
IT之家
IT之家
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
B
Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

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
Manage the Codex app-server binary in OpenClaw (#71808) ·...
pash-openai · 2026-04-26 · via Recent Commits to openclaw:main

@@ -0,0 +1,95 @@

1+

import path from "node:path";

2+

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

3+

import type { CodexAppServerStartOptions } from "./config.js";

4+

import {

5+

resolveManagedCodexAppServerPaths,

6+

resolveManagedCodexAppServerStartOptions,

7+

} from "./managed-binary.js";

8+9+

function startOptions(

10+

commandSource: CodexAppServerStartOptions["commandSource"],

11+

): CodexAppServerStartOptions {

12+

return {

13+

transport: "stdio",

14+

command: "codex",

15+

commandSource,

16+

args: ["app-server", "--listen", "stdio://"],

17+

headers: {},

18+

};

19+

}

20+21+

function managedCommandPath(root: string, platform: NodeJS.Platform): string {

22+

return path.join(root, "node_modules", ".bin", platform === "win32" ? "codex.cmd" : "codex");

23+

}

24+25+

describe("managed Codex app-server binary", () => {

26+

it("leaves explicit command overrides unchanged", async () => {

27+

const explicitOptions = startOptions("config");

28+

const pathExists = vi.fn(async () => false);

29+30+

await expect(

31+

resolveManagedCodexAppServerStartOptions(explicitOptions, {

32+

platform: "darwin",

33+

pathExists,

34+

}),

35+

).resolves.toBe(explicitOptions);

36+

expect(pathExists).not.toHaveBeenCalled();

37+

});

38+39+

it("resolves the plugin-local bundled Codex binary", async () => {

40+

const pluginRoot = path.join("/tmp", "openclaw", "extensions", "codex");

41+

const paths = resolveManagedCodexAppServerPaths({ platform: "darwin", pluginRoot });

42+

const pathExists = vi.fn(async (filePath: string) => filePath === paths.commandPath);

43+44+

await expect(

45+

resolveManagedCodexAppServerStartOptions(startOptions("managed"), {

46+

platform: "darwin",

47+

pluginRoot,

48+

pathExists,

49+

}),

50+

).resolves.toEqual({

51+

...startOptions("managed"),

52+

command: paths.commandPath,

53+

commandSource: "resolved-managed",

54+

});

55+

expect(paths.commandPath).toBe(managedCommandPath(pluginRoot, "darwin"));

56+

});

57+58+

it("resolves Windows Codex command shims", () => {

59+

const pluginRoot = path.win32.join("C:\\", "OpenClaw", "dist", "extensions", "codex");

60+

const paths = resolveManagedCodexAppServerPaths({ platform: "win32", pluginRoot });

61+62+

expect(paths.commandPath.endsWith(path.win32.join("node_modules", ".bin", "codex.cmd"))).toBe(

63+

true,

64+

);

65+

});

66+67+

it("finds Codex in the external runtime-deps install root used by packaged plugins", async () => {

68+

const installRoot = path.join("/tmp", "openclaw-runtime-deps", "codex");

69+

const pluginRoot = path.join(installRoot, "dist", "extensions", "codex");

70+

const installedCommand = managedCommandPath(installRoot, "linux");

71+

const pathExists = vi.fn(async (filePath: string) => filePath === installedCommand);

72+73+

await expect(

74+

resolveManagedCodexAppServerStartOptions(startOptions("managed"), {

75+

platform: "linux",

76+

pluginRoot,

77+

pathExists,

78+

}),

79+

).resolves.toEqual({

80+

...startOptions("managed"),

81+

command: installedCommand,

82+

commandSource: "resolved-managed",

83+

});

84+

});

85+86+

it("fails clearly when bundled runtime deps did not stage Codex", async () => {

87+

await expect(

88+

resolveManagedCodexAppServerStartOptions(startOptions("managed"), {

89+

platform: "darwin",

90+

pluginRoot: path.join("/tmp", "openclaw", "extensions", "codex"),

91+

pathExists: vi.fn(async () => false),

92+

}),

93+

).rejects.toThrow("Managed Codex app-server binary was not found");

94+

});

95+

});