File tree Expand file tree Collapse file tree
packages/plugin/src/plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 isDatabasePersisted ,
99 openDatabase ,
1010} from "../features/magic-context/storage" ;
11+ import { getErrorMessage } from '../shared/error-message' ;
12+ import { log } from '../shared/logger' ;
1113import type { Database } from "../shared/sqlite" ;
1214import { createCtxExpandTools } from "../tools/ctx-expand" ;
1315import { CTX_MEMORY_ACTIONS , createCtxMemoryTools } from "../tools/ctx-memory" ;
@@ -58,7 +60,12 @@ export function createToolRegistry(args: {
5860 return { } ;
5961 }
6062
61- void ensureProjectRegisteredFromOpenCodeDirectory ( ctx . directory , db ) ;
63+ // Fire-and-forget: registration failure (including a database handle that
64+ // closed during process teardown) must never surface as an unhandled
65+ // rejection from plugin init. The next boot or embed path re-registers.
66+ void ensureProjectRegisteredFromOpenCodeDirectory ( ctx . directory , db ) . catch ( ( error ) => {
67+ log ( `[magic-context] embedding registration skipped: ${ getErrorMessage ( error ) } ` ) ;
68+ } ) ;
6269
6370 // Tools resolve project per-call from `toolContext.directory` because
6471 // OpenCode's top-level `ctx.directory` reflects the launch dir, not the
You can’t perform that action at this time.
0 commit comments