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

推荐订阅源

H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
L
LangChain Blog
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
Hugging Face - Blog
Hugging Face - Blog
G
Google Developers Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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
test: add plugin install docker e2e lanes · openclaw/open...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -0,0 +1,117 @@

1+

import fs from "node:fs";

2+

import path from "node:path";

3+4+

const readJson = (file) => JSON.parse(fs.readFileSync(file, "utf8"));

5+6+

function stateDir() {

7+

return process.env.OPENCLAW_STATE_DIR || path.join(process.env.HOME, ".openclaw");

8+

}

9+10+

function configPath() {

11+

return process.env.OPENCLAW_CONFIG_PATH || path.join(stateDir(), "openclaw.json");

12+

}

13+14+

function realPathMaybe(filePath) {

15+

try {

16+

return fs.realpathSync(filePath);

17+

} catch {

18+

return path.resolve(filePath);

19+

}

20+

}

21+22+

function assertPathInside(parentPath, childPath, label) {

23+

const parent = realPathMaybe(parentPath);

24+

const child = realPathMaybe(childPath);

25+

const relative = path.relative(parent, child);

26+

if (relative.startsWith("..") || path.isAbsolute(relative)) {

27+

throw new Error(`${label} resolved outside ${parentPath}: ${child}`);

28+

}

29+

}

30+31+

function installRecords() {

32+

const indexPath = path.join(stateDir(), "plugins", "installs.json");

33+

const index = fs.existsSync(indexPath) ? readJson(indexPath) : {};

34+

return index.installRecords || index.records || cfg.plugins?.installs || {};

35+

}

36+37+

function findPackageJson(packageName, roots) {

38+

const packagePath = packageName.startsWith("@")

39+

? path.join(...packageName.split("/"), "package.json")

40+

: path.join(packageName, "package.json");

41+

const candidates = roots.map((root) => path.join(root, "node_modules", packagePath));

42+

return candidates.find((candidate) => fs.existsSync(candidate));

43+

}

44+45+

const cfg = readJson(configPath());

46+

const inspect = readJson("/tmp/openclaw-codex-inspect.json");

47+

const records = installRecords();

48+

const codexRecord = records.codex || inspect.install;

49+

if (!codexRecord) {

50+

throw new Error(`missing codex install record: ${JSON.stringify(records)}`);

51+

}

52+

if (codexRecord.source !== "npm") {

53+

throw new Error(`expected npm codex install record, got ${codexRecord.source}`);

54+

}

55+

if (!String(codexRecord.spec || "").includes("@openclaw/codex")) {

56+

throw new Error(`expected @openclaw/codex install spec, got ${codexRecord.spec}`);

57+

}

58+59+

const npmRoot = path.join(stateDir(), "npm");

60+

const installPath = String(codexRecord.installPath || "").replace(/^~(?=$|\/)/u, process.env.HOME);

61+

if (!installPath) {

62+

throw new Error(`missing codex installPath: ${JSON.stringify(codexRecord)}`);

63+

}

64+

assertPathInside(npmRoot, installPath, "codex install path");

65+66+

const codexPackageJson = path.join(installPath, "package.json");

67+

if (!fs.existsSync(codexPackageJson)) {

68+

throw new Error(`missing npm-installed @openclaw/codex package: ${codexPackageJson}`);

69+

}

70+

const codexPackage = readJson(codexPackageJson);

71+

if (codexPackage.name !== "@openclaw/codex") {

72+

throw new Error(`unexpected codex package name: ${codexPackage.name}`);

73+

}

74+75+

const openAiCodexPackageJson = findPackageJson("@openai/codex", [installPath, npmRoot]);

76+

if (!openAiCodexPackageJson) {

77+

throw new Error("missing @openai/codex dependency under managed npm root");

78+

}

79+

assertPathInside(npmRoot, openAiCodexPackageJson, "@openai/codex dependency");

80+81+

const list = readJson("/tmp/openclaw-plugins-list.json");

82+

const plugin = (list.plugins || []).find((entry) => entry.id === "codex");

83+

if (!plugin || plugin.enabled !== true || plugin.status !== "loaded") {

84+

throw new Error(`codex plugin was not enabled+loaded: ${JSON.stringify(plugin)}`);

85+

}

86+87+

if (inspect.plugin?.id !== "codex" || inspect.plugin?.status !== "loaded") {

88+

throw new Error(`unexpected codex inspect state: ${JSON.stringify(inspect.plugin)}`);

89+

}

90+

const hasHarness =

91+

(Array.isArray(inspect.plugin?.agentHarnessIds) &&

92+

inspect.plugin.agentHarnessIds.includes("codex")) ||

93+

(Array.isArray(inspect.capabilities) &&

94+

inspect.capabilities.some(

95+

(entry) => entry?.kind === "agent-harness" && entry.ids?.includes("codex"),

96+

));

97+

if (!hasHarness) {

98+

throw new Error(`codex harness was not registered: ${JSON.stringify(inspect.plugin)}`);

99+

}

100+101+

const primaryModel = cfg.agents?.defaults?.model?.primary;

102+

if (primaryModel !== "openai/gpt-5.5") {

103+

throw new Error(`expected OpenAI onboarding model openai/gpt-5.5, got ${primaryModel}`);

104+

}

105+

const providerRuntime = cfg.models?.providers?.openai?.agentRuntime?.id;

106+

if (providerRuntime && providerRuntime !== "codex") {

107+

throw new Error(`unexpected OpenAI provider runtime: ${providerRuntime}`);

108+

}

109+110+

const authPath = path.join(stateDir(), "agents", "main", "agent", "auth-profiles.json");

111+

const authRaw = fs.readFileSync(authPath, "utf8");

112+

if (!authRaw.includes("OPENAI_API_KEY")) {

113+

throw new Error("auth profile did not persist OPENAI_API_KEY env ref");

114+

}

115+

if (authRaw.includes("sk-openclaw-codex-on-demand-e2e")) {

116+

throw new Error("auth profile persisted the raw OpenAI test key");

117+

}