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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
D
Docker
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Vercel News
Vercel News
F
Fortinet All Blogs
B
Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio 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
perf: trim agent workspace imports · openclaw/openclaw@3d...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -3,8 +3,8 @@ import type { Dirent } from "node:fs";

33

import fs from "node:fs/promises";

44

import os from "node:os";

55

import path from "node:path";

6-

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

7-

import { resolveAgentWorkspaceDir } from "../../../../src/agents/agent-scope.js";

6+

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

7+

import { resolveAgentWorkspaceDir } from "../../../../src/agents/agent-scope-config.js";

88

import type { OpenClawConfig } from "../../../../src/config/config.js";

99

import { resolveMemoryBackendConfig } from "./backend-config.js";

1010

@@ -54,6 +54,23 @@ const customQmdCollections = (

5454

const customCollectionPaths = (resolved: ResolvedMemoryBackendConfig): string[] =>

5555

customQmdCollections(resolved).map((collection) => collection.path);

565657+

let fixtureRoot: string;

58+

let fixtureId = 0;

59+60+

beforeAll(async () => {

61+

fixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qmd-backend-config-"));

62+

});

63+64+

afterAll(async () => {

65+

await fs.rm(fixtureRoot, { recursive: true, force: true });

66+

});

67+68+

async function createFixtureDir(name: string): Promise<string> {

69+

const dir = path.join(fixtureRoot, `${name}-${fixtureId++}`);

70+

await fs.mkdir(dir, { recursive: true });

71+

return dir;

72+

}

73+5774

describe("resolveMemoryBackendConfig", () => {

5875

it("defaults to builtin backend when config missing", () => {

5976

const cfg = { agents: { defaults: { workspace: "/tmp/memory-test" } } } as OpenClawConfig;

@@ -261,65 +278,57 @@ describe("resolveMemoryBackendConfig", () => {

261278

});

262279263280

it("keeps symlinked workspace paths agent-scoped when deciding custom collection names", async () => {

264-

const tmpRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qmd-backend-config-"));

281+

const tmpRoot = await createFixtureDir("symlinked-workspace");

265282

const workspaceDir = path.join(tmpRoot, "workspace");

266283

const workspaceAliasDir = path.join(tmpRoot, "workspace-alias");

267-

try {

268-

await fs.mkdir(workspaceDir, { recursive: true });

269-

await fs.symlink(workspaceDir, workspaceAliasDir);

270-

const cfg = {

271-

agents: {

272-

defaults: { workspace: workspaceDir },

273-

list: [{ id: "main", default: true, workspace: workspaceDir }],

274-

},

275-

memory: {

276-

backend: "qmd",

277-

qmd: {

278-

includeDefaultMemory: false,

279-

paths: [{ path: workspaceAliasDir, name: "workspace", pattern: "**/*.md" }],

280-

},

284+

await fs.mkdir(workspaceDir, { recursive: true });

285+

await fs.symlink(workspaceDir, workspaceAliasDir);

286+

const cfg = {

287+

agents: {

288+

defaults: { workspace: workspaceDir },

289+

list: [{ id: "main", default: true, workspace: workspaceDir }],

290+

},

291+

memory: {

292+

backend: "qmd",

293+

qmd: {

294+

includeDefaultMemory: false,

295+

paths: [{ path: workspaceAliasDir, name: "workspace", pattern: "**/*.md" }],

281296

},

282-

} as OpenClawConfig;

283-

const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });

284-

const names = collectionNames(resolved);

285-

expect(names.has("workspace-main")).toBe(true);

286-

expect(names.has("workspace")).toBe(false);

287-

} finally {

288-

await fs.rm(tmpRoot, { recursive: true, force: true });

289-

}

297+

},

298+

} as OpenClawConfig;

299+

const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });

300+

const names = collectionNames(resolved);

301+

expect(names.has("workspace-main")).toBe(true);

302+

expect(names.has("workspace")).toBe(false);

290303

});

291304292305

it("keeps unresolved child paths under a symlinked workspace agent-scoped", async () => {

293-

const tmpRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qmd-backend-config-"));

306+

const tmpRoot = await createFixtureDir("symlinked-child");

294307

const realRootDir = path.join(tmpRoot, "real-root");

295308

const aliasRootDir = path.join(tmpRoot, "alias-root");

296309

const workspaceDir = path.join(realRootDir, "workspace");

297310

const workspaceAliasDir = path.join(aliasRootDir, "workspace");

298-

try {

299-

await fs.mkdir(workspaceDir, { recursive: true });

300-

await fs.symlink(realRootDir, aliasRootDir);

301-

const cfg = {

302-

agents: {

303-

defaults: { workspace: workspaceDir },

304-

list: [{ id: "main", default: true, workspace: workspaceDir }],

305-

},

306-

memory: {

307-

backend: "qmd",

308-

qmd: {

309-

includeDefaultMemory: false,

310-

paths: [

311-

{ path: path.join(workspaceAliasDir, "notes"), name: "notes", pattern: "**/*.md" },

312-

],

313-

},

311+

await fs.mkdir(workspaceDir, { recursive: true });

312+

await fs.symlink(realRootDir, aliasRootDir);

313+

const cfg = {

314+

agents: {

315+

defaults: { workspace: workspaceDir },

316+

list: [{ id: "main", default: true, workspace: workspaceDir }],

317+

},

318+

memory: {

319+

backend: "qmd",

320+

qmd: {

321+

includeDefaultMemory: false,

322+

paths: [

323+

{ path: path.join(workspaceAliasDir, "notes"), name: "notes", pattern: "**/*.md" },

324+

],

314325

},

315-

} as OpenClawConfig;

316-

const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });

317-

const names = collectionNames(resolved);

318-

expect(names.has("notes-main")).toBe(true);

319-

expect(names.has("notes")).toBe(false);

320-

} finally {

321-

await fs.rm(tmpRoot, { recursive: true, force: true });

322-

}

326+

},

327+

} as OpenClawConfig;

328+

const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });

329+

const names = collectionNames(resolved);

330+

expect(names.has("notes-main")).toBe(true);

331+

expect(names.has("notes")).toBe(false);

323332

});

324333325334

it("resolves qmd update timeout overrides", () => {