Skip to content

Commit bf23ba9

Browse files
Disable cleanup contribution
Fixes #272359 This contribution is causing servers that are allowed to be marked as not allowed because the servers are not available at startup. We shouldn't rely on servers being available at startup... This needs to be re-done to clean up correctly, but for now let's just disable it. This means that approvals will accumulate but in practice this won't be many.
1 parent 94e230b commit bf23ba9

File tree

1 file changed

+40
-45
lines changed

1 file changed

+40
-45
lines changed

src/vs/workbench/contrib/authentication/browser/authentication.contribution.ts

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import { ManageAccountPreferencesForMcpServerAction } from './actions/manageAcco
2121
import { ManageTrustedMcpServersForAccountAction } from './actions/manageTrustedMcpServersForAccountAction.js';
2222
import { RemoveDynamicAuthenticationProvidersAction } from './actions/manageDynamicAuthenticationProvidersAction.js';
2323
import { ManageAccountsAction } from './actions/manageAccountsAction.js';
24-
import { IAuthenticationQueryService } from '../../../services/authentication/common/authenticationQuery.js';
25-
import { IMcpRegistry } from '../../mcp/common/mcpRegistryTypes.js';
26-
import { autorun } from '../../../../base/common/observable.js';
27-
import { IAuthenticationService } from '../../../services/authentication/common/authentication.js';
28-
import { Event } from '../../../../base/common/event.js';
2924

3025
const codeExchangeProxyCommand = CommandsRegistry.registerCommand('workbench.getCodeExchangeProxyEndpoints', function (accessor, _) {
3126
const environmentService = accessor.get(IBrowserWorkbenchEnvironmentService);
@@ -173,49 +168,49 @@ class AuthenticationUsageContribution implements IWorkbenchContribution {
173168
// }
174169
// }
175170

176-
class AuthenticationMcpContribution extends Disposable implements IWorkbenchContribution {
177-
static ID = 'workbench.contrib.authenticationMcp';
171+
// class AuthenticationMcpContribution extends Disposable implements IWorkbenchContribution {
172+
// static ID = 'workbench.contrib.authenticationMcp';
178173

179-
constructor(
180-
@IMcpRegistry private readonly _mcpRegistry: IMcpRegistry,
181-
@IAuthenticationQueryService private readonly _authenticationQueryService: IAuthenticationQueryService,
182-
@IAuthenticationService private readonly _authenticationService: IAuthenticationService
183-
) {
184-
super();
185-
this._cleanupRemovedMcpServers();
186-
187-
// Listen for MCP collections changes using autorun with observables
188-
this._register(autorun(reader => {
189-
// Read the collections observable to register dependency
190-
this._mcpRegistry.collections.read(reader);
191-
// Schedule cleanup for next tick to avoid running during observable updates
192-
queueMicrotask(() => this._cleanupRemovedMcpServers());
193-
}));
194-
this._register(
195-
Event.any(
196-
this._authenticationService.onDidChangeDeclaredProviders,
197-
this._authenticationService.onDidRegisterAuthenticationProvider
198-
)(() => this._cleanupRemovedMcpServers())
199-
);
200-
}
174+
// constructor(
175+
// @IMcpRegistry private readonly _mcpRegistry: IMcpRegistry,
176+
// @IAuthenticationQueryService private readonly _authenticationQueryService: IAuthenticationQueryService,
177+
// @IAuthenticationService private readonly _authenticationService: IAuthenticationService
178+
// ) {
179+
// super();
180+
// this._cleanupRemovedMcpServers();
181+
182+
// // Listen for MCP collections changes using autorun with observables
183+
// this._register(autorun(reader => {
184+
// // Read the collections observable to register dependency
185+
// this._mcpRegistry.collections.read(reader);
186+
// // Schedule cleanup for next tick to avoid running during observable updates
187+
// queueMicrotask(() => this._cleanupRemovedMcpServers());
188+
// }));
189+
// this._register(
190+
// Event.any(
191+
// this._authenticationService.onDidChangeDeclaredProviders,
192+
// this._authenticationService.onDidRegisterAuthenticationProvider
193+
// )(() => this._cleanupRemovedMcpServers())
194+
// );
195+
// }
201196

202-
private _cleanupRemovedMcpServers(): void {
203-
const currentServerIds = new Set(this._mcpRegistry.collections.get().flatMap(c => c.serverDefinitions.get()).map(s => s.id));
204-
const providerIds = this._authenticationQueryService.getProviderIds();
205-
for (const providerId of providerIds) {
206-
this._authenticationQueryService.provider(providerId).forEachAccount(account => {
207-
account.mcpServers().forEach(server => {
208-
if (!currentServerIds.has(server.mcpServerId)) {
209-
server.removeUsage();
210-
server.setAccessAllowed(false);
211-
}
212-
});
213-
});
214-
}
215-
}
216-
}
197+
// private _cleanupRemovedMcpServers(): void {
198+
// const currentServerIds = new Set(this._mcpRegistry.collections.get().flatMap(c => c.serverDefinitions.get()).map(s => s.id));
199+
// const providerIds = this._authenticationQueryService.getProviderIds();
200+
// for (const providerId of providerIds) {
201+
// this._authenticationQueryService.provider(providerId).forEachAccount(account => {
202+
// account.mcpServers().forEach(server => {
203+
// if (!currentServerIds.has(server.mcpServerId)) {
204+
// server.removeUsage();
205+
// server.setAccessAllowed(false);
206+
// }
207+
// });
208+
// });
209+
// }
210+
// }
211+
// }
217212

218213
registerWorkbenchContribution2(AuthenticationContribution.ID, AuthenticationContribution, WorkbenchPhase.AfterRestored);
219214
registerWorkbenchContribution2(AuthenticationUsageContribution.ID, AuthenticationUsageContribution, WorkbenchPhase.Eventually);
220215
// registerWorkbenchContribution2(AuthenticationExtensionsContribution.ID, AuthenticationExtensionsContribution, WorkbenchPhase.Eventually);
221-
registerWorkbenchContribution2(AuthenticationMcpContribution.ID, AuthenticationMcpContribution, WorkbenchPhase.Eventually);
216+
// registerWorkbenchContribution2(AuthenticationMcpContribution.ID, AuthenticationMcpContribution, WorkbenchPhase.Eventually);

0 commit comments

Comments
 (0)