diff --git a/pkg/cli/add_workflow_resolution.go b/pkg/cli/add_workflow_resolution.go index f5b45ad0efe..fc35cdd060f 100644 --- a/pkg/cli/add_workflow_resolution.go +++ b/pkg/cli/add_workflow_resolution.go @@ -79,6 +79,7 @@ func ResolveWorkflows(workflows []string, verbose bool) (*ResolvedWorkflows, err // Skip this check if we can't determine the current repository (e.g., not in a git repo) currentRepoSlug, repoErr := GetCurrentRepoSlug() if repoErr == nil { + resolutionLog.Printf("Current repository: %s", currentRepoSlug) // We successfully determined the current repository, check all workflow specs for _, spec := range parsedSpecs { // Skip local workflow specs @@ -90,6 +91,8 @@ func ResolveWorkflows(workflows []string, verbose bool) (*ResolvedWorkflows, err return nil, fmt.Errorf("cannot add workflows from the current repository (%s). The 'add' command is for installing workflows from other repositories", currentRepoSlug) } } + } else { + resolutionLog.Printf("Could not determine current repository: %v", repoErr) } // If we can't determine the current repository, proceed without the check @@ -140,6 +143,9 @@ func ResolveWorkflows(workflows []string, verbose bool) (*ResolvedWorkflows, err hasWorkflowDispatch = true } + resolutionLog.Printf("Resolved workflow: spec=%s, engine=%s, has_dispatch=%t, content_size=%d bytes", + spec.String(), engine, workflowHasDispatch, len(fetched.Content)) + resolvedWorkflows = append(resolvedWorkflows, &ResolvedWorkflow{ Spec: spec, Content: fetched.Content, @@ -151,6 +157,9 @@ func ResolveWorkflows(workflows []string, verbose bool) (*ResolvedWorkflows, err }) } + resolutionLog.Printf("Resolution complete: resolved=%d workflows, has_wildcard=%t, has_dispatch=%t", + len(resolvedWorkflows), hasWildcard, hasWorkflowDispatch) + return &ResolvedWorkflows{ Workflows: resolvedWorkflows, HasWildcard: hasWildcard, diff --git a/pkg/cli/mcp_inspect.go b/pkg/cli/mcp_inspect.go index a468121319d..86a9be13ff3 100644 --- a/pkg/cli/mcp_inspect.go +++ b/pkg/cli/mcp_inspect.go @@ -66,6 +66,9 @@ func InspectWorkflowMCP(workflowFile string, serverFilter string, toolFilter str return fmt.Errorf("failed to parse workflow file: %w", err) } + mcpInspectLog.Printf("Workflow parsed: name=%s, has_safe_inputs=%t", + workflowData.Name, workflowData.SafeInputs != nil) + if verbose { fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Workflow parsed successfully")) } @@ -82,24 +85,30 @@ func InspectWorkflowMCP(workflowFile string, serverFilter string, toolFilter str return fmt.Errorf("failed to extract MCP configurations: %w", err) } + mcpInspectLog.Printf("Extracted %d MCP configs (server_filter=%q)", len(mcpConfigs), serverFilter) + // Filter out safe-outputs MCP servers for inspection mcpConfigs = filterOutSafeOutputs(mcpConfigs) + mcpInspectLog.Printf("After filtering safe-outputs: %d MCP configs remain", len(mcpConfigs)) // Start safe-inputs server if present var safeInputsServerCmd *exec.Cmd var safeInputsTmpDir string if workflowData != nil && workflowData.SafeInputs != nil && len(workflowData.SafeInputs.Tools) > 0 { + mcpInspectLog.Printf("Starting safe-inputs server: tools=%d", len(workflowData.SafeInputs.Tools)) // Start safe-inputs server and add it to the list of MCP configs config, serverCmd, tmpDir, err := startSafeInputsServer(workflowData.SafeInputs, verbose) if err != nil { if verbose { fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to start safe-inputs server: %v", err))) } + mcpInspectLog.Printf("Failed to start safe-inputs server: %v", err) } else { safeInputsServerCmd = serverCmd safeInputsTmpDir = tmpDir // Add safe-inputs config to the list of MCP servers to inspect mcpConfigs = append(mcpConfigs, *config) + mcpInspectLog.Print("Safe-inputs server started successfully") } } diff --git a/pkg/cli/mcp_list_tools.go b/pkg/cli/mcp_list_tools.go index 4c85f8e2988..d2281f80c6f 100644 --- a/pkg/cli/mcp_list_tools.go +++ b/pkg/cli/mcp_list_tools.go @@ -56,6 +56,8 @@ func ListToolsForMCP(workflowFile string, mcpServerName string, verbose bool) er return err } + mcpListToolsLog.Printf("Found %d MCP configs in workflow, searching for server: %s", len(mcpConfigs), mcpServerName) + // Find the specific MCP server var targetConfig *parser.MCPServerConfig for _, config := range mcpConfigs { @@ -66,6 +68,7 @@ func ListToolsForMCP(workflowFile string, mcpServerName string, verbose bool) er } if targetConfig == nil { + mcpListToolsLog.Printf("MCP server %q not found in workflow %q", mcpServerName, filepath.Base(workflowPath)) fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("MCP server '%s' not found in workflow '%s'", mcpServerName, filepath.Base(workflowPath)))) // Show available servers @@ -77,6 +80,8 @@ func ListToolsForMCP(workflowFile string, mcpServerName string, verbose bool) er return nil } + mcpListToolsLog.Printf("Found MCP server: name=%s, type=%s", targetConfig.Name, targetConfig.Type) + // Connect to the MCP server and get its tools fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("📡 Connecting to MCP server: %s (%s)", targetConfig.Name, @@ -87,6 +92,8 @@ func ListToolsForMCP(workflowFile string, mcpServerName string, verbose bool) er return fmt.Errorf("failed to connect to MCP server '%s': %w", mcpServerName, err) } + mcpListToolsLog.Printf("Connected to MCP server: tools=%d", len(info.Tools)) + if verbose { fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Successfully connected to MCP server")) } diff --git a/pkg/workflow/compiler_workflow_call.go b/pkg/workflow/compiler_workflow_call.go index 7c727c0cba6..e9c047d675d 100644 --- a/pkg/workflow/compiler_workflow_call.go +++ b/pkg/workflow/compiler_workflow_call.go @@ -32,12 +32,17 @@ func (c *Compiler) injectWorkflowCallOutputs(onSection string, safeOutputs *Safe return onSection } + workflowCallLog.Print("Injecting workflow_call outputs for safe-output results") + // Build the auto-generated outputs map based on configured safe output types generatedOutputs := buildWorkflowCallOutputsMap(safeOutputs) if len(generatedOutputs) == 0 { + workflowCallLog.Print("No workflow_call outputs to inject (no safe-output types configured)") return onSection } + workflowCallLog.Printf("Generated %d workflow_call outputs to inject", len(generatedOutputs)) + // Parse the on section YAML var onData map[string]any if err := yaml.Unmarshal([]byte(onSection), &onData); err != nil { @@ -87,6 +92,7 @@ func (c *Compiler) injectWorkflowCallOutputs(onSection string, safeOutputs *Safe } } + workflowCallLog.Printf("Merged workflow_call outputs: total=%d", len(mergedOutputs)) workflowCallMap["outputs"] = mergedOutputs onMap["workflow_call"] = workflowCallMap @@ -104,6 +110,12 @@ func (c *Compiler) injectWorkflowCallOutputs(onSection string, safeOutputs *Safe // buildWorkflowCallOutputsMap constructs the outputs map for on.workflow_call.outputs // based on which safe output types are configured. func buildWorkflowCallOutputsMap(safeOutputs *SafeOutputsConfig) map[string]workflowCallOutputEntry { + workflowCallLog.Printf("Building workflow_call outputs map: create_issues=%t, create_prs=%t, add_comments=%t, push_to_pr=%t", + safeOutputs.CreateIssues != nil, + safeOutputs.CreatePullRequests != nil, + safeOutputs.AddComments != nil, + safeOutputs.PushToPullRequestBranch != nil) + outputs := make(map[string]workflowCallOutputEntry) if safeOutputs.CreateIssues != nil { diff --git a/pkg/workflow/repo_memory_prompt.go b/pkg/workflow/repo_memory_prompt.go index 088d9dcc7d4..c3c3b5056d0 100644 --- a/pkg/workflow/repo_memory_prompt.go +++ b/pkg/workflow/repo_memory_prompt.go @@ -61,12 +61,16 @@ func buildRepoMemoryPromptSection(config *RepoMemoryConfig) *PromptSection { // Build wiki note text (non-empty only when wiki mode is enabled) wikiNoteText := "" if memory.Wiki { + repoMemoryPromptLog.Print("Wiki mode enabled for repo memory") wikiNoteText = "\n\n> **GitHub Wiki**: This memory is backed by the GitHub Wiki for this repository. " + "Files use GitHub Wiki Markdown syntax. Follow GitHub Wiki conventions when creating or editing pages " + "(e.g., use standard Markdown headers, use `[[Page Name]]` syntax for internal wiki links, " + "name page files with spaces replaced by hyphens or use the wiki page title as the filename)." } + repoMemoryPromptLog.Printf("Built single repo memory prompt section: branch=%s, has_constraints=%t, wiki=%t", + memory.BranchName, len(constraintsText) > 2, memory.Wiki) + return &PromptSection{ Content: repoMemoryPromptFile, IsFile: true, @@ -123,6 +127,7 @@ func buildRepoMemoryPromptSection(config *RepoMemoryConfig) *PromptSection { // If not all the same, build a union of all extensions if !allSame { + repoMemoryPromptLog.Print("Memories have different allowed extensions, building union set") extensionSet := make(map[string]bool) for _, mem := range config.Memories { for _, ext := range mem.AllowedExtensions { @@ -138,6 +143,9 @@ func buildRepoMemoryPromptSection(config *RepoMemoryConfig) *PromptSection { allowedExtsText = strings.Join(allExtensions, "`, `") } + repoMemoryPromptLog.Printf("Built multi repo memory prompt section: memories=%d, extensions=%q, all_same_exts=%t", + len(config.Memories), allowedExtsText, allSame) + return &PromptSection{ Content: repoMemoryPromptMultiFile, IsFile: true,