Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions pkg/workflow/codex_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/compiler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
54 changes: 23 additions & 31 deletions pkg/workflow/copilot_engine_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Loading