From 50c74241ecb23cf31b9289f1f1aec3f1baf58ff0 Mon Sep 17 00:00:00 2001 From: Tehan Date: Fri, 28 Aug 2026 19:20:08 +0200 Subject: [PATCH] fix(rust): thread subc.connection_file to the transform transport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `subc.connection_file` is parsed and schema-validated, and gates whether `transform_mode: "rust"` may activate — but its value never reached the transform-lane transport. Both construction sites called `new SubcModuleTransport()` with no argument, so the constructor's `connectionFile ?? getDefaultConnectionFile()` fallback always won and the transport looked at `/cortexkit/run/subc-connection.json` regardless of configuration. On a host whose daemon publishes elsewhere (e.g. a systemd RuntimeDirectory at /run/user//), rust mode therefore could not connect, and the one setting that would fix it was inert: ENOENT: no such file or directory, statx '/cortexkit/run/subc-connection.json' rust transform failed; attempting LKG replay lkg_miss rust pass: decision=error served_from=raw module=0.0 ms `module=0.0 ms` shows the module is never invoked, so the daemon reports the module perfectly healthy throughout while every pass degrades to raw and materializes nothing — an empty sidebar rather than a config error. The same key is already threaded correctly on the embedding lane (embedding-routing.ts:87), so one config value could reach the Synapse socket while the transform lane looked somewhere else. Adds `subc?: { connection_file: string }` to the session-hook deps config type so the recovery-arm site can thread it too. Defaults are unchanged when the key is absent. --- packages/plugin/src/hooks/magic-context/hook.ts | 6 +++++- packages/plugin/src/index.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/plugin/src/hooks/magic-context/hook.ts b/packages/plugin/src/hooks/magic-context/hook.ts index 43bb20a00..228248548 100644 --- a/packages/plugin/src/hooks/magic-context/hook.ts +++ b/packages/plugin/src/hooks/magic-context/hook.ts @@ -178,6 +178,10 @@ export interface MagicContextDeps { min_chars: number; }; transform_mode?: ResolvedTransformMode; + /** Path to the subc daemon's connection file. Threaded to the module + * transport so a host that publishes it outside the default data-dir + * location (e.g. a systemd RuntimeDirectory) is actually reachable. */ + subc?: { connection_file: string }; /** Compaction-off mode gate (issue #266). Resolved ONCE here at the * session-hook construction boundary via isCompactionEnabled; the * resolved boolean is threaded to the transform phases. */ @@ -774,7 +778,7 @@ export function createMagicContextHook(deps: MagicContextDeps) { const authorityRecoveryModuleClient = deps.rustModeModuleClient ?? (() => { - const transport = new SubcModuleTransport(); + const transport = new SubcModuleTransport(deps.config.subc?.connection_file); const client: RustModeModuleClient = { call: (args) => transport.call(args), stateSyncCapabilities: (args) => transport.stateSyncCapabilities(args), diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index d8e10e1b5..eb1e76712 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -203,7 +203,9 @@ const server: Plugin = async (ctx) => { const liveSessionState = createLiveSessionState(); const rustModeModuleClient: RustModeModuleClient | undefined = - pluginConfig.transform_mode === "rust" ? new SubcModuleTransport() : undefined; + pluginConfig.transform_mode === "rust" + ? new SubcModuleTransport(pluginConfig.subc?.connection_file) + : undefined; const hooks = await createSessionHooksAsync({ ctx,