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
6 changes: 3 additions & 3 deletions pkg/cli/add_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ func addWorkflowWithTracking(resolved *ResolvedWorkflow, tracker *FileTracker, o

// Handle engine override - add/update the engine field in frontmatter before source so
// the engine declaration appears above the source field in the final file.
// Copilot is the default engine, so we skip adding it to avoid unnecessary noise and
// prevent conflicts during later workflow updates.
if opts.EngineOverride != "" && opts.EngineOverride != string(constants.CopilotEngine) {
// The default engine is omitted to avoid unnecessary noise and prevent conflicts during
// later workflow updates.
if opts.EngineOverride != "" && opts.EngineOverride != string(constants.DefaultEngine) {
updatedContent, err := addEngineToWorkflow(content, opts.EngineOverride)
if err != nil {
if opts.Verbose {
Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/add_interactive_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (c *AddInteractiveConfig) selectAIEngineAndKey() error {

// Determine default engine based on existing secrets, workflow preference, then environment
// Priority order: flag override > existing secrets > workflow frontmatter > environment > default
defaultEngine := string(constants.CopilotEngine)
defaultEngine := string(constants.DefaultEngine)
workflowSpecifiedEngine := ""

// Check if workflow specifies a preferred engine in frontmatter
Expand Down Expand Up @@ -52,12 +52,12 @@ func (c *AddInteractiveConfig) selectAIEngineAndKey() error {
}

// Priority 2: If no existing secret found, use workflow frontmatter preference
if defaultEngine == string(constants.CopilotEngine) && workflowSpecifiedEngine != "" {
if defaultEngine == string(constants.DefaultEngine) && workflowSpecifiedEngine != "" {
defaultEngine = workflowSpecifiedEngine
}

// Priority 3: Check environment variables if no existing secret or workflow preference found
if defaultEngine == string(constants.CopilotEngine) && workflowSpecifiedEngine == "" {
if defaultEngine == string(constants.DefaultEngine) && workflowSpecifiedEngine == "" {
for _, opt := range constants.EngineOptions {
envVar := opt.SecretName
if opt.EnvVarName != "" {
Expand Down
3 changes: 3 additions & 0 deletions pkg/constants/constants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ func TestAgenticEngines(t *testing.T) {
if string(GeminiEngine) != "gemini" {
t.Errorf("GeminiEngine constant = %q, want %q", GeminiEngine, "gemini")
}
if DefaultEngine != CopilotEngine {
t.Errorf("DefaultEngine = %q, want CopilotEngine (%q)", DefaultEngine, CopilotEngine)
}
}

func TestDefaultGitHubTools(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/constants/engine_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const (
CodexEngine EngineName = "codex"
// GeminiEngine is the Google Gemini engine identifier
GeminiEngine EngineName = "gemini"

// DefaultEngine is the default agentic engine used when no engine is explicitly specified.
// Currently defaults to CopilotEngine.
DefaultEngine EngineName = CopilotEngine
)

// AgenticEngines lists all supported agentic engine names.
Expand Down
5 changes: 3 additions & 2 deletions pkg/workflow/agentic_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"sync"

"github.com/github/gh-aw/pkg/constants"
"github.com/github/gh-aw/pkg/logger"
)

Expand Down Expand Up @@ -455,9 +456,9 @@ func (r *EngineRegistry) IsValidEngine(id string) bool {
return exists
}

// GetDefaultEngine returns the default engine (Copilot)
// GetDefaultEngine returns the default engine configured by constants.DefaultEngine
func (r *EngineRegistry) GetDefaultEngine() CodingAgentEngine {
return r.engines["copilot"]
return r.engines[string(constants.DefaultEngine)]
}

// GetEngineByPrefix returns an engine that matches the given prefix
Expand Down
Loading