diff --git a/cmd/gh-aw/main_entry_test.go b/cmd/gh-aw/main_entry_test.go index 7d99c5d649c..99cd6964308 100644 --- a/cmd/gh-aw/main_entry_test.go +++ b/cmd/gh-aw/main_entry_test.go @@ -40,6 +40,11 @@ func TestValidateEngine(t *testing.T) { engine: "copilot", expectErr: false, }, + { + name: "valid copilot-sdk engine", + engine: "copilot-sdk", + expectErr: false, + }, { name: "valid custom engine", engine: "custom", @@ -89,7 +94,7 @@ func TestValidateEngine(t *testing.T) { // Check that error message contains the expected format // Error may include "Did you mean" suggestions, so we check if it starts with the base message - expectedMsg := fmt.Sprintf("invalid engine value '%s'. Must be 'claude', 'codex', 'copilot', or 'custom'", tt.engine) + expectedMsg := fmt.Sprintf("invalid engine value '%s'. Must be 'claude', 'codex', 'copilot', 'copilot-sdk', or 'custom'", tt.engine) if tt.errMessage != "" && !strings.HasPrefix(err.Error(), expectedMsg) { t.Errorf("validateEngine(%q) error message = %v, want to start with %v", tt.engine, err.Error(), expectedMsg) } diff --git a/pkg/workflow/imported_steps_validation_test.go b/pkg/workflow/imported_steps_validation_test.go index 5721c28fa6b..c9ee754c0f6 100644 --- a/pkg/workflow/imported_steps_validation_test.go +++ b/pkg/workflow/imported_steps_validation_test.go @@ -60,10 +60,14 @@ This workflow imports a custom engine with agentic secrets. require.Error(t, err, "Expected error in strict mode") if err != nil { - assert.Contains(t, err.Error(), "strict mode", "Error should mention strict mode") - assert.Contains(t, err.Error(), "COPILOT_GITHUB_TOKEN", "Error should mention the secret name") - assert.Contains(t, err.Error(), "GitHub Copilot CLI", "Error should mention the engine") - assert.Contains(t, err.Error(), "custom engine steps", "Error should mention custom engine steps") + errMsg := err.Error() + assert.Contains(t, errMsg, "strict mode", "Error should mention strict mode") + assert.Contains(t, errMsg, "COPILOT_GITHUB_TOKEN", "Error should mention the secret name") + // Check for either Copilot CLI or Copilot SDK (both use COPILOT_GITHUB_TOKEN) + hasCopilotCLI := strings.Contains(errMsg, "GitHub Copilot CLI") + hasCopilotSDK := strings.Contains(errMsg, "GitHub Copilot SDK") + assert.True(t, hasCopilotCLI || hasCopilotSDK, "Error should mention the engine (GitHub Copilot CLI or GitHub Copilot SDK)") + assert.Contains(t, errMsg, "custom engine steps", "Error should mention custom engine steps") } }) @@ -329,10 +333,11 @@ imports: // Should mention both secrets assert.Contains(t, errMsg, "COPILOT_GITHUB_TOKEN") assert.Contains(t, errMsg, "ANTHROPIC_API_KEY") - // Should mention the engines (GitHub Copilot CLI and/or Claude Code) - hasCopilot := strings.Contains(errMsg, "GitHub Copilot CLI") + // Should mention the engines (GitHub Copilot CLI/SDK and/or Claude Code) + hasCopilotCLI := strings.Contains(errMsg, "GitHub Copilot CLI") + hasCopilotSDK := strings.Contains(errMsg, "GitHub Copilot SDK") hasClaude := strings.Contains(errMsg, "Claude Code") - assert.True(t, hasCopilot || hasClaude, "Should mention the engines") + assert.True(t, hasCopilotCLI || hasCopilotSDK || hasClaude, "Should mention the engines") } }