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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
罗磊的独立博客
T
Tailwind CSS Blog
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
博客园 - Franky
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs

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
perf(gateway): reduce startup filesystem probes · opencla...
steipete · 2026-05-24 · via Recent Commits to openclaw:main

@@ -30,6 +30,37 @@ function isDirectory(dirPath: string): boolean {

3030

}

3131

}

323233+

function splitPathParts(pathEnv: string): Set<string> {

34+

return new Set(

35+

pathEnv

36+

.split(path.delimiter)

37+

.map((part) => part.trim())

38+

.filter(Boolean),

39+

);

40+

}

41+42+

function isKnownPathDir(existingPathParts: ReadonlySet<string>, dirPath: string): boolean {

43+

return existingPathParts.has(dirPath) || isDirectory(dirPath);

44+

}

45+46+

function isLinuxbrewPath(dirPath: string): boolean {

47+

return dirPath.split(path.sep).includes(".linuxbrew");

48+

}

49+50+

function resolvePathBootstrapBrewDirs(params: {

51+

homeDir: string;

52+

platform: NodeJS.Platform;

53+

existingPathParts: ReadonlySet<string>;

54+

}): string[] {

55+

const candidates = resolveBrewPathDirs({ homeDir: params.homeDir });

56+

if (params.platform !== "darwin") {

57+

return candidates;

58+

}

59+

return candidates.filter(

60+

(candidate) => !isLinuxbrewPath(candidate) || params.existingPathParts.has(candidate),

61+

);

62+

}

63+3364

function mergePath(params: { existing: string; prepend?: string[]; append?: string[] }): string {

3465

const partsExisting = params.existing

3566

.split(path.delimiter)

@@ -49,7 +80,10 @@ function mergePath(params: { existing: string; prepend?: string[]; append?: stri

4980

return merged.join(path.delimiter);

5081

}

518252-

function candidateBinDirs(opts: EnsureOpenClawPathOpts): { prepend: string[]; append: string[] } {

83+

function candidateBinDirs(

84+

opts: EnsureOpenClawPathOpts,

85+

existingPathParts: ReadonlySet<string>,

86+

): { prepend: string[]; append: string[] } {

5387

const execPath = opts.execPath ?? process.execPath;

5488

const cwd = opts.cwd ?? process.cwd();

5589

const homeDir = opts.homeDir ?? os.homedir();

@@ -100,10 +134,10 @@ function candidateBinDirs(opts: EnsureOpenClawPathOpts): { prepend: string[]; ap

100134

// shadow trusted OS binaries.

101135

// This includes Brew/Homebrew dirs, which are useful for finding `openclaw`

102136

// in launchd/minimal environments but must not be treated as trusted.

103-

append.push(...resolveBrewPathDirs({ homeDir }));

137+

append.push(...resolvePathBootstrapBrewDirs({ homeDir, platform, existingPathParts }));

104138

const miseDataDir = process.env.MISE_DATA_DIR ?? path.join(homeDir, ".local", "share", "mise");

105139

const miseShims = path.join(miseDataDir, "shims");

106-

if (isDirectory(miseShims)) {

140+

if (isKnownPathDir(existingPathParts, miseShims)) {

107141

append.push(miseShims);

108142

}

109143

if (platform === "darwin") {

@@ -117,7 +151,10 @@ function candidateBinDirs(opts: EnsureOpenClawPathOpts): { prepend: string[]; ap

117151

append.push(path.join(homeDir, ".bun", "bin"));

118152

append.push(path.join(homeDir, ".yarn", "bin"));

119153120-

return { prepend: prepend.filter(isDirectory), append: append.filter(isDirectory) };

154+

return {

155+

prepend: prepend.filter((candidate) => isKnownPathDir(existingPathParts, candidate)),

156+

append: append.filter((candidate) => isKnownPathDir(existingPathParts, candidate)),

157+

};

121158

}

122159123160

/**

@@ -131,7 +168,8 @@ export function ensureOpenClawCliOnPath(opts: EnsureOpenClawPathOpts = {}) {

131168

process.env.OPENCLAW_PATH_BOOTSTRAPPED = "1";

132169133170

const existing = opts.pathEnv ?? process.env.PATH ?? "";

134-

const { prepend, append } = candidateBinDirs(opts);

171+

const existingPathParts = splitPathParts(existing);

172+

const { prepend, append } = candidateBinDirs(opts, existingPathParts);

135173

if (prepend.length === 0 && append.length === 0) {

136174

return;

137175

}