fix: keep third party provider filters on registry path

This commit is contained in:
Shakker
2026-04-24 05:01:07 +01:00
committed by Shakker
parent 6f04eee2a1
commit 9941393c7a
2 changed files with 33 additions and 3 deletions

View File

@@ -187,6 +187,23 @@ describe("loadProviderCatalogModelsForList", () => {
);
});
it("does not skip registry for non-bundled static catalog owners", async () => {
providerDiscoveryMocks.resolveOwningPluginIdsForProvider.mockReturnValueOnce([
"workspace-static-provider",
]);
providerDiscoveryMocks.resolveBundledProviderCompatPluginIds.mockReturnValueOnce(["moonshot"]);
await expect(
hasProviderStaticCatalogForFilter({
cfg: baseParams.cfg,
env: baseParams.env,
providerFilter: "workspace-static-provider",
}),
).resolves.toBe(false);
expect(providerDiscoveryMocks.resolvePluginDiscoveryProviders).not.toHaveBeenCalled();
});
it("recognizes bundled provider hook aliases before the unknown-provider short-circuit", async () => {
await expect(
resolveProviderCatalogPluginIdsForFilter({

View File

@@ -62,18 +62,31 @@ export async function hasProviderStaticCatalogForFilter(params: {
env?: NodeJS.ProcessEnv;
providerFilter: string;
}): Promise<boolean> {
const env = params.env ?? process.env;
const providerFilter = normalizeProviderId(params.providerFilter);
if (!providerFilter) {
return false;
}
const pluginIds = await resolveProviderCatalogPluginIdsForFilter(params);
const pluginIds = await resolveProviderCatalogPluginIdsForFilter({
...params,
env,
});
if (!pluginIds || pluginIds.length === 0) {
return false;
}
const bundledPluginIds = resolveBundledProviderCompatPluginIds({
config: params.cfg,
env,
});
const bundledPluginIdSet = new Set(bundledPluginIds);
const scopedPluginIds = pluginIds.filter((pluginId) => bundledPluginIdSet.has(pluginId));
if (scopedPluginIds.length === 0) {
return false;
}
const providers = await resolvePluginDiscoveryProviders({
config: params.cfg,
env: params.env,
onlyPluginIds: pluginIds,
env,
onlyPluginIds: scopedPluginIds,
includeUntrustedWorkspacePlugins: false,
requireCompleteDiscoveryEntryCoverage: true,
discoveryEntriesOnly: true,