From 8d1ca0dda82a9cc7c3164605acb4d3fbce7f214a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 31 Dec 2025 06:31:31 +0000 Subject: [PATCH] Add debug logging to runtime setup, repo-memory, run command, MCP server, and gateway MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced 5 Go files with meaningful debug logging statements following the project's logging guidelines. All files already had logger declarations, so this focuses on adding strategic logging calls to improve troubleshooting. Files enhanced: - pkg/workflow/runtime_setup.go: Runtime requirement and UV/Python detection - pkg/workflow/repo_memory.go: Configuration parsing (nil/boolean/object) - pkg/cli/run_command.go: Workflow enable/disable and lock file operations - pkg/cli/mcp_server.go: MCP tool execution (status and compile) - pkg/workflow/gateway.go: Gateway configuration logging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- pkg/cli/mcp_server.go | 3 +++ pkg/cli/run_command.go | 6 ++++++ pkg/workflow/gateway.go | 3 ++- pkg/workflow/repo_memory.go | 5 +++++ pkg/workflow/runtime_setup.go | 2 ++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pkg/cli/mcp_server.go b/pkg/cli/mcp_server.go index 89a150ac53..ed798f621e 100644 --- a/pkg/cli/mcp_server.go +++ b/pkg/cli/mcp_server.go @@ -171,6 +171,7 @@ Note: Output can be filtered using the jq parameter.`, cmdArgs = append(cmdArgs, args.Pattern) } + mcpLog.Printf("Executing status tool: pattern=%s, jqFilter=%s", args.Pattern, args.JqFilter) // Execute the CLI command cmd := execCmd(ctx, cmdArgs...) output, err := cmd.CombinedOutput() @@ -308,6 +309,8 @@ Note: Output can be filtered using the jq parameter.`, cmdArgs = append(cmdArgs, args.Workflows...) + mcpLog.Printf("Executing compile tool: workflows=%v, strict=%v, fix=%v, zizmor=%v, poutine=%v, actionlint=%v", + args.Workflows, args.Strict, args.Fix, args.Zizmor, args.Poutine, args.Actionlint) // Execute the CLI command cmd := execCmd(ctx, cmdArgs...) output, err := cmd.CombinedOutput() diff --git a/pkg/cli/run_command.go b/pkg/cli/run_command.go index c28ede759f..02e13ef902 100644 --- a/pkg/cli/run_command.go +++ b/pkg/cli/run_command.go @@ -120,6 +120,7 @@ func RunWorkflowOnGitHub(workflowIdOrName string, enable bool, engineOverride st workflowID = wf.ID if wf.State == "disabled_manually" { wasDisabled = true + runLog.Printf("Workflow %s is disabled, temporarily enabling for this run (id=%d)", workflowIdOrName, wf.ID) if verbose { fmt.Println(console.FormatInfoMessage(fmt.Sprintf("Workflow '%s' is disabled, enabling it temporarily...", workflowIdOrName))) } @@ -130,9 +131,12 @@ func RunWorkflowOnGitHub(workflowIdOrName string, enable bool, engineOverride st } cmd := workflow.ExecGH(enableArgs...) if err := cmd.Run(); err != nil { + runLog.Printf("Failed to enable workflow %s: %v", workflowIdOrName, err) return fmt.Errorf("failed to enable workflow '%s': %w", workflowIdOrName, err) } fmt.Println(console.FormatSuccessMessage(fmt.Sprintf("Enabled workflow: %s", workflowIdOrName))) + } else { + runLog.Printf("Workflow %s is already enabled (state=%s)", workflowIdOrName, wf.State) } } } @@ -161,6 +165,7 @@ func RunWorkflowOnGitHub(workflowIdOrName string, enable bool, engineOverride st // Check if the lock file exists in .github/workflows lockFilePath = filepath.Join(".github/workflows", lockFileName) if _, err := os.Stat(lockFilePath); os.IsNotExist(err) { + runLog.Printf("Lock file not found: %s (workflow must be compiled first)", lockFilePath) suggestions := []string{ fmt.Sprintf("Run '%s compile' to compile all workflows", string(constants.CLIExtensionPrefix)), fmt.Sprintf("Run '%s compile %s' to compile this specific workflow", string(constants.CLIExtensionPrefix), filename), @@ -170,6 +175,7 @@ func RunWorkflowOnGitHub(workflowIdOrName string, enable bool, engineOverride st suggestions, )) } + runLog.Printf("Found lock file: %s", lockFilePath) } // Recompile workflow if engine override is provided (only for local workflows) diff --git a/pkg/workflow/gateway.go b/pkg/workflow/gateway.go index a634ae3051..f42f272926 100644 --- a/pkg/workflow/gateway.go +++ b/pkg/workflow/gateway.go @@ -54,7 +54,8 @@ func generateMCPGatewaySteps(workflowData *WorkflowData, mcpServersConfig map[st return nil } - gatewayLog.Print("Generating MCP gateway steps") + gatewayLog.Printf("Generating MCP gateway steps: port=%d, container=%s, command=%s, servers=%d", + config.Port, config.Container, config.Command, len(mcpServersConfig)) var steps []GitHubActionStep diff --git a/pkg/workflow/repo_memory.go b/pkg/workflow/repo_memory.go index 14fb327112..fc9986d813 100644 --- a/pkg/workflow/repo_memory.go +++ b/pkg/workflow/repo_memory.go @@ -70,6 +70,7 @@ func (c *Compiler) extractRepoMemoryConfig(toolsConfig *ToolsConfig) (*RepoMemor // Handle nil value (simple enable with defaults) - same as true if repoMemoryValue == nil { + repoMemoryLog.Print("Using default repo-memory configuration (nil value)") config.Memories = []RepoMemoryEntry{ { ID: "default", @@ -85,6 +86,7 @@ func (c *Compiler) extractRepoMemoryConfig(toolsConfig *ToolsConfig) (*RepoMemor // Handle boolean value (simple enable/disable) if boolValue, ok := repoMemoryValue.(bool); ok { if boolValue { + repoMemoryLog.Print("Using default repo-memory configuration (boolean true)") // Create a single default memory entry config.Memories = []RepoMemoryEntry{ { @@ -95,6 +97,8 @@ func (c *Compiler) extractRepoMemoryConfig(toolsConfig *ToolsConfig) (*RepoMemor CreateOrphan: true, }, } + } else { + repoMemoryLog.Print("Repo-memory disabled (boolean false)") } // If false, return empty config (empty array means disabled) return config, nil @@ -215,6 +219,7 @@ func (c *Compiler) extractRepoMemoryConfig(toolsConfig *ToolsConfig) (*RepoMemor // Handle object configuration (single memory, backward compatible) // Convert to array with single entry if configMap, ok := repoMemoryValue.(map[string]any); ok { + repoMemoryLog.Print("Processing object-style repo-memory configuration (backward compatible)") entry := RepoMemoryEntry{ ID: "default", BranchName: generateDefaultBranchName("default"), diff --git a/pkg/workflow/runtime_setup.go b/pkg/workflow/runtime_setup.go index c5dc00da2c..41bd2303e4 100644 --- a/pkg/workflow/runtime_setup.go +++ b/pkg/workflow/runtime_setup.go @@ -194,6 +194,7 @@ func DetectRuntimeRequirements(workflowData *WorkflowData) []RuntimeRequirement // Add Python as dependency when uv is detected (uv requires Python) if _, hasUV := requirements["uv"]; hasUV { if _, hasPython := requirements["python"]; !hasPython { + runtimeSetupLog.Print("UV detected without Python, automatically adding Python runtime") pythonRuntime := findRuntimeByID("python") if pythonRuntime != nil { updateRequiredRuntime(pythonRuntime, "", requirements) @@ -405,6 +406,7 @@ func updateRequiredRuntime(runtime *Runtime, newVersion string, requirements map existing, exists := requirements[runtime.ID] if !exists { + runtimeSetupLog.Printf("Adding new runtime requirement: %s (version=%s)", runtime.ID, newVersion) requirements[runtime.ID] = &RuntimeRequirement{ Runtime: runtime, Version: newVersion,