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

推荐订阅源

有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
V
V2EX
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
月光博客
月光博客
云风的 BLOG
云风的 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
fix: isolate memory index test state · openclaw/openclaw@...
shakkernerd · 2026-06-26 · via Recent Commits to openclaw:main

@@ -43,6 +43,7 @@ let providerCloseGate: Promise<void> | null = null;

4343

let providerInitGate: Promise<void> | null = null;

4444

let providerCalls: Array<{ provider?: string; model?: string; outputDimensionality?: number }> = [];

4545

let forceNoProvider = false;

46+

const originalMemoryIndexStateDir = process.env.OPENCLAW_STATE_DIR;

46474748

const identityAliasFixture = vi.hoisted(() => ({

4849

provider: "identity-alias-test",

@@ -58,6 +59,18 @@ function createLocalWorkerExitError(): Error {

5859

});

5960

}

606162+

function setMemoryIndexStateDir(stateDir: string): void {

63+

Reflect.set(process.env, "OPENCLAW_STATE_DIR", stateDir);

64+

}

65+66+

function restoreMemoryIndexStateDir(): void {

67+

if (originalMemoryIndexStateDir === undefined) {

68+

Reflect.deleteProperty(process.env, "OPENCLAW_STATE_DIR");

69+

} else {

70+

Reflect.set(process.env, "OPENCLAW_STATE_DIR", originalMemoryIndexStateDir);

71+

}

72+

}

73+6174

vi.mock("./embeddings.js", () => {

6275

const embedText = (text: string) => {

6376

const lower = text.toLowerCase();

@@ -276,7 +289,7 @@ describe("memory index", () => {

276289

closeOpenClawStateDatabaseForTest();

277290

clearRegistry();

278291

managersForCleanup.clear();

279-

vi.unstubAllEnvs();

292+

restoreMemoryIndexStateDir();

280293

});

281294282295

beforeEach(async () => {

@@ -298,7 +311,7 @@ describe("memory index", () => {

298311299312

rmSync(workspaceDir, { recursive: true, force: true });

300313

mkdirSync(memoryDir, { recursive: true });

301-

vi.stubEnv("OPENCLAW_STATE_DIR", path.join(workspaceDir, ".state-memory-index"));

314+

setMemoryIndexStateDir(path.join(workspaceDir, ".state-memory-index"));

302315

await fs.writeFile(

303316

path.join(memoryDir, "2026-01-12.md"),

304317

"# Log\nAlpha memory line.\nZebra memory line.",

@@ -488,7 +501,7 @@ describe("memory index", () => {

488501

stateDirName: string;

489502

}): Promise<MemoryIndexManager | null> {

490503

forceNoProvider = true;

491-

vi.stubEnv("OPENCLAW_STATE_DIR", path.join(workspaceDir, params.stateDirName));

504+

setMemoryIndexStateDir(path.join(workspaceDir, params.stateDirName));

492505

const cfg = createCfg({

493506

sources: ["memory", "sessions"],

494507

sessionMemory: true,

@@ -573,7 +586,7 @@ describe("memory index", () => {

573586574587

it("reindexes memory tables in place without deleting unrelated agent rows", async () => {

575588

const stateDir = path.join(workspaceDir, "managed-memory-state");

576-

vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);

589+

setMemoryIndexStateDir(stateDir);

577590

const agentDbPath = resolveOpenClawAgentSqlitePath({ agentId: "main" });

578591

const agentDb = openOpenClawAgentDatabase({ agentId: "main" });

579592

agentDb.db

@@ -1117,7 +1130,7 @@ describe("memory index", () => {

1117113011181131

it("clears dirty after sessions-only identity reindex", async () => {

11191132

try {

1120-

vi.stubEnv("OPENCLAW_STATE_DIR", path.join(workspaceDir, ".state-sessions-only-reindex"));

1133+

setMemoryIndexStateDir(path.join(workspaceDir, ".state-sessions-only-reindex"));

11211134

const sessionsDir = resolveSessionTranscriptsDirForAgent("main");

11221135

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

11231136

await fs.writeFile(

@@ -1167,13 +1180,13 @@ describe("memory index", () => {

11671180

await nextManager.close?.();

11681181

}

11691182

} finally {

1170-

vi.unstubAllEnvs();

1183+

restoreMemoryIndexStateDir();

11711184

}

11721185

});

1173118611741187

it("marks sessions-only indexes dirty when metadata is missing but chunks exist", async () => {

11751188

try {

1176-

vi.stubEnv("OPENCLAW_STATE_DIR", path.join(workspaceDir, ".state-sessions-missing-meta"));

1189+

setMemoryIndexStateDir(path.join(workspaceDir, ".state-sessions-missing-meta"));

11771190

const sessionsDir = resolveSessionTranscriptsDirForAgent("main");

11781191

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

11791192

await fs.writeFile(

@@ -1223,13 +1236,13 @@ describe("memory index", () => {

12231236

await nextManager.close?.();

12241237

}

12251238

} finally {

1226-

vi.unstubAllEnvs();

1239+

restoreMemoryIndexStateDir();

12271240

}

12281241

});

1229124212301243

it("keeps provider cutover vector search paused during targeted session sync", async () => {

12311244

try {

1232-

vi.stubEnv("OPENCLAW_STATE_DIR", path.join(workspaceDir, ".state-targeted-cutover"));

1245+

setMemoryIndexStateDir(path.join(workspaceDir, ".state-targeted-cutover"));

12331246

const sessionsDir = resolveSessionTranscriptsDirForAgent("main");

12341247

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

12351248

const sessionFile = path.join(sessionsDir, "session-targeted-cutover.jsonl");

@@ -1287,13 +1300,13 @@ describe("memory index", () => {

12871300

await nextManager.close?.();

12881301

}

12891302

} finally {

1290-

vi.unstubAllEnvs();

1303+

restoreMemoryIndexStateDir();

12911304

}

12921305

});

1293130612941307

it("preserves memory dirty events raised during session identity reindex", async () => {

12951308

try {

1296-

vi.stubEnv("OPENCLAW_STATE_DIR", path.join(workspaceDir, ".state-dirty-during-session"));

1309+

setMemoryIndexStateDir(path.join(workspaceDir, ".state-dirty-during-session"));

12971310

const sessionsDir = resolveSessionTranscriptsDirForAgent("main");

12981311

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

12991312

await fs.writeFile(

@@ -1351,7 +1364,7 @@ describe("memory index", () => {

13511364

await nextManager.close?.();

13521365

}

13531366

} finally {

1354-

vi.unstubAllEnvs();

1367+

restoreMemoryIndexStateDir();

13551368

}

13561369

});

13571370

@@ -2230,7 +2243,7 @@ describe("memory index", () => {

22302243

expect(results[0]?.source).toBe("sessions");

22312244

expect(results[0]?.snippet).toContain("ORBIT-10");

22322245

} finally {

2233-

vi.unstubAllEnvs();

2246+

restoreMemoryIndexStateDir();

22342247

}

22352248

});

22362249

@@ -2274,7 +2287,7 @@ describe("memory index", () => {

22742287

expect(results[0]?.source).toBe("sessions");

22752288

expect(results[0]?.snippet).toContain("ORBIT-10");

22762289

} finally {

2277-

vi.unstubAllEnvs();

2290+

restoreMemoryIndexStateDir();

22782291

}

22792292

});

22802293

});