From 4d528a51d3dbeb5c510ebb45220ae2e06034c857 Mon Sep 17 00:00:00 2001 From: jubnl Date: Tue, 22 Sep 2026 14:24:34 +0200 Subject: [PATCH] fix(platform): well-known gate tolerates a synchronous addon read from the context helper --- server/src/nest/platform/mcp-metadata.middleware.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/nest/platform/mcp-metadata.middleware.ts b/server/src/nest/platform/mcp-metadata.middleware.ts index ccc40958d..a31c51ae3 100644 --- a/server/src/nest/platform/mcp-metadata.middleware.ts +++ b/server/src/nest/platform/mcp-metadata.middleware.ts @@ -50,7 +50,9 @@ export function createMcpMetadataMiddleware( // before Nest's per-request EntityManager fork (a pathless pre-init // app.use), and wrapping the router delegation too would fork an unused // EntityManager for every request the server answers. - void withRequestContext(orm, () => addons.isAddonEnabled(ADDON_IDS.MCP)) + // Promise.resolve: the helper returns whatever the callback returns, and a + // test double may answer the addon read synchronously. + void Promise.resolve(withRequestContext(orm, () => addons.isAddonEnabled(ADDON_IDS.MCP))) .then((enabled) => { if (!enabled) { res.status(404).end();