honor when clause for chatSession contibution in agent sessions filter (#294283)

This commit is contained in:
Josh Spicer
2026-02-10 20:09:54 -06:00
committed by GitHub
parent 9df63296ba
commit 720ab15773
2 changed files with 13 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ import { registerAction2, Action2, MenuId } from '../../../../../platform/action
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js';
import { IChatSessionsService } from '../../common/chatSessionsService.js';
import { AgentSessionProviders, getAgentSessionProviderName } from './agentSessions.js';
import { AgentSessionProviders, getAgentSessionProvider, getAgentSessionProviderName } from './agentSessions.js';
import { AgentSessionStatus, IAgentSession } from './agentSessionsModel.js';
import { IAgentSessionsFilter, IAgentSessionsFilterExcludes } from './agentSessionsViewer.js';
@@ -127,17 +127,21 @@ export class AgentSessionsFilter extends Disposable implements Required<IAgentSe
}
private registerProviderActions(disposables: DisposableStore, menuId: MenuId): void {
const providers: { id: string; label: string }[] = Object.values(AgentSessionProviders).map(provider => ({
id: provider,
label: getAgentSessionProviderName(provider)
}));
const providers: { id: string; label: string }[] = [{
id: AgentSessionProviders.Local,
label: getAgentSessionProviderName(AgentSessionProviders.Local)
}];
for (const provider of this.chatSessionsService.getAllChatSessionContributions()) {
if (providers.find(p => p.id === provider.type)) {
for (const contribution of this.chatSessionsService.getAllChatSessionContributions()) {
if (providers.find(p => p.id === contribution.type)) {
continue; // already added
}
providers.push({ id: provider.type, label: provider.name });
const knownProvider = getAgentSessionProvider(contribution.type);
providers.push({
id: contribution.type,
label: knownProvider ? getAgentSessionProviderName(knownProvider) : contribution.displayName
});
}
const that = this;

View File

@@ -333,7 +333,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
const builtinSessionProviders = [AgentSessionProviders.Local];
const contributedSessionProviders = observableFromEvent(
this.onDidChangeAvailability,
() => Array.from(this._contributions.keys()).filter(isAgentSessionProviderType) as AgentSessionProviders[],
() => Array.from(this._contributions.keys()).filter(key => this._contributionDisposables.has(key) && isAgentSessionProviderType(key)) as AgentSessionProviders[],
).recomputeInitiallyAndOnChange(this._store);
this._register(autorun(reader => {
@@ -371,8 +371,6 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
displayName = localize('chat.session.inProgress.background', "Background Agent");
} else if (chatSessionType === AgentSessionProviders.Cloud) {
displayName = localize('chat.session.inProgress.cloud', "Cloud Agent");
} else if (chatSessionType === AgentSessionProviders.Growth) {
displayName = localize('chat.session.inProgress.growth', "Growth");
} else {
displayName = this._contributions.get(chatSessionType)?.contribution.displayName;
}