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

推荐订阅源

G
Google Developers Blog
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
A
About on SuperTechFans
GbyAI
GbyAI
宝玉的分享
宝玉的分享
爱范儿
爱范儿
博客园 - 【当耐特】
博客园 - 司徒正美
博客园 - 聂微东
P
Proofpoint News Feed
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
Jina AI
Jina AI
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
博客园 - 叶小钗

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(test): avoid scanning outbound threading guardrails ·...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -1,8 +1,9 @@

1-

import { existsSync, readdirSync, readFileSync } from "node:fs";

1+

import { spawnSync } from "node:child_process";

2+

import fs, { existsSync, readFileSync } from "node:fs";

23

import path from "node:path";

34

import { fileURLToPath } from "node:url";

45

import { bundledPluginFile } from "openclaw/plugin-sdk/test-fixtures";

5-

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

6+

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

6778

const thisFilePath = fileURLToPath(import.meta.url);

89

const thisDir = path.dirname(thisFilePath);

@@ -18,9 +19,65 @@ function readRepoFile(relativePath: string): string {

1819

return readFileSync(absolute, "utf8");

1920

}

202122+

function listGitFiles(pathspecs: string[]): string[] | null {

23+

const result = spawnSync("git", ["ls-files", "--", ...pathspecs], {

24+

cwd: repoRoot,

25+

encoding: "utf8",

26+

maxBuffer: 1024 * 1024,

27+

stdio: ["ignore", "pipe", "ignore"],

28+

});

29+

if (result.status !== 0) {

30+

return null;

31+

}

32+

return result.stdout

33+

.split("\n")

34+

.map((line) => line.trim())

35+

.filter((line) => line.length > 0)

36+

.map(toPosix)

37+

.toSorted();

38+

}

39+40+

function listFindFiles(args: string[]): string[] | null {

41+

const result = spawnSync("find", args, {

42+

cwd: repoRoot,

43+

encoding: "utf8",

44+

maxBuffer: 1024 * 1024,

45+

stdio: ["ignore", "pipe", "ignore"],

46+

});

47+

if (result.status !== 0) {

48+

return null;

49+

}

50+

return result.stdout

51+

.split("\n")

52+

.map((line) => line.trim())

53+

.filter((line) => line.length > 0)

54+

.map((file) => path.relative(repoRoot, file))

55+

.map(toPosix)

56+

.toSorted();

57+

}

58+2159

function listCoreOutboundEntryFiles(): string[] {

60+

const externalFiles =

61+

listGitFiles(["src/channels/plugins/outbound/*.ts"]) ??

62+

listFindFiles([

63+

path.join(repoRoot, "src/channels/plugins/outbound"),

64+

"-maxdepth",

65+

"1",

66+

"-type",

67+

"f",

68+

"-name",

69+

"*.ts",

70+

]);

71+

if (externalFiles) {

72+

return externalFiles

73+

.filter((file) => !file.endsWith(".test.ts"))

74+

.map(toPosix)

75+

.toSorted();

76+

}

77+2278

const outboundDir = path.join(repoRoot, "src/channels/plugins/outbound");

23-

return readdirSync(outboundDir)

79+

return fs

80+

.readdirSync(outboundDir)

2481

.filter((name) => name.endsWith(".ts") && !name.endsWith(".test.ts"))

2582

.map((name) => toPosix(path.join("src/channels/plugins/outbound", name)))

2683

.toSorted();

@@ -30,11 +87,25 @@ function listExtensionFiles(): {

3087

adapterEntrypoints: string[];

3188

inlineChannelEntrypoints: string[];

3289

} {

90+

const externalFiles =

91+

listGitFiles(["extensions/*/src/outbound.ts", "extensions/*/src/channel.ts"]) ??

92+

listFindFiles([

93+

path.join(repoRoot, "extensions"),

94+

"-path",

95+

"*/src/outbound.ts",

96+

"-o",

97+

"-path",

98+

"*/src/channel.ts",

99+

]);

100+

if (externalFiles) {

101+

return partitionExtensionEntrypoints(externalFiles);

102+

}

103+33104

const extensionsRoot = path.join(repoRoot, "extensions");

34105

const adapterEntrypoints: string[] = [];

35106

const inlineChannelEntrypoints: string[] = [];

3610737-

for (const entry of readdirSync(extensionsRoot, { withFileTypes: true })) {

108+

for (const entry of fs.readdirSync(extensionsRoot, { withFileTypes: true })) {

38109

if (!entry.isDirectory()) {

39110

continue;

40111

}

@@ -60,6 +131,33 @@ function listExtensionFiles(): {

60131

};

61132

}

62133134+

function partitionExtensionEntrypoints(files: string[]): {

135+

adapterEntrypoints: string[];

136+

inlineChannelEntrypoints: string[];

137+

} {

138+

const adapterEntrypoints: string[] = [];

139+

const inlineChannelEntrypoints: string[] = [];

140+141+

for (const file of files) {

142+

if (file.endsWith("/src/outbound.ts")) {

143+

adapterEntrypoints.push(file);

144+

continue;

145+

}

146+

if (!file.endsWith("/src/channel.ts")) {

147+

continue;

148+

}

149+

const source = readRepoFile(file);

150+

if (/\boutbound\s*:\s*\{/.test(source)) {

151+

inlineChannelEntrypoints.push(file);

152+

}

153+

}

154+155+

return {

156+

adapterEntrypoints: adapterEntrypoints.toSorted(),

157+

inlineChannelEntrypoints: inlineChannelEntrypoints.toSorted(),

158+

};

159+

}

160+63161

function listHighRiskRuntimeCfgFiles(): string[] {

64162

return [

65163

bundledPluginFile("telegram", "src/action-runtime.ts"),

@@ -163,6 +261,25 @@ function extractOutboundBlock(source: string, file: string): string {

163261

}

164262165263

describe("outbound cfg-threading guard", () => {

264+

it("lists outbound entrypoints without scanning directories in-process", () => {

265+

const readDir = vi.spyOn(fs, "readdirSync");

266+

try {

267+

const coreAdapterFiles = listCoreOutboundEntryFiles();

268+

const extensionFiles = listExtensionFiles();

269+270+

expect(coreAdapterFiles.length).toBeGreaterThan(0);

271+

expect(extensionFiles.adapterEntrypoints.length).toBeGreaterThan(0);

272+

expect(

273+

coreAdapterFiles.every((file) =>

274+

file.startsWith("src/channels/plugins/outbound/") && file.endsWith(".ts"),

275+

),

276+

).toBe(true);

277+

expect(readDir).not.toHaveBeenCalled();

278+

} finally {

279+

readDir.mockRestore();

280+

}

281+

});

282+166283

it("keeps outbound adapter entrypoints free of getRuntimeConfig calls", () => {

167284

const coreAdapterFiles = listCoreOutboundEntryFiles();

168285

const extensionAdapterFiles = listExtensionFiles().adapterEntrypoints;