Skip to content
Closed
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
8 changes: 4 additions & 4 deletions pkg/parser/schemas/main_workflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6787,17 +6787,17 @@
"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",
"description": "Extended engine configuration object with advanced options for model selection, turn limiting, environment variables, and custom steps",
"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"],
Expand Down
10 changes: 5 additions & 5 deletions pkg/workflow/agentic_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
}
2 changes: 1 addition & 1 deletion pkg/workflow/engine_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
42 changes: 15 additions & 27 deletions pkg/workflow/max_turns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
}
}