@@ -47,7 +47,7 @@ import { TestAgentHostTerminalManager } from './testAgentHostTerminalManager.js'
4747import { buildCopilotSystemNotification } from '../../node/copilot/copilotSystemNotification.js' ;
4848import { IAgentConfigurationService } from '../../node/agentConfigurationService.js' ;
4949import { SessionConfigKey } from '../../common/sessionConfigKeys.js' ;
50- import { AgentHostAutoReplyEnabledConfigKey , AgentHostDisableRepoInfoTelemetryConfigKey , AgentHostGlobalAutoApproveEnabledConfigKey } from '../../common/agentHostSchema.js' ;
50+ import { AgentHostAutoReplyEnabledConfigKey , AgentHostDisableRepoInfoTelemetryConfigKey , AgentHostGlobalAutoApproveEnabledConfigKey , AgentHostManagedPermissionsConfigKey } from '../../common/agentHostSchema.js' ;
5151import { CopilotCliConfigKey } from '../../common/copilotCliConfig.js' ;
5252import { AgentHostSandboxConfigKey , AgentHostSandboxKey } from '../../common/sandboxConfigSchema.js' ;
5353import { AgentSandboxEnabledValue } from '../../../sandbox/common/settings.js' ;
@@ -3480,15 +3480,17 @@ suite('CopilotAgentSession', () => {
34803480 assert . deepStrictEqual ( mockSession . permissionModeSetCalls , [ 'auto' ] ) ;
34813481 } ) ;
34823482
3483- test ( 'syncs permission mode when root approval configuration changes' , async ( ) => {
3484- const { session, mockSession, setRootValue, fireRootConfigChange } = await createAgentSession ( disposables ) ;
3483+ test ( 'managed policy clamps a live allow-all session' , async ( ) => {
3484+ const { session, mockSession, setRootValue, fireRootConfigChange } = await createAgentSession ( disposables , {
3485+ configValues : { [ SessionConfigKey . AutoApprove ] : 'autoApprove' } ,
3486+ } ) ;
34853487 await session . syncPermissionMode ( 'turn-start' ) ;
3486- setRootValue ( AgentHostGlobalAutoApproveEnabledConfigKey , true ) ;
3488+ setRootValue ( AgentHostManagedPermissionsConfigKey , { disableBypassPermissionsMode : 'disable' } ) ;
34873489
34883490 fireRootConfigChange ( ) ;
34893491 await timeout ( 0 ) ;
34903492
3491- assert . deepStrictEqual ( mockSession . permissionModeSetCalls , [ 'off ' , 'on ' ] ) ;
3493+ assert . deepStrictEqual ( mockSession . permissionModeSetCalls , [ 'on ' , 'off ' ] ) ;
34923494 } ) ;
34933495
34943496 test ( 'aborts when a live permission mode update fails' , async ( ) => {
0 commit comments