diff --git a/pkg/parser/schemas/main_workflow_schema.json b/pkg/parser/schemas/main_workflow_schema.json index b347303a7e..359f5df38c 100644 --- a/pkg/parser/schemas/main_workflow_schema.json +++ b/pkg/parser/schemas/main_workflow_schema.json @@ -6787,8 +6787,8 @@ "oneOf": [ { "type": "string", - "enum": ["claude", "codex", "copilot"], - "description": "Simple engine name: 'claude' (default, Claude Code), 'copilot' (GitHub Copilot CLI), or 'codex' (OpenAI Codex CLI)" + "enum": ["claude", "codex", "copilot", "custom"], + "description": "Simple engine name: 'claude' (default, Claude Code), 'copilot' (GitHub Copilot CLI), 'codex' (OpenAI Codex CLI), or 'custom' (bring your own AI provider)" }, { "type": "object", @@ -6796,8 +6796,8 @@ "properties": { "id": { "type": "string", - "enum": ["claude", "codex", "copilot"], - "description": "AI engine identifier: 'claude' (Claude Code), 'codex' (OpenAI Codex CLI), or 'copilot' (GitHub Copilot CLI)" + "enum": ["claude", "codex", "copilot", "custom"], + "description": "AI engine identifier: 'claude' (Claude Code), 'codex' (OpenAI Codex CLI), 'copilot' (GitHub Copilot CLI), or 'custom' (bring your own AI provider)" }, "version": { "type": ["string", "number"], diff --git a/pkg/workflow/agentic_engine_test.go b/pkg/workflow/agentic_engine_test.go index 46f80b3252..225a900801 100644 --- a/pkg/workflow/agentic_engine_test.go +++ b/pkg/workflow/agentic_engine_test.go @@ -11,8 +11,8 @@ func TestEngineRegistry(t *testing.T) { // Test that built-in engines are registered supportedEngines := registry.GetSupportedEngines() - if len(supportedEngines) != 3 { - t.Errorf("Expected 3 supported engines, got %d", len(supportedEngines)) + if len(supportedEngines) != 4 { + t.Errorf("Expected 4 supported engines, got %d", len(supportedEngines)) } // Test getting engines by ID @@ -104,9 +104,9 @@ func TestEngineRegistryCustomEngine(t *testing.T) { t.Error("Expected test-custom engine to be experimental") } - // Test that supported engines list is updated (3 built-in + 1 custom = 4) + // Test that supported engines list is updated (4 built-in + 1 custom = 5) supportedEngines := registry.GetSupportedEngines() - if len(supportedEngines) != 4 { - t.Errorf("Expected 4 supported engines after adding test-custom, got %d", len(supportedEngines)) + if len(supportedEngines) != 5 { + t.Errorf("Expected 5 supported engines after adding test-custom, got %d", len(supportedEngines)) } } diff --git a/pkg/workflow/engine_helpers.go b/pkg/workflow/engine_helpers.go index 4e9e38438e..1f216d528d 100644 --- a/pkg/workflow/engine_helpers.go +++ b/pkg/workflow/engine_helpers.go @@ -214,7 +214,7 @@ func InjectCustomEngineSteps( workflowData *WorkflowData, convertStepFunc func(map[string]any) (string, error), ) []GitHubActionStep { - var steps []GitHubActionStep + steps := []GitHubActionStep{} // Handle custom steps if they exist in engine config if workflowData.EngineConfig != nil && len(workflowData.EngineConfig.Steps) > 0 { diff --git a/pkg/workflow/max_turns_test.go b/pkg/workflow/max_turns_test.go index 4b313ab6d9..82012bc3fe 100644 --- a/pkg/workflow/max_turns_test.go +++ b/pkg/workflow/max_turns_test.go @@ -273,7 +273,7 @@ engine: # Custom Engine with Max Turns -This tests max-turns feature with custom engine.` +This tests that max-turns is rejected with custom engine.` // Create a temporary directory for the test tmpDir := testutil.TempDir(t, "custom-max-turns-test") @@ -284,34 +284,22 @@ This tests max-turns feature with custom engine.` t.Fatal(err) } - // Compile the workflow + // Compile the workflow - should fail because custom engine doesn't support max-turns compiler := NewCompiler() - if err := compiler.CompileWorkflow(testFile); err != nil { - t.Fatalf("Failed to compile workflow with custom engine and max-turns: %v", err) + err := compiler.CompileWorkflow(testFile) + + // Expect an error about max-turns not being supported + if err == nil { + t.Fatal("Expected compilation to fail with max-turns error, but it succeeded") } - - // Read the generated lock file - lockFile := stringutil.MarkdownToLockFile(testFile) - lockContent, err := os.ReadFile(lockFile) - if err != nil { - t.Fatalf("Failed to read lock file: %v", err) - } - - lockContentStr := string(lockContent) - - // Verify GH_AW_MAX_TURNS environment variable is set - expectedEnvVar := "GH_AW_MAX_TURNS: \"5\"" - if !strings.Contains(lockContentStr, expectedEnvVar) { - t.Errorf("Expected GH_AW_MAX_TURNS environment variable to be set. Expected: %s\nActual content:\n%s", expectedEnvVar, lockContentStr) + + // Verify the error message mentions max-turns not being supported + if !strings.Contains(err.Error(), "max-turns not supported") { + t.Errorf("Expected error about max-turns not supported, got: %v", err) } - - // Verify MCP config is generated for custom engine - if !strings.Contains(lockContentStr, "/tmp/gh-aw/mcp-config/mcp-servers.json") { - t.Error("Expected custom engine to generate MCP configuration file") - } - - // Verify custom steps are included - if !strings.Contains(lockContentStr, "echo \"Testing max-turns with custom engine\"") { - t.Error("Expected custom steps to be included in generated workflow") + + // Verify the error message mentions the custom engine + if !strings.Contains(err.Error(), "custom") { + t.Errorf("Expected error to mention 'custom' engine, got: %v", err) } }