@@ -859,25 +859,104 @@ allowed_sandbox_modes = ["read-only", "workspace-write"]
859859 configured : true ,
860860 enabled : true ,
861861 allowDestructiveActions : false ,
862+ destructiveApprovalMode : "deny" ,
862863 pluginPolicies : [
863864 {
864865 configKey : "google-calendar" ,
865866 marketplaceName : "openai-curated" ,
866867 pluginName : "google-calendar" ,
867868 enabled : true ,
868869 allowDestructiveActions : true ,
870+ destructiveApprovalMode : "allow" ,
869871 } ,
870872 {
871873 configKey : "slack" ,
872874 marketplaceName : "openai-curated" ,
873875 pluginName : "slack" ,
874876 enabled : false ,
875877 allowDestructiveActions : false ,
878+ destructiveApprovalMode : "deny" ,
876879 } ,
877880 ] ,
878881 } ) ;
879882 } ) ;
880883
884+ it ( "parses auto native Codex plugin destructive policy" , ( ) => {
885+ const config = readCodexPluginConfig ( {
886+ codexPlugins : {
887+ enabled : true ,
888+ allow_destructive_actions : "auto" ,
889+ plugins : {
890+ "google-calendar" : {
891+ marketplaceName : "openai-curated" ,
892+ pluginName : "google-calendar" ,
893+ } ,
894+ slack : {
895+ marketplaceName : "openai-curated" ,
896+ pluginName : "slack" ,
897+ allow_destructive_actions : false ,
898+ } ,
899+ gmail : {
900+ marketplaceName : "openai-curated" ,
901+ pluginName : "gmail" ,
902+ allow_destructive_actions : true ,
903+ } ,
904+ } ,
905+ } ,
906+ } ) ;
907+
908+ expect ( config . codexPlugins ?. allow_destructive_actions ) . toBe ( "auto" ) ;
909+ expect ( resolveCodexPluginsPolicy ( config ) ) . toEqual ( {
910+ configured : true ,
911+ enabled : true ,
912+ allowDestructiveActions : true ,
913+ destructiveApprovalMode : "auto" ,
914+ pluginPolicies : [
915+ {
916+ configKey : "gmail" ,
917+ marketplaceName : "openai-curated" ,
918+ pluginName : "gmail" ,
919+ enabled : true ,
920+ allowDestructiveActions : true ,
921+ destructiveApprovalMode : "allow" ,
922+ } ,
923+ {
924+ configKey : "google-calendar" ,
925+ marketplaceName : "openai-curated" ,
926+ pluginName : "google-calendar" ,
927+ enabled : true ,
928+ allowDestructiveActions : true ,
929+ destructiveApprovalMode : "auto" ,
930+ } ,
931+ {
932+ configKey : "slack" ,
933+ marketplaceName : "openai-curated" ,
934+ pluginName : "slack" ,
935+ enabled : true ,
936+ allowDestructiveActions : false ,
937+ destructiveApprovalMode : "deny" ,
938+ } ,
939+ ] ,
940+ } ) ;
941+ } ) ;
942+
943+ it ( "rejects unsupported native Codex plugin destructive policy strings" , ( ) => {
944+ const config = readCodexPluginConfig ( {
945+ codexPlugins : {
946+ enabled : true ,
947+ allow_destructive_actions : "ask" ,
948+ plugins : {
949+ slack : {
950+ marketplaceName : "openai-curated" ,
951+ pluginName : "slack" ,
952+ } ,
953+ } ,
954+ } ,
955+ } ) ;
956+
957+ expect ( config . codexPlugins ) . toBeUndefined ( ) ;
958+ } ) ;
959+
881960 it ( "defaults native Codex plugin destructive policy to enabled" , ( ) => {
882961 const policy = resolveCodexPluginsPolicy ( {
883962 codexPlugins : {
@@ -895,13 +974,15 @@ allowed_sandbox_modes = ["read-only", "workspace-write"]
895974 configured : true ,
896975 enabled : true ,
897976 allowDestructiveActions : true ,
977+ destructiveApprovalMode : "allow" ,
898978 pluginPolicies : [
899979 {
900980 configKey : "slack" ,
901981 marketplaceName : "openai-curated" ,
902982 pluginName : "slack" ,
903983 enabled : true ,
904984 allowDestructiveActions : true ,
985+ destructiveApprovalMode : "allow" ,
905986 } ,
906987 ] ,
907988 } ) ;
0 commit comments