@@ -16,8 +16,11 @@ package workflow
1616
1717import (
1818 "github.com/githubnext/gh-aw/pkg/constants"
19+ "github.com/githubnext/gh-aw/pkg/logger"
1920)
2021
22+ var copilotLog = logger .New ("workflow:copilot_engine" )
23+
2124const logsFolder = "/tmp/gh-aw/sandbox/agent/logs/"
2225
2326// CopilotEngine represents the GitHub Copilot CLI agentic engine.
@@ -28,6 +31,7 @@ type CopilotEngine struct {
2831}
2932
3033func NewCopilotEngine () * CopilotEngine {
34+ copilotLog .Print ("Creating new Copilot engine instance" )
3135 return & CopilotEngine {
3236 BaseEngine : BaseEngine {
3337 id : "copilot" ,
@@ -53,15 +57,18 @@ func (e *CopilotEngine) GetDefaultDetectionModel() string {
5357// GetRequiredSecretNames returns the list of secrets required by the Copilot engine
5458// This includes COPILOT_GITHUB_TOKEN and optionally MCP_GATEWAY_API_KEY
5559func (e * CopilotEngine ) GetRequiredSecretNames (workflowData * WorkflowData ) []string {
60+ copilotLog .Print ("Collecting required secrets for Copilot engine" )
5661 secrets := []string {"COPILOT_GITHUB_TOKEN" }
5762
5863 // Add MCP gateway API key if MCP servers are present (gateway is always started with MCP servers)
5964 if HasMCPServers (workflowData ) {
65+ copilotLog .Print ("Adding MCP_GATEWAY_API_KEY secret" )
6066 secrets = append (secrets , "MCP_GATEWAY_API_KEY" )
6167 }
6268
6369 // Add GitHub token for GitHub MCP server if present
6470 if hasGitHubTool (workflowData .ParsedTools ) {
71+ copilotLog .Print ("Adding GITHUB_MCP_SERVER_TOKEN secret" )
6572 secrets = append (secrets , "GITHUB_MCP_SERVER_TOKEN" )
6673 }
6774
@@ -70,15 +77,22 @@ func (e *CopilotEngine) GetRequiredSecretNames(workflowData *WorkflowData) []str
7077 for varName := range headerSecrets {
7178 secrets = append (secrets , varName )
7279 }
80+ if len (headerSecrets ) > 0 {
81+ copilotLog .Printf ("Added %d HTTP MCP header secrets" , len (headerSecrets ))
82+ }
7383
7484 // Add safe-inputs secret names
7585 if IsSafeInputsEnabled (workflowData .SafeInputs , workflowData ) {
7686 safeInputsSecrets := collectSafeInputsSecrets (workflowData .SafeInputs )
7787 for varName := range safeInputsSecrets {
7888 secrets = append (secrets , varName )
7989 }
90+ if len (safeInputsSecrets ) > 0 {
91+ copilotLog .Printf ("Added %d safe-inputs secrets" , len (safeInputsSecrets ))
92+ }
8093 }
8194
95+ copilotLog .Printf ("Total required secrets: %d" , len (secrets ))
8296 return secrets
8397}
8498
0 commit comments