From 504c0cd6e3fdb349ab964daec7db81e0ce66e47f Mon Sep 17 00:00:00 2001 From: Aprana Seth Date: Thu, 25 Sep 2025 16:05:24 -0700 Subject: [PATCH 1/3] Enabling worker indexing for Logic apps behind an enviornment setting --- src/WebJobs.Script/Environment/EnvironmentExtensions.cs | 9 +++++++++ .../Environment/EnvironmentSettingNames.cs | 2 ++ src/WebJobs.Script/Host/ScriptHost.cs | 2 +- src/WebJobs.Script/Utility.cs | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/WebJobs.Script/Environment/EnvironmentExtensions.cs b/src/WebJobs.Script/Environment/EnvironmentExtensions.cs index fd1da3ef56..265b2f98c6 100644 --- a/src/WebJobs.Script/Environment/EnvironmentExtensions.cs +++ b/src/WebJobs.Script/Environment/EnvironmentExtensions.cs @@ -425,6 +425,15 @@ public static bool IsLogicApp(this IEnvironment environment) return !string.IsNullOrEmpty(appKind) && appKind.Contains(ScriptConstants.WorkFlowAppKind); } + /// + /// Gets if codeful mode is enabled for Logic App app kind. + /// + public static bool IsLogicAppCodefulModeEnabled(this IEnvironment environment) + { + bool.TryParse(environment.GetEnvironmentVariable(LogicAppCodefulModeEnabled), out bool logicAppCodefulModeEnabled); + return logicAppCodefulModeEnabled; + } + /// /// Gets if runtime environment needs multi language. /// diff --git a/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs b/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs index 777838abb2..1be7d0b532 100644 --- a/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs +++ b/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs @@ -150,6 +150,8 @@ public static class EnvironmentSettingNames public const string AppKind = "APP_KIND"; + public const string LogicAppCodefulModeEnabled = "WORKFLOW_CODEFUL_ENABLED"; + public const string DrainOnApplicationStopping = "FUNCTIONS_ENABLE_DRAIN_ON_APP_STOPPING"; } } diff --git a/src/WebJobs.Script/Host/ScriptHost.cs b/src/WebJobs.Script/Host/ScriptHost.cs index 3082c947ed..c11ad733db 100644 --- a/src/WebJobs.Script/Host/ScriptHost.cs +++ b/src/WebJobs.Script/Host/ScriptHost.cs @@ -787,7 +787,7 @@ internal async Task> GetFunctionDescriptorsAsync( Collection functionDescriptors = new Collection(); if (!cancellationToken.IsCancellationRequested) { - bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = true; + bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = _environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled() ? false: true; // this dotnet isolated specific logic is temporary to ensure in-proc payload compatibility with "dotnet-isolated" as the FUNCTIONS_WORKER_RUNTIME value. if (string.Equals(workerRuntime, RpcWorkerConstants.DotNetIsolatedLanguageWorkerName, StringComparison.OrdinalIgnoreCase)) { diff --git a/src/WebJobs.Script/Utility.cs b/src/WebJobs.Script/Utility.cs index 5bdaa86319..4899a1cde6 100644 --- a/src/WebJobs.Script/Utility.cs +++ b/src/WebJobs.Script/Utility.cs @@ -1028,7 +1028,8 @@ public static void ValidateRetryOptions(RetryOptions // WORKER_INDEXING_DISABLED contains the customers app name worker indexing is then disabled for that customer only public static bool CanWorkerIndex(IEnumerable workerConfigs, IEnvironment environment, FunctionsHostingConfigOptions functionsHostingConfigOptions) { - if (environment.IsLogicApp()) + // NOTE(apseth): Enabling the worker indexing for Logic Apps with codeful mode enabled. + if (environment.IsLogicApp() && !environment.IsLogicAppCodefulModeEnabled()) { return false; } From 0b7ff552f1f001d63b0f4825ecab13963572b9b9 Mon Sep 17 00:00:00 2001 From: Aprana Seth Date: Thu, 25 Sep 2025 16:05:24 -0700 Subject: [PATCH 2/3] Enabling worker indexing for Logic apps behind an enviornment setting --- src/WebJobs.Script/Environment/EnvironmentExtensions.cs | 9 +++++++++ .../Environment/EnvironmentSettingNames.cs | 2 ++ src/WebJobs.Script/Host/ScriptHost.cs | 2 +- src/WebJobs.Script/Utility.cs | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/WebJobs.Script/Environment/EnvironmentExtensions.cs b/src/WebJobs.Script/Environment/EnvironmentExtensions.cs index fd1da3ef56..265b2f98c6 100644 --- a/src/WebJobs.Script/Environment/EnvironmentExtensions.cs +++ b/src/WebJobs.Script/Environment/EnvironmentExtensions.cs @@ -425,6 +425,15 @@ public static bool IsLogicApp(this IEnvironment environment) return !string.IsNullOrEmpty(appKind) && appKind.Contains(ScriptConstants.WorkFlowAppKind); } + /// + /// Gets if codeful mode is enabled for Logic App app kind. + /// + public static bool IsLogicAppCodefulModeEnabled(this IEnvironment environment) + { + bool.TryParse(environment.GetEnvironmentVariable(LogicAppCodefulModeEnabled), out bool logicAppCodefulModeEnabled); + return logicAppCodefulModeEnabled; + } + /// /// Gets if runtime environment needs multi language. /// diff --git a/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs b/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs index 777838abb2..1be7d0b532 100644 --- a/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs +++ b/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs @@ -150,6 +150,8 @@ public static class EnvironmentSettingNames public const string AppKind = "APP_KIND"; + public const string LogicAppCodefulModeEnabled = "WORKFLOW_CODEFUL_ENABLED"; + public const string DrainOnApplicationStopping = "FUNCTIONS_ENABLE_DRAIN_ON_APP_STOPPING"; } } diff --git a/src/WebJobs.Script/Host/ScriptHost.cs b/src/WebJobs.Script/Host/ScriptHost.cs index 3082c947ed..bb2605fdaf 100644 --- a/src/WebJobs.Script/Host/ScriptHost.cs +++ b/src/WebJobs.Script/Host/ScriptHost.cs @@ -787,7 +787,7 @@ internal async Task> GetFunctionDescriptorsAsync( Collection functionDescriptors = new Collection(); if (!cancellationToken.IsCancellationRequested) { - bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = true; + bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = _environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled() ? false : true; // this dotnet isolated specific logic is temporary to ensure in-proc payload compatibility with "dotnet-isolated" as the FUNCTIONS_WORKER_RUNTIME value. if (string.Equals(workerRuntime, RpcWorkerConstants.DotNetIsolatedLanguageWorkerName, StringComparison.OrdinalIgnoreCase)) { diff --git a/src/WebJobs.Script/Utility.cs b/src/WebJobs.Script/Utility.cs index 5bdaa86319..4899a1cde6 100644 --- a/src/WebJobs.Script/Utility.cs +++ b/src/WebJobs.Script/Utility.cs @@ -1028,7 +1028,8 @@ public static void ValidateRetryOptions(RetryOptions // WORKER_INDEXING_DISABLED contains the customers app name worker indexing is then disabled for that customer only public static bool CanWorkerIndex(IEnumerable workerConfigs, IEnvironment environment, FunctionsHostingConfigOptions functionsHostingConfigOptions) { - if (environment.IsLogicApp()) + // NOTE(apseth): Enabling the worker indexing for Logic Apps with codeful mode enabled. + if (environment.IsLogicApp() && !environment.IsLogicAppCodefulModeEnabled()) { return false; } From 71710d61f60041b56039a92b5be8fd9781a2106c Mon Sep 17 00:00:00 2001 From: Aprana Seth Date: Thu, 25 Sep 2025 16:05:24 -0700 Subject: [PATCH 3/3] Enabling worker indexing for Logic apps behind an enviornment setting --- src/WebJobs.Script/Host/ScriptHost.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WebJobs.Script/Host/ScriptHost.cs b/src/WebJobs.Script/Host/ScriptHost.cs index bb2605fdaf..ea24fb90cb 100644 --- a/src/WebJobs.Script/Host/ScriptHost.cs +++ b/src/WebJobs.Script/Host/ScriptHost.cs @@ -787,7 +787,8 @@ internal async Task> GetFunctionDescriptorsAsync( Collection functionDescriptors = new Collection(); if (!cancellationToken.IsCancellationRequested) { - bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = _environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled() ? false : true; + bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = !(_environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled()); + // this dotnet isolated specific logic is temporary to ensure in-proc payload compatibility with "dotnet-isolated" as the FUNCTIONS_WORKER_RUNTIME value. if (string.Equals(workerRuntime, RpcWorkerConstants.DotNetIsolatedLanguageWorkerName, StringComparison.OrdinalIgnoreCase)) {