@@ -469,8 +469,8 @@ describe("gateway send mirroring", () => {
469469 expect ( response ?. [ 0 ] ) . toBe ( true ) ;
470470 } ) ;
471471
472- it ( "keeps the request context config for message.action when the active snapshot source does not match" , async ( ) => {
473- const contextConfig = {
472+ it ( "keeps the post-auto-enable request config for message.action when the active snapshot source does not match" , async ( ) => {
473+ const sourceConfig = {
474474 channels : {
475475 discord : {
476476 accounts : {
@@ -485,11 +485,28 @@ describe("gateway send mirroring", () => {
485485 } ,
486486 } ,
487487 } ;
488- mocks . applyPluginAutoEnable . mockImplementation ( ( ) => ( {
489- config : contextConfig ,
490- changes : [ ] ,
488+ const autoEnabledRequestConfig = {
489+ channels : {
490+ discord : {
491+ enabled : true ,
492+ accounts : {
493+ drclaw : {
494+ token : {
495+ source : "env" ,
496+ provider : "default" ,
497+ id : "DISCORD_BOT_TOKEN_DRCLAW" ,
498+ } ,
499+ } ,
500+ } ,
501+ } ,
502+ } ,
503+ plugins : { allow : [ "discord" ] } ,
504+ } ;
505+ mocks . applyPluginAutoEnable . mockReturnValue ( {
506+ config : autoEnabledRequestConfig ,
507+ changes : [ { path : "channels.discord.enabled" , value : true } ] ,
491508 autoEnabledReasons : { } ,
492- } ) ) ;
509+ } ) ;
493510 mocks . getActiveSecretsRuntimeConfigSnapshot . mockReturnValue ( {
494511 config : {
495512 channels : {
@@ -513,7 +530,7 @@ describe("gateway send mirroring", () => {
513530
514531 const context = {
515532 ...makeContext ( ) ,
516- getRuntimeConfig : ( ) => contextConfig ,
533+ getRuntimeConfig : ( ) => sourceConfig ,
517534 } as unknown as GatewayRequestContext ;
518535 await sendHandlers [ "message.action" ] ( {
519536 params : {
@@ -529,7 +546,7 @@ describe("gateway send mirroring", () => {
529546 isWebchatConnect : ( ) => false ,
530547 } ) ;
531548
532- expect ( lastDispatchChannelMessageActionCall ( ) ?. cfg ) . toBe ( contextConfig ) ;
549+ expect ( lastDispatchChannelMessageActionCall ( ) ?. cfg ) . toBe ( autoEnabledRequestConfig ) ;
533550 } ) ;
534551
535552 it ( "does not read the active secrets runtime config snapshot for send requests" , async ( ) => {
0 commit comments