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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
腾讯CDC
Y
Y Combinator Blog
L
LangChain Blog
B
Blog
U
Unit 42
P
Proofpoint News Feed
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
WordPress大学
WordPress大学
月光博客
月光博客
Vercel News
Vercel News
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗

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(memory): preserve schema helper compatibility · openc...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

@@ -107,7 +107,10 @@ function migrateCanonicalMemoryIndexSourcesPrimaryKey(db: DatabaseSync): void {

107107

}

108108

}

109109110-

function migrateLegacyMemoryIndexTables(db: DatabaseSync): void {

110+

function migrateLegacyMemoryIndexTables(

111+

db: DatabaseSync,

112+

preservedEmbeddingCacheTable?: string,

113+

): void {

111114

const hasLegacyCoreTables =

112115

tableHasExactColumns(db, "meta", ["key", "value"]) &&

113116

tableHasExactColumns(db, "files", ["path", "source", "hash", "mtime", "size"]) &&

@@ -186,6 +189,7 @@ function migrateLegacyMemoryIndexTables(db: DatabaseSync): void {

186189

"chunks",

187190

);

188191

if (

192+

preservedEmbeddingCacheTable !== "embedding_cache" &&

189193

tableHasExactColumns(db, "embedding_cache", [

190194

"provider",

191195

"model",

@@ -253,10 +257,16 @@ function migrateLegacyMemoryIndexTables(db: DatabaseSync): void {

253257

/** Ensure canonical memory index tables and the optional FTS table exist. */

254258

export function ensureMemoryIndexSchema(params: {

255259

db: DatabaseSync;

260+

/** @deprecated Omit to use the canonical memory cache table. */

261+

embeddingCacheTable?: string;

256262

cacheEnabled: boolean;

263+

/** @deprecated Omit to use the canonical memory FTS table. */

264+

ftsTable?: string;

257265

ftsEnabled: boolean;

258266

ftsTokenizer?: "unicode61" | "trigram";

259267

}): { ftsAvailable: boolean; ftsError?: string } {

268+

const embeddingCacheTable = params.embeddingCacheTable ?? MEMORY_EMBEDDING_CACHE_TABLE;

269+

const ftsTable = params.ftsTable ?? MEMORY_INDEX_FTS_TABLE;

260270

params.db.exec(`

261271

CREATE TABLE IF NOT EXISTS ${MEMORY_INDEX_META_TABLE} (

262272

key TEXT PRIMARY KEY,

@@ -332,10 +342,14 @@ export function ensureMemoryIndexSchema(params: {

332342

CREATE INDEX IF NOT EXISTS idx_memory_index_chunks_source

333343

ON ${MEMORY_INDEX_CHUNKS_TABLE}(source);

334344

`);

335-

migrateLegacyMemoryIndexTables(params.db);

345+

migrateLegacyMemoryIndexTables(params.db, params.embeddingCacheTable);

336346

if (params.cacheEnabled) {

347+

const updatedAtIndex =

348+

embeddingCacheTable === MEMORY_EMBEDDING_CACHE_TABLE

349+

? "idx_memory_embedding_cache_updated_at"

350+

: "idx_embedding_cache_updated_at";

337351

params.db.exec(`

338-

CREATE TABLE IF NOT EXISTS ${MEMORY_EMBEDDING_CACHE_TABLE} (

352+

CREATE TABLE IF NOT EXISTS ${embeddingCacheTable} (

339353

provider TEXT NOT NULL,

340354

model TEXT NOT NULL,

341355

provider_key TEXT NOT NULL,

@@ -345,8 +359,8 @@ export function ensureMemoryIndexSchema(params: {

345359

updated_at INTEGER NOT NULL,

346360

PRIMARY KEY (provider, model, provider_key, hash)

347361

);

348-

CREATE INDEX IF NOT EXISTS idx_memory_embedding_cache_updated_at

349-

ON ${MEMORY_EMBEDDING_CACHE_TABLE}(updated_at);

362+

CREATE INDEX IF NOT EXISTS ${updatedAtIndex}

363+

ON ${embeddingCacheTable}(updated_at);

350364

`);

351365

}

352366

@@ -357,7 +371,7 @@ export function ensureMemoryIndexSchema(params: {

357371

const tokenizer = params.ftsTokenizer ?? "unicode61";

358372

const tokenizeClause = tokenizer === "trigram" ? `, tokenize='trigram case_sensitive 0'` : "";

359373

params.db.exec(

360-

`CREATE VIRTUAL TABLE IF NOT EXISTS ${MEMORY_INDEX_FTS_TABLE} USING fts5(\n` +

374+

`CREATE VIRTUAL TABLE IF NOT EXISTS ${ftsTable} USING fts5(\n` +

361375

` text,\n` +

362376

` id UNINDEXED,\n` +

363377

` path UNINDEXED,\n` +

@@ -370,12 +384,12 @@ export function ensureMemoryIndexSchema(params: {

370384

// The shipped generic-table migration and a later FTS enablement both

371385

// create an empty derived table beside already-canonical chunk rows.

372386

params.db.exec(`

373-

INSERT INTO ${MEMORY_INDEX_FTS_TABLE} (

387+

INSERT INTO ${ftsTable} (

374388

text, id, path, source, model, start_line, end_line

375389

)

376390

SELECT text, id, path, source, model, start_line, end_line

377391

FROM ${MEMORY_INDEX_CHUNKS_TABLE}

378-

WHERE NOT EXISTS (SELECT 1 FROM ${MEMORY_INDEX_FTS_TABLE} LIMIT 1);

392+

WHERE NOT EXISTS (SELECT 1 FROM ${ftsTable} LIMIT 1);

379393

`);

380394

ftsAvailable = true;

381395

} catch (err) {