From 4bb5d4ff2deb94ac4c8a9b697a681bc105e36a73 Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Mon, 5 Jan 2026 23:07:02 -0500 Subject: [PATCH 1/3] Set ACTIONS_ORCHESTRATION_ID as env to node.js actions. --- src/Runner.Worker/Handlers/NodeScriptActionHandler.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs index a399f13d1d2..9db55d159af 100644 --- a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs +++ b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs @@ -77,6 +77,11 @@ public async Task RunAsync(ActionRunStage stage) Environment["ACTIONS_CACHE_SERVICE_V2"] = bool.TrueString; } + if (ExecutionContext.Global.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out var orchestrationId) && !string.IsNullOrEmpty(orchestrationId)) + { + Environment["ACTIONS_ORCHESTRATION_ID"] = orchestrationId; + } + // Resolve the target script. string target = null; if (stage == ActionRunStage.Main) From 4822c46238c342e55d847419a15cd383d20770c0 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 13:13:23 -0500 Subject: [PATCH 2/3] Add feature flag guard for ACTIONS_ORCHESTRATION_ID environment variable (#4181) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> --- src/Runner.Common/Constants.cs | 1 + src/Runner.Worker/Handlers/NodeScriptActionHandler.cs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs index ae2b0863006..98ddcc11ecd 100644 --- a/src/Runner.Common/Constants.cs +++ b/src/Runner.Common/Constants.cs @@ -172,6 +172,7 @@ public static class Features public static readonly string SnapshotPreflightHostedRunnerCheck = "actions_snapshot_preflight_hosted_runner_check"; public static readonly string SnapshotPreflightImageGenPoolCheck = "actions_snapshot_preflight_image_gen_pool_check"; public static readonly string CompareWorkflowParser = "actions_runner_compare_workflow_parser"; + public static readonly string SetOrchestrationIdEnvForNodeActions = "actions_set_orchestration_id_env_for_node_actions"; } // Node version migration related constants diff --git a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs index 9db55d159af..9576fa9b627 100644 --- a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs +++ b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs @@ -77,9 +77,12 @@ public async Task RunAsync(ActionRunStage stage) Environment["ACTIONS_CACHE_SERVICE_V2"] = bool.TrueString; } - if (ExecutionContext.Global.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out var orchestrationId) && !string.IsNullOrEmpty(orchestrationId)) + if (ExecutionContext.Global.Variables.GetBoolean(Constants.Runner.Features.SetOrchestrationIdEnvForNodeActions) ?? false) { - Environment["ACTIONS_ORCHESTRATION_ID"] = orchestrationId; + if (ExecutionContext.Global.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out var orchestrationId) && !string.IsNullOrEmpty(orchestrationId)) + { + Environment["ACTIONS_ORCHESTRATION_ID"] = orchestrationId; + } } // Resolve the target script. From b26d856046780a0aba05f7310ddf420f70064738 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 13:59:05 -0500 Subject: [PATCH 3/3] Generalize ACTIONS_ORCHESTRATION_ID feature flag for all action types (#4182) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> --- src/Runner.Common/Constants.cs | 2 +- src/Runner.Worker/Handlers/ContainerActionHandler.cs | 8 ++++++++ src/Runner.Worker/Handlers/NodeScriptActionHandler.cs | 2 +- src/Runner.Worker/Handlers/ScriptHandler.cs | 8 ++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs index 98ddcc11ecd..045e906637e 100644 --- a/src/Runner.Common/Constants.cs +++ b/src/Runner.Common/Constants.cs @@ -172,7 +172,7 @@ public static class Features public static readonly string SnapshotPreflightHostedRunnerCheck = "actions_snapshot_preflight_hosted_runner_check"; public static readonly string SnapshotPreflightImageGenPoolCheck = "actions_snapshot_preflight_image_gen_pool_check"; public static readonly string CompareWorkflowParser = "actions_runner_compare_workflow_parser"; - public static readonly string SetOrchestrationIdEnvForNodeActions = "actions_set_orchestration_id_env_for_node_actions"; + public static readonly string SetOrchestrationIdEnvForActions = "actions_set_orchestration_id_env_for_actions"; } // Node version migration related constants diff --git a/src/Runner.Worker/Handlers/ContainerActionHandler.cs b/src/Runner.Worker/Handlers/ContainerActionHandler.cs index 399fac780e1..1f67c9dd360 100644 --- a/src/Runner.Worker/Handlers/ContainerActionHandler.cs +++ b/src/Runner.Worker/Handlers/ContainerActionHandler.cs @@ -239,6 +239,14 @@ public async Task RunAsync(ActionRunStage stage) Environment["ACTIONS_RESULTS_URL"] = resultsUrl; } + if (ExecutionContext.Global.Variables.GetBoolean(Constants.Runner.Features.SetOrchestrationIdEnvForActions) ?? false) + { + if (ExecutionContext.Global.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out var orchestrationId) && !string.IsNullOrEmpty(orchestrationId)) + { + Environment["ACTIONS_ORCHESTRATION_ID"] = orchestrationId; + } + } + foreach (var variable in this.Environment) { container.ContainerEnvironmentVariables[variable.Key] = container.TranslateToContainerPath(variable.Value); diff --git a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs index 9576fa9b627..668ca95f6df 100644 --- a/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs +++ b/src/Runner.Worker/Handlers/NodeScriptActionHandler.cs @@ -77,7 +77,7 @@ public async Task RunAsync(ActionRunStage stage) Environment["ACTIONS_CACHE_SERVICE_V2"] = bool.TrueString; } - if (ExecutionContext.Global.Variables.GetBoolean(Constants.Runner.Features.SetOrchestrationIdEnvForNodeActions) ?? false) + if (ExecutionContext.Global.Variables.GetBoolean(Constants.Runner.Features.SetOrchestrationIdEnvForActions) ?? false) { if (ExecutionContext.Global.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out var orchestrationId) && !string.IsNullOrEmpty(orchestrationId)) { diff --git a/src/Runner.Worker/Handlers/ScriptHandler.cs b/src/Runner.Worker/Handlers/ScriptHandler.cs index e6fa90a0a11..b898f051ded 100644 --- a/src/Runner.Worker/Handlers/ScriptHandler.cs +++ b/src/Runner.Worker/Handlers/ScriptHandler.cs @@ -318,6 +318,14 @@ public async Task RunAsync(ActionRunStage stage) Environment["ACTIONS_ID_TOKEN_REQUEST_TOKEN"] = systemConnection.Authorization.Parameters[EndpointAuthorizationParameters.AccessToken]; } + if (ExecutionContext.Global.Variables.GetBoolean(Constants.Runner.Features.SetOrchestrationIdEnvForActions) ?? false) + { + if (ExecutionContext.Global.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out var orchestrationId) && !string.IsNullOrEmpty(orchestrationId)) + { + Environment["ACTIONS_ORCHESTRATION_ID"] = orchestrationId; + } + } + ExecutionContext.Debug($"{fileName} {arguments}"); Inputs.TryGetValue("standardInInput", out var standardInInput);