From c1e03c2689adc400ab708af682aa9dfffd76048c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 23:53:44 +0000 Subject: [PATCH 1/4] Initial plan From 777211794e0e7e8516737a52331d48319caa5d2a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 23:59:30 +0000 Subject: [PATCH 2/4] Initial plan: Fix variable shadowing in engine execution files Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- pkg/workflow/claude_engine.go | 2 +- pkg/workflow/codex_engine.go | 4 ++-- pkg/workflow/copilot_engine_execution.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/workflow/claude_engine.go b/pkg/workflow/claude_engine.go index 587e483b0c..fcf1714703 100644 --- a/pkg/workflow/claude_engine.go +++ b/pkg/workflow/claude_engine.go @@ -229,7 +229,7 @@ func (e *ClaudeEngine) GetExecutionSteps(workflowData *WorkflowData, logFile str // Use claude command directly (available in PATH from hostedtoolcache mount) commandName = "claude" } - + commandParts := []string{commandName} commandParts = append(commandParts, claudeArgs...) commandParts = append(commandParts, promptCommand) diff --git a/pkg/workflow/codex_engine.go b/pkg/workflow/codex_engine.go index ec0edecb5a..7a9d9b3fe9 100644 --- a/pkg/workflow/codex_engine.go +++ b/pkg/workflow/codex_engine.go @@ -174,7 +174,7 @@ func (e *CodexEngine) GetExecutionSteps(workflowData *WorkflowData, logFile stri // PATH will be set to find codex in hostedtoolcache when firewall is enabled commandName = "codex" } - + codexCommand := fmt.Sprintf("%s %sexec%s%s%s\"$INSTRUCTION\"", commandName, modelParam, webSearchParam, fullAutoParam, customArgsParam) @@ -316,7 +316,7 @@ mkdir -p "$CODEX_HOME/logs" } else { commandName = "codex" } - + if workflowData.AgentFile != "" { agentPath := ResolveAgentFilePath(workflowData.AgentFile) command = fmt.Sprintf(`set -o pipefail diff --git a/pkg/workflow/copilot_engine_execution.go b/pkg/workflow/copilot_engine_execution.go index f577959c0b..c1491cc857 100644 --- a/pkg/workflow/copilot_engine_execution.go +++ b/pkg/workflow/copilot_engine_execution.go @@ -151,7 +151,7 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st if sandboxEnabled { // Build base command var baseCommand string - + // Check if custom command is specified var commandName string if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" { @@ -171,7 +171,7 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st commandName = "/usr/local/bin/copilot" } } - + baseCommand = fmt.Sprintf("%s %s", commandName, shellJoinArgs(copilotArgs)) // Add conditional model flag if needed @@ -189,7 +189,7 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st } else { commandName = "copilot" } - + baseCommand := fmt.Sprintf("%s %s", commandName, shellJoinArgs(copilotArgs)) // Add conditional model flag if needed From 7df003f133aafe08208e4a5d6d6611efd58a5bc0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 00:03:18 +0000 Subject: [PATCH 3/4] Fix variable shadowing in copilot_engine_execution.go and codex_engine.go Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- pkg/workflow/codex_engine.go | 10 +---- pkg/workflow/copilot_engine_execution.go | 54 ++++++++++-------------- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/pkg/workflow/codex_engine.go b/pkg/workflow/codex_engine.go index 7a9d9b3fe9..649a7d6825 100644 --- a/pkg/workflow/codex_engine.go +++ b/pkg/workflow/codex_engine.go @@ -308,15 +308,7 @@ mkdir -p "$CODEX_HOME/logs" } } else { // Build the command without AWF wrapping - // Determine which command to use - var commandName string - if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" { - commandName = workflowData.EngineConfig.Command - codexEngineLog.Printf("Using custom command: %s", commandName) - } else { - commandName = "codex" - } - + // Reuse commandName already determined above if workflowData.AgentFile != "" { agentPath := ResolveAgentFilePath(workflowData.AgentFile) command = fmt.Sprintf(`set -o pipefail diff --git a/pkg/workflow/copilot_engine_execution.go b/pkg/workflow/copilot_engine_execution.go index c1491cc857..b35661d6a9 100644 --- a/pkg/workflow/copilot_engine_execution.go +++ b/pkg/workflow/copilot_engine_execution.go @@ -148,31 +148,32 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st modelEnvVar = constants.EnvVarModelAgentCopilot } - if sandboxEnabled { - // Build base command - var baseCommand string - - // Check if custom command is specified - var commandName string - if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" { - commandName = workflowData.EngineConfig.Command - copilotExecLog.Printf("Using custom command: %s", commandName) + // Determine which command to use (once for both sandbox and non-sandbox modes) + var commandName string + if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" { + commandName = workflowData.EngineConfig.Command + copilotExecLog.Printf("Using custom command: %s", commandName) + } else if sandboxEnabled { + // For SRT: use locally installed package without -y flag to avoid internet fetch + // For AWF: use the installed binary directly + if isSRTEnabled(workflowData) { + // Use node explicitly to invoke copilot CLI to ensure env vars propagate correctly through sandbox + // The .bin/copilot shell wrapper doesn't properly pass environment variables through bubblewrap + // Environment variables are explicitly exported in the SRT wrapper to propagate through sandbox + commandName = "node ./node_modules/.bin/copilot" } else { - // For SRT: use locally installed package without -y flag to avoid internet fetch - // For AWF: use the installed binary directly - if isSRTEnabled(workflowData) { - // Use node explicitly to invoke copilot CLI to ensure env vars propagate correctly through sandbox - // The .bin/copilot shell wrapper doesn't properly pass environment variables through bubblewrap - // Environment variables are explicitly exported in the SRT wrapper to propagate through sandbox - commandName = "node ./node_modules/.bin/copilot" - } else { - // AWF - use the copilot binary installed by the installer script - // The binary is mounted into the AWF container from /usr/local/bin/copilot - commandName = "/usr/local/bin/copilot" - } + // AWF - use the copilot binary installed by the installer script + // The binary is mounted into the AWF container from /usr/local/bin/copilot + commandName = "/usr/local/bin/copilot" } + } else { + // Non-sandbox mode: use standard copilot command + commandName = "copilot" + } - baseCommand = fmt.Sprintf("%s %s", commandName, shellJoinArgs(copilotArgs)) + if sandboxEnabled { + // Build base command + baseCommand := fmt.Sprintf("%s %s", commandName, shellJoinArgs(copilotArgs)) // Add conditional model flag if needed if needsModelFlag { @@ -181,15 +182,6 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st copilotCommand = baseCommand } } else { - // When sandbox is disabled, determine command to use - var commandName string - if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" { - commandName = workflowData.EngineConfig.Command - copilotExecLog.Printf("Using custom command: %s", commandName) - } else { - commandName = "copilot" - } - baseCommand := fmt.Sprintf("%s %s", commandName, shellJoinArgs(copilotArgs)) // Add conditional model flag if needed From 95886f921153e7623de9acf32dbf3adc6263f4a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 00:38:34 +0000 Subject: [PATCH 4/4] Merge main branch and resolve conflicts while maintaining variable shadowing fix Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/workflow/compiler_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/workflow/compiler_types.go b/pkg/workflow/compiler_types.go index 256204ef24..a990808289 100644 --- a/pkg/workflow/compiler_types.go +++ b/pkg/workflow/compiler_types.go @@ -325,7 +325,7 @@ type SafeOutputsConfig struct { CreatePullRequests *CreatePullRequestsConfig `yaml:"create-pull-requests,omitempty"` CreatePullRequestReviewComments *CreatePullRequestReviewCommentsConfig `yaml:"create-pull-request-review-comments,omitempty"` CreateCodeScanningAlerts *CreateCodeScanningAlertsConfig `yaml:"create-code-scanning-alerts,omitempty"` - AutofixCodeScanningAlert *AutofixCodeScanningAlertConfig `yaml:"autofix-code-scanning-alert,omitempty"` + AutofixCodeScanningAlert *AutofixCodeScanningAlertConfig `yaml:"autofix-code-scanning-alert,omitempty"` AddLabels *AddLabelsConfig `yaml:"add-labels,omitempty"` AddReviewer *AddReviewerConfig `yaml:"add-reviewer,omitempty"` AssignMilestone *AssignMilestoneConfig `yaml:"assign-milestone,omitempty"`