π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(connector): run legacy MCP guard before the manifest check (#16180)
LiJian262805786eca
diff --git a/apps/server/src/routers/lambda/__tests__/connector.syncPluginTools.test.ts b/apps/server/src/routers/lambda/__tests__/connector.syncPluginTools.test.tsindex 7def90fa488..d70ecb9aa54 100644--- a/apps/server/src/routers/lambda/__tests__/connector.syncPluginTools.test.ts+++ b/apps/server/src/routers/lambda/__tests__/connector.syncPluginTools.test.ts@@ -126,6 +126,38 @@ describe('connectorRouter.syncPluginTools β customPlugin guard', () => {code: 'NOT_FOUND',});});++ it('defers (not NOT_FOUND) for customPlugin+mcp rows whose manifest is NULL', async () => {+ // This is the exact #15674 victim profile: legacy custom MCP whose+ // `tools/list` never succeeded after the v2.2.3 break, so `manifest` is+ // NULL on the row. The customPlugin migration guard MUST run before the+ // manifest check, otherwise the user gets a NOT_FOUND, the SkillDetail+ // fallback never renders, and the migration modal never surfaces.+ pluginModelMock.findById.mockResolvedValueOnce({+ type: 'customPlugin',+ manifest: null,+ customParams: { mcp: { type: 'http', url: 'http://10.9.16.224:9100/mcp' } },+ });++ const result = await callerFor().syncPluginTools({ identifier: 'dockpit' });++ expect(result).toEqual({ connectorId: null, toolCount: 0 });+ expect(connectorModelMock.create).not.toHaveBeenCalled();+ });++ it('still throws NOT_FOUND for non-customPlugin rows with no manifest', async () => {+ // Marketplace rows are expected to always carry a manifest. If a plugin+ // row exists but its manifest is missing AND it isn't a customPlugin with+ // an MCP blob to migrate, we can't bootstrap a connector from it β the+ // NOT_FOUND signal stays as it was for that genuinely broken case.+ pluginModelMock.findById.mockResolvedValueOnce({+ type: 'plugin',+ manifest: null,+ });+ await expect(+ callerFor().syncPluginTools({ identifier: 'broken-marketplace' }),+ ).rejects.toMatchObject({ code: 'NOT_FOUND' });+ });});describe('connectorRouter.create β sourceType handling on existing rows', () => {diff --git a/apps/server/src/routers/lambda/connector.ts b/apps/server/src/routers/lambda/connector.tsindex 702da0a9cc1..8c3d47787b6 100644--- a/apps/server/src/routers/lambda/connector.ts+++ b/apps/server/src/routers/lambda/connector.ts@@ -496,21 +496,33 @@ export const connectorRouter = router({.mutation(async ({ input, ctx }) => {const plugin = await ctx.pluginModel.findById(input.identifier);- if (!plugin || !plugin.manifest) {+ if (!plugin) {throw new TRPCError({code: 'NOT_FOUND',- message: `Plugin '${input.identifier}' not found or has no manifest`,+ message: `Plugin '${input.identifier}' not found`,});}+ // The customPlugin migration guard MUST run before the manifest check.+ // The users hit by #15674 are the ones whose legacy custom MCP never+ // successfully reported a `tools/list` after the v2.2.3 break, so their+ // `user_installed_plugins.manifest` is NULL / empty. If we threw+ // NOT_FOUND here the SkillDetail fallback would never render and the+ // migration modal would never surface β exactly the users we are+ // trying to rescue. Hand off to the frontend migration flow first;+ // returning null tells the caller "no connector row produced" and the+ // "Configure" button opens CustomConnectorModal in migration mode.if (plugin.type === 'customPlugin' && plugin.customParams?.mcp) {- // Hand off to the frontend migration flow. Returning null tells the- // caller "no connector row produced"; the SkillDetail panel falls back- // to the legacy plugin display, and the "Configure" button surfaces- // CustomConnectorModal in migration mode.return { connectorId: null, toolCount: 0 };}+ if (!plugin.manifest) {+ throw new TRPCError({+ code: 'NOT_FOUND',+ message: `Plugin '${input.identifier}' has no manifest`,+ });+ }+const connectorId = await upsertConnectorEntry(ctx.connectorModel, {avatar: plugin.manifest.meta?.avatar,description: plugin.manifest.meta?.description,