Skip to content

Commit 414c250

Browse files
fix #95495: [Bug]: 2026.6.9 silently relocates memory store with no migration, forcing a full re-embed (1499 files) with zero upgrade-time warning (#95631)
* fix(memory): import legacy sidecar indexes into agent db * fix(memory): move legacy sidecar import to doctor migration * fix(memory): restore sidecar vector rows during doctor migration * fix(memory): keep legacy sidecar when skipping import * fix(memory): keep legacy sidecar import within extension boundary * fix(memory-core): keep legacy sidecar migration retry-safe * fix(memory-core): backfill sidecar FTS rows * fix(memory-core): preserve sidecar when vector import defers * fix(memory-core): cover custom sidecar migrations * fix(memory-core): keep legacy config migration under doctor * fix(memory-core): reject sidecar metadata conflicts * fix(memory-core): keep partial legacy config sidecars * fix(memory-core): preserve partial config retries * fix(memory-core): keep partial config task migrations * fix(memory-core): avoid phantom sidecar agents * fix(memory-core): reject incomplete sidecar indexes * fix(memory-core): keep malformed sidecars retryable * fix(doctor): use canonical state dir for plugin migrations * fix(memory-core): honor disabled vector sidecar migration * fix(memory-core): treat provider-none sidecars as fts-only * fix(memory-core): preserve setup-failed sidecars * test(memory-core): use non-mutating sort assertions * test(memory-core): compare sorted chunk ids * test(memory-core): compare sorted chunk ids * test(memory-core): stringify sorted chunk ids * fix(qa): skip chromium bootstrap for explicit browser channels * fix(qa): skip chromium bootstrap for explicit browser channels --------- Co-authored-by: Vincent Koc <[email protected]>
1 parent f65aca6 commit 414c250

15 files changed

Lines changed: 3088 additions & 148 deletions

‎extensions/memory-core/doctor-contract-api.test.ts‎

Lines changed: 1209 additions & 0 deletions
Large diffs are not rendered by default.

‎extensions/memory-core/doctor-contract-api.ts‎

Lines changed: 1003 additions & 0 deletions
Large diffs are not rendered by default.

‎extensions/qa-lab/src/web-runtime.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ describe("qa web runtime", () => {
190190
await qaWebOpenPage({ url: "http://127.0.0.1:3000/chat", channel: "chrome" });
191191

192192
const launchOptions = requireLaunchOptions();
193+
expect(spawnSync).not.toHaveBeenCalled();
193194
expect(launchOptions?.channel).toBe("chrome");
194195
expect(launchOptions?.executablePath).toBeUndefined();
195196
await closeQaWebSessions();

‎extensions/qa-lab/src/web-runtime.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ function buildChromiumLaunchOptions(params: QaWebOpenPageParams) {
141141

142142
export async function qaWebOpenPage(params: QaWebOpenPageParams) {
143143
const timeoutMs = resolveTimeoutMs(params.timeoutMs);
144-
ensureChromiumAvailable(params.repoRoot ?? process.cwd());
144+
if (!params.channel) {
145+
ensureChromiumAvailable(params.repoRoot ?? process.cwd());
146+
}
145147
const browser = await chromium.launch(buildChromiumLaunchOptions(params));
146148
const context = await browser.newContext({
147149
ignoreHTTPSErrors: true,

‎packages/memory-host-sdk/src/host/memory-schema.test.ts‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// Memory schema tests cover canonical table creation and shipped-name migration.
2+
import fs from "node:fs";
3+
import os from "node:os";
4+
import path from "node:path";
25
import { DatabaseSync } from "node:sqlite";
36
import { describe, expect, it } from "vitest";
47
import { ensureMemoryIndexSchema } from "./memory-schema.js";
@@ -87,6 +90,79 @@ describe("memory index schema", () => {
8790
}
8891
});
8992

93+
it("does not import a legacy sidecar memory database during schema startup", () => {
94+
const rootDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-memory-sidecar-"));
95+
const legacyPath = path.join(rootDir, "memory", "main.sqlite");
96+
const agentPath = path.join(rootDir, "agents", "main", "agent", "openclaw-agent.sqlite");
97+
fs.mkdirSync(path.dirname(legacyPath), { recursive: true });
98+
fs.mkdirSync(path.dirname(agentPath), { recursive: true });
99+
const legacyDb = new DatabaseSync(legacyPath);
100+
try {
101+
legacyDb.exec(`
102+
CREATE TABLE meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);
103+
CREATE TABLE files (
104+
path TEXT PRIMARY KEY,
105+
source TEXT NOT NULL DEFAULT 'memory',
106+
hash TEXT NOT NULL,
107+
mtime INTEGER NOT NULL,
108+
size INTEGER NOT NULL
109+
);
110+
CREATE TABLE chunks (
111+
id TEXT PRIMARY KEY,
112+
path TEXT NOT NULL,
113+
source TEXT NOT NULL DEFAULT 'memory',
114+
start_line INTEGER NOT NULL,
115+
end_line INTEGER NOT NULL,
116+
hash TEXT NOT NULL,
117+
model TEXT NOT NULL,
118+
text TEXT NOT NULL,
119+
embedding TEXT NOT NULL,
120+
updated_at INTEGER NOT NULL
121+
);
122+
CREATE TABLE embedding_cache (
123+
provider TEXT NOT NULL,
124+
model TEXT NOT NULL,
125+
provider_key TEXT NOT NULL,
126+
hash TEXT NOT NULL,
127+
embedding TEXT NOT NULL,
128+
dims INTEGER,
129+
updated_at INTEGER NOT NULL,
130+
PRIMARY KEY (provider, model, provider_key, hash)
131+
);
132+
INSERT INTO meta VALUES ('memory_index_meta_v1', '{"vectorDims":3}');
133+
INSERT INTO files VALUES ('MEMORY.md', 'memory', 'file-hash', 10, 20);
134+
INSERT INTO chunks VALUES (
135+
'chunk-1', 'MEMORY.md', 'memory', 1, 2, 'chunk-hash', 'embed-model',
136+
'remember this', '[1,0,0]', 30
137+
);
138+
INSERT INTO embedding_cache VALUES (
139+
'openai', 'embed-model', 'key', 'chunk-hash', '[1,0,0]', 3, 40
140+
);
141+
`);
142+
} finally {
143+
legacyDb.close();
144+
}
145+
146+
const db = new DatabaseSync(agentPath);
147+
try {
148+
const result = ensureMemoryIndexSchema({
149+
db,
150+
cacheEnabled: true,
151+
ftsEnabled: true,
152+
});
153+
154+
expect(result.ftsAvailable).toBe(true);
155+
expect(db.prepare("SELECT * FROM memory_index_sources").all()).toEqual([]);
156+
expect(db.prepare("SELECT id, text FROM memory_index_chunks").all()).toEqual([]);
157+
expect(db.prepare("SELECT id, text FROM memory_index_chunks_fts").all()).toEqual([]);
158+
expect(db.prepare("SELECT provider, hash FROM memory_embedding_cache").all()).toEqual([]);
159+
expect(fs.existsSync(legacyPath)).toBe(true);
160+
} finally {
161+
db.close();
162+
fs.rmSync(rootDir, { recursive: true, force: true });
163+
}
164+
});
165+
90166
it("stores source records with the same path in separate sources", () => {
91167
const db = new DatabaseSync(":memory:");
92168
try {

0 commit comments

Comments
 (0)