fix(memory): preserve atomic reindex cleanup cause · openclaw/openclaw@483075d
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
File tree
extensions/memory-core/src/memory
| Original file line number | Diff line number | Diff line change |
|---|
@@ -139,10 +139,12 @@ export async function runMemoryAtomicReindex<T>(params: {
|
139 | 139 | await params.beforeTempCleanup?.(); |
140 | 140 | await removeMemoryIndexFiles(params.tempPath, params.fileOptions); |
141 | 141 | } catch (cleanupErr) { |
142 | | -throw new AggregateError( |
| 142 | +const aggregateErr = new AggregateError( |
143 | 143 | [err, cleanupErr], |
144 | 144 | "memory atomic reindex failed and temp cleanup failed", |
| 145 | +{ cause: cleanupErr }, |
145 | 146 | ); |
| 147 | +throw aggregateErr; |
146 | 148 | } |
147 | 149 | throw err; |
148 | 150 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -142,8 +142,8 @@ describe("memory manager atomic reindex", () => {
|
142 | 142 | "retries transient %s rm failures during index file cleanup", |
143 | 143 | async (code) => { |
144 | 144 | const calls: string[] = []; |
145 | | -const rm = vi.fn(async (filePath: string) => { |
146 | | -calls.push(filePath); |
| 145 | +const rm: typeof fs.rm = vi.fn(async (filePath) => { |
| 146 | +calls.push(String(filePath)); |
147 | 147 | if (calls.length === 1) { |
148 | 148 | throw Object.assign(new Error("busy"), { code }); |
149 | 149 | } |
@@ -204,8 +204,8 @@ describe("memory manager atomic reindex", () => {
|
204 | 204 | it("closes temp resources before removing temp files after build failure", async () => { |
205 | 205 | const events: string[] = []; |
206 | 206 | let tempClosed = false; |
207 | | -const rm = vi.fn(async (filePath: string) => { |
208 | | -events.push(tempClosed ? `rm:${filePath}:closed` : `rm:${filePath}:open`); |
| 207 | +const rm: typeof fs.rm = vi.fn(async (filePath) => { |
| 208 | +events.push(tempClosed ? `rm:${String(filePath)}:closed` : `rm:${String(filePath)}:open`); |
209 | 209 | }); |
210 | 210 | |
211 | 211 | await expect( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。