Skip to content

Commit 4a373e0

Browse files
committed
fix(scripts): backfill-embeddings opened the dead pre-v0.16 database path
The script hardcoded the legacy per-harness location, which still holds a stale May-era copy on migrated installs. The --shadow run registered identities and crashed on the ancient schema (missing embedding_identity_active) after silently targeting the wrong data. Resolve through getDataDir() like the plugin itself.
1 parent c4633b7 commit 4a373e0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/plugin/scripts/backfill-embeddings.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* it drives the same bounded enqueue path the plugin runs, but to
1616
* completion with progress output.
1717
*/
18+
import { getMagicContextStorageDir } from '../src/shared/data-path';
1819
import { Database } from "../src/shared/sqlite";
1920
import { loadPluginConfig, loadPluginConfigDetailed } from "../src/config";
2021
import {
@@ -30,7 +31,11 @@ import { saveEmbedding } from "../src/features/magic-context/memory/storage-memo
3031
import { isConfigLoadUntrusted } from "../src/plugin/embedding-bootstrap-helpers";
3132
import { resolveEmbeddingRouting } from "../src/plugin/embedding-routing";
3233

33-
const DB_PATH = `${process.env.HOME}/.local/share/opencode/storage/plugin/magic-context/context.db`;
34+
// Shared CortexKit database (OpenCode + Pi). The pre-v0.16 per-harness path
35+
// (~/.local/share/opencode/storage/plugin/magic-context/) is a dead fossil on
36+
// migrated installs — opening it silently operates on stale data with an
37+
// ancient schema, so resolve through the same helper the plugin uses.
38+
const DB_PATH = `${getMagicContextStorageDir()}/context.db`;
3439
function getArg(name: string): string | null {
3540
const index = process.argv.indexOf(name);
3641
return index >= 0 ? (process.argv[index + 1] ?? null) : null;

0 commit comments

Comments
 (0)