Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/vs/sessions/contrib/chat/browser/chat.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { WorktreeCreatedTaskDispatcher, AGENT_HOST_RUN_WORKTREE_CREATED_TASKS_SE
import { AGENT_SESSIONS_SCOPED_INPUT_HISTORY_SETTING } from './sessionsChatHistory.js';
import '../../sessions/browser/mobile/mobileOverlayContribution.js';
import { EditorAreaFocusContext, IsSessionsWindowContext, SideBarVisibleContext } from '../../../../workbench/common/contextkeys.js';
import { NEW_SESSION_ACTION_ID, UNIFIED_WORKSPACE_PICKER_SETTING } from '../common/constants.js';
import { NEW_SESSION_ACTION_ID } from '../common/constants.js';
import { SessionsChatBackgroundAvailableContext, SessionsChatBackgroundImageConfiguredContext, SessionsTitleBarNewSessionEnabledContext, SessionsWelcomeVisibleContext } from '../../../common/contextkeys.js';
import { Menus } from '../../../browser/menus.js';
import { ISessionsChatViewStateService, SessionsChatViewStateService } from './chatViewStateService.js';
Expand Down Expand Up @@ -389,14 +389,6 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
scope: ConfigurationScope.APPLICATION,
deprecationMessage: localize('chat.agentSessions.consolidatedRemoteWorkspaces.deprecated', "Deprecated. Use the unified workspace picker setting instead."),
},
[UNIFIED_WORKSPACE_PICKER_SETTING]: {
type: 'boolean',
default: product.quality !== 'stable',
scope: ConfigurationScope.APPLICATION,
description: localize('sessions.chat.unifiedWorkspacePicker.enabled', "Controls whether the Agents Window uses the unified workspace picker, which combines GitHub and remote workspaces, provides search, and, when supported, allows creating sessions with no workspace."),
tags: ['experimental'],
experiment: { mode: 'auto' },
},
[AGENT_HOST_RUN_WORKTREE_CREATED_TASKS_SETTING]: {
type: 'boolean',
default: true,
Expand Down
4 changes: 3 additions & 1 deletion src/vs/sessions/contrib/chat/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { ChatConfiguration } from '../../../../workbench/contrib/chat/common/constants.js';

export const NEW_SESSION_ACTION_ID = 'workbench.action.sessions.newChat';
export const UNIFIED_WORKSPACE_PICKER_SETTING = 'sessions.chat.unifiedWorkspacePicker.enabled';
export const UNIFIED_WORKSPACE_PICKER_SETTING = ChatConfiguration.UnifiedWorkspacePicker;
29 changes: 1 addition & 28 deletions src/vs/sessions/contrib/github/browser/github.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,18 @@ import { structuralEquals } from '../../../../base/common/equals.js';
import { isEqual } from '../../../../base/common/resources.js';
import { URI } from '../../../../base/common/uri.js';
import { ConfigurationTarget, IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { ConfigurationScope, Extensions as ConfigurationExtensions, IConfigurationRegistry } from '../../../../platform/configuration/common/configurationRegistry.js';
import { AgentHostAutoArchiveMergedSessionsAfterDaysConfigKey, AgentHostAutoDeleteArchivedMergedSessionsAfterDaysConfigKey } from '../../../../platform/agentHost/common/agentHostSchema.js';
import { ICommandService } from '../../../../platform/commands/common/commands.js';
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
import { ILogService } from '../../../../platform/log/common/log.js';
import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
import { IWorkbenchContribution, registerWorkbenchContribution2, WorkbenchPhase } from '../../../../workbench/common/contributions.js';
import { localize } from '../../../../nls.js';
import { getGitHubPullRequestRefs, isActiveSessionStatus, ISession } from '../../../services/sessions/common/session.js';
import { ISessionsChangeEvent, ISessionsManagementService } from '../../../services/sessions/common/sessionsManagement.js';
import { ISessionsService } from '../../../services/sessions/browser/sessionsService.js';
import { GitHubPullRequestState } from '../common/types.js';
import { AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING, AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING, AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_QUERY, AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG } from '../common/sessionLifecycleSettings.js';
import { AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING, AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING, AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_QUERY } from '../common/sessionLifecycleSettings.js';
Comment thread
meganrogge marked this conversation as resolved.
import { GitHubService, IGitHubService } from './githubService.js';
import { IPullRequestIconCache, PullRequestIconCache } from './pullRequestIconCache.js';

Expand All @@ -41,30 +38,6 @@ const AUTO_ARCHIVE_PROMPTED_STORAGE_KEY = 'sessions.github.autoArchiveMerged.pro

export { AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING, AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING };

Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
id: 'chat',
properties: {
[AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING]: {
type: 'integer',
minimum: 0,
default: 0,
scope: ConfigurationScope.APPLICATION,
tags: ['preview', AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG],
markdownDescription: localize('autoArchiveMergedSessions.description', "Controls the number of inactive days before agent sessions with a merged pull request are automatically archived. Archiving safely removes eligible worktrees. Permanent deletion is controlled separately by {0}. Set to 0 to disable automatic archival. The recommended value is 15.", '`#chat.agentSessions.autoDeleteArchivedMergedSessionsAfterDays#`'),
agentHost: { key: AgentHostAutoArchiveMergedSessionsAfterDaysConfigKey },
},
[AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING]: {
type: 'integer',
minimum: 0,
default: 0,
scope: ConfigurationScope.APPLICATION,
tags: ['preview', AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG],
markdownDescription: localize('autoDeleteArchivedMergedSessions.description', "Controls the number of days after automatic archival before agent sessions with a merged pull request are permanently deleted. Retained eligible worktrees are safely removed before deletion. Automatic archival is controlled separately by {0}. Set to 0 to disable permanent deletion. The recommended value is 15.", '`#chat.agentSessions.autoArchiveMergedSessionsAfterDays#`'),
agentHost: { key: AgentHostAutoDeleteArchivedMergedSessionsAfterDaysConfigKey },
},
},
});

/**
* Resolved PR identity for a session's poller, or the specific stage at which
* resolution bailed out. Only the `ok` state keeps a PR model warm/polling; the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

export const AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING = 'chat.agentSessions.autoArchiveMergedSessionsAfterDays';
export const AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING = 'chat.agentSessions.autoDeleteArchivedMergedSessionsAfterDays';
export const AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG = 'agentSessionCleanup';
import { AGENT_SESSION_CLEANUP_SETTINGS_TAG, ChatConfiguration } from '../../../../workbench/contrib/chat/common/constants.js';

export const AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING = ChatConfiguration.AutoArchiveMergedSessionsAfterDays;
export const AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING = ChatConfiguration.AutoDeleteArchivedMergedSessionsAfterDays;
export const AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG = AGENT_SESSION_CLEANUP_SETTINGS_TAG;
export const AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_QUERY = `@tag:${AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG}`;
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { GitHubPullRequestState, IGitHubPullRequest } from '../../common/types.j
import { URI } from '../../../../../base/common/uri.js';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js';
import { mock } from '../../../../../base/test/common/mock.js';
import '../../../../../workbench/contrib/chat/browser/chat.shared.contribution.js';
import { AUTO_ARCHIVE_MERGED_SESSIONS_AFTER_DAYS_SETTING, AUTO_DELETE_ARCHIVED_MERGED_SESSIONS_AFTER_DAYS_SETTING, GitHubPullRequestPollingContribution } from '../../browser/github.contribution.js';
import { AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_QUERY, AUTOMATIC_MERGED_SESSION_CLEANUP_SETTINGS_TAG } from '../../common/sessionLifecycleSettings.js';
import { GitHubReferenceList, IGitHubReferenceListEntry } from '../../browser/githubReferenceList.js';
Expand Down
30 changes: 28 additions & 2 deletions src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { registerAction2 } from '../../../../platform/actions/common/actions.js'
import '../../../../platform/agentHost/browser/agentHostEnablementService.js';
import '../../../../platform/agentHost/common/agentHostEnablementService.js';
import { AgentHostMapLegacySettingsToManagedSettingsSettingId } from '../../../../platform/agentHost/common/agentHostManagedSettings.js';
import { AgentHostAutoReplyEnabledConfigKey, AgentHostEditAutoApprovePatternsConfigKey, AgentHostExternalSessionsMode, AgentHostGlobalAutoApproveEnabledConfigKey, AgentHostMigrateLegacyCopilotCliEnabledConfigKey, AgentHostSessionSyncEnabledConfigKey, AgentHostShowExternalSessionsConfigKey } from '../../../../platform/agentHost/common/agentHostSchema.js';
import { AgentHostAutoArchiveMergedSessionsAfterDaysConfigKey, AgentHostAutoDeleteArchivedMergedSessionsAfterDaysConfigKey, AgentHostAutoReplyEnabledConfigKey, AgentHostEditAutoApprovePatternsConfigKey, AgentHostExternalSessionsMode, AgentHostGlobalAutoApproveEnabledConfigKey, AgentHostMigrateLegacyCopilotCliEnabledConfigKey, AgentHostSessionSyncEnabledConfigKey, AgentHostShowExternalSessionsConfigKey } from '../../../../platform/agentHost/common/agentHostSchema.js';
import '../../../../platform/agentHost/common/agentHostStarter.config.contribution.js';
import { AgentMergeSettingId } from '../../../../platform/agentHost/common/agentMerge.js';
import { AgentHostAhpJsonlLoggingSettingId, AgentHostAllowSignedOutWhenUsableSettingId, AgentHostSdkSandboxEnabledSettingId, AgentHostSdkSandboxWindowsEnabledSettingId, CodexPreferAgentHostEditorSettingId } from '../../../../platform/agentHost/common/agentService.js';
Expand Down Expand Up @@ -64,7 +64,7 @@ import { ChatRequestOriginService, IChatRequestOriginService } from '../common/c
import { ChatService } from '../common/chatService/chatServiceImpl.js';
import { IChatSessionsService } from '../common/chatSessionsService.js';
import { ChatSideChatService, IChatSideChatService } from '../common/chatSideChatService.js';
import { BYOKUtilityModelDefault, ChatAIDisabledSettingId, ChatAgentLocation, ChatConfiguration, ChatDefaultPermissionLevel, CustomizationMigrationHintMode, ChatNotificationMode, ChatPermissionLevel } from '../common/constants.js';
import { AGENT_SESSION_CLEANUP_SETTINGS_TAG, BYOKUtilityModelDefault, ChatAIDisabledSettingId, ChatAgentLocation, ChatConfiguration, ChatDefaultPermissionLevel, CustomizationMigrationHintMode, ChatNotificationMode, ChatPermissionLevel } from '../common/constants.js';
import { CodeMapperService, ICodeMapperService } from '../common/editing/chatCodeMapperService.js';
import { IChatEditingService } from '../common/editing/chatEditingService.js';
import { ILanguageModelIgnoredFilesService, LanguageModelIgnoredFilesService } from '../common/ignoredFiles.js';
Expand Down Expand Up @@ -491,6 +491,32 @@ configurationRegistry.registerConfiguration({
experiment: { mode: 'auto' },
agentHost: { key: AgentHostShowExternalSessionsConfigKey },
},
[ChatConfiguration.UnifiedWorkspacePicker]: {
type: 'boolean',
default: product.quality !== 'stable',
scope: ConfigurationScope.APPLICATION,
description: nls.localize('sessions.chat.unifiedWorkspacePicker.enabled', "Controls whether the Agents Window uses the unified workspace picker, which combines GitHub and remote workspaces, provides search, and, when supported, allows creating sessions with no workspace."),
tags: ['experimental'],
experiment: { mode: 'auto' },
},
[ChatConfiguration.AutoArchiveMergedSessionsAfterDays]: {
type: 'integer',
minimum: 0,
default: 0,
scope: ConfigurationScope.APPLICATION,
tags: ['preview', AGENT_SESSION_CLEANUP_SETTINGS_TAG],
markdownDescription: nls.localize('autoArchiveMergedSessions.description', "Controls the number of inactive days before agent sessions with a merged pull request are automatically archived. Archiving safely removes eligible worktrees. Permanent deletion is controlled separately by {0}. Set to 0 to disable automatic archival. The recommended value is 15.", '`#chat.agentSessions.autoDeleteArchivedMergedSessionsAfterDays#`'),
agentHost: { key: AgentHostAutoArchiveMergedSessionsAfterDaysConfigKey },
},
[ChatConfiguration.AutoDeleteArchivedMergedSessionsAfterDays]: {
type: 'integer',
minimum: 0,
default: 0,
scope: ConfigurationScope.APPLICATION,
tags: ['preview', AGENT_SESSION_CLEANUP_SETTINGS_TAG],
markdownDescription: nls.localize('autoDeleteArchivedMergedSessions.description', "Controls the number of days after automatic archival before agent sessions with a merged pull request are permanently deleted. Retained eligible worktrees are safely removed before deletion. Automatic archival is controlled separately by {0}. Set to 0 to disable permanent deletion. The recommended value is 15.", '`#chat.agentSessions.autoArchiveMergedSessionsAfterDays#`'),
agentHost: { key: AgentHostAutoDeleteArchivedMergedSessionsAfterDaysConfigKey },
},
[ChatConfiguration.SaveBeforeSend]: {
type: 'boolean',
description: nls.localize('chat.saveBeforeSend', "Controls whether all dirty editors except untitled editors are saved before sending a chat message."),
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/chat/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export enum ChatConfiguration {
AgentSessionProjectionEnabled = 'chat.agentSessionProjection.enabled',
MigrateLegacyCopilotCliSessions = 'chat.agentSessions.migrateLegacyCopilotCli',
ShowExternalAgentSessions = 'chat.agentSessions.showExternal',
UnifiedWorkspacePicker = 'sessions.chat.unifiedWorkspacePicker.enabled',
AutoArchiveMergedSessionsAfterDays = 'chat.agentSessions.autoArchiveMergedSessionsAfterDays',
AutoDeleteArchivedMergedSessionsAfterDays = 'chat.agentSessions.autoDeleteArchivedMergedSessionsAfterDays',
ExtensionToolsEnabled = 'chat.extensionTools.enabled',
RepoInfoEnabled = 'chat.repoInfo.enabled',
EditRequests = 'chat.editRequests',
Expand Down Expand Up @@ -141,6 +144,8 @@ export enum ChatConfiguration {
ImplicitContextActiveEditor = 'chat.implicitContext.includeActiveEditor',
}

export const AGENT_SESSION_CLEANUP_SETTINGS_TAG = 'agentSessionCleanup';

/**
* The "kind" of agents for custom agents.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js';
import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from '../../../../../platform/configuration/common/configurationRegistry.js';
import { Registry } from '../../../../../platform/registry/common/platform.js';
import { ChatConfiguration } from '../../common/constants.js';
import '../../browser/chat.shared.contribution.js';

const configurationProperties = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).getConfigurationProperties();

suite('Chat configuration', () => {

ensureNoDisposablesAreLeakedInTestSuite();

test('registers Agents Window settings in the shared workbench contribution', () => {
assert.deepStrictEqual([
ChatConfiguration.UnifiedWorkspacePicker,
ChatConfiguration.AutoArchiveMergedSessionsAfterDays,
ChatConfiguration.AutoDeleteArchivedMergedSessionsAfterDays,
].map(key => configurationProperties[key] !== undefined), [true, true, true]);
});
});
Loading