diff --git a/pkg/parser/include_expander.go b/pkg/parser/include_expander.go index 76a8d9b2932..8039463a863 100644 --- a/pkg/parser/include_expander.go +++ b/pkg/parser/include_expander.go @@ -233,10 +233,6 @@ func expandIncludesForField(content, baseDir string, extractFunc func(string) (s return results, nil } -// ProcessIncludesForEngines processes import directives to extract engine configurations - -// ProcessIncludesForSafeOutputs processes import directives to extract safe-outputs configurations - // processIncludesForField processes import directives to extract a specific frontmatter field func processIncludesForField(content, baseDir string, extractFunc func(string) (string, error), emptyValue string) ([]string, string, error) { scanner := bufio.NewScanner(strings.NewReader(content)) diff --git a/pkg/parser/include_processor.go b/pkg/parser/include_processor.go index 10d9d881ee3..e6e86099e79 100644 --- a/pkg/parser/include_processor.go +++ b/pkg/parser/include_processor.go @@ -16,9 +16,6 @@ import ( var includeLog = logger.New("parser:include_processor") -// ProcessIncludes processes @include, @import (deprecated), and {{#import: directives in markdown content -// This matches the bash process_includes function behavior - // processIncludesWithVisited processes import directives with cycle detection func processIncludesWithVisited(content, baseDir string, extractTools bool, visited map[string]bool) (string, error) { scanner := bufio.NewScanner(strings.NewReader(content)) diff --git a/pkg/workflow/compiler_orchestrator_tools.go b/pkg/workflow/compiler_orchestrator_tools.go index c2703e7e81b..63ec47f4b54 100644 --- a/pkg/workflow/compiler_orchestrator_tools.go +++ b/pkg/workflow/compiler_orchestrator_tools.go @@ -90,14 +90,14 @@ func (c *Compiler) processToolsAndMarkdown(result *parser.FrontmatterResult, cle } // Combine imported tools with included tools - var allIncludedTools string - if importsResult.MergedTools != "" && includedTools != "" { - allIncludedTools = importsResult.MergedTools + "\n" + includedTools - } else if importsResult.MergedTools != "" { - allIncludedTools = importsResult.MergedTools - } else { - allIncludedTools = includedTools + var toolsParts []string + if importsResult.MergedTools != "" { + toolsParts = append(toolsParts, importsResult.MergedTools) + } + if includedTools != "" { + toolsParts = append(toolsParts, includedTools) } + allIncludedTools := strings.Join(toolsParts, "\n") // Combine imported mcp-servers with top-level mcp-servers // Imported mcp-servers are in JSON format (newline-separated), need to merge them @@ -122,19 +122,13 @@ func (c *Compiler) processToolsAndMarkdown(result *parser.FrontmatterResult, cle } // Check if GitHub tool was explicitly configured in the original frontmatter - // This is needed to determine if permissions validation should be skipped - hasExplicitGitHubTool := false - if tools != nil { - if _, exists := tools["github"]; exists { - // GitHub tool exists in merged tools - check if it was explicitly configured - // by looking at the original frontmatter before any merging - if topTools != nil { - if _, existsInTop := topTools["github"]; existsInTop { - hasExplicitGitHubTool = true - orchestratorToolsLog.Print("GitHub tool was explicitly configured in frontmatter") - } - } - } + // This is needed to determine if permissions validation should be skipped. + // In Go, reading from a nil map returns zero-value, so these are nil-safe. + _, inMergedTools := tools["github"] + _, inTopTools := topTools["github"] + hasExplicitGitHubTool := inMergedTools && inTopTools + if hasExplicitGitHubTool { + orchestratorToolsLog.Print("GitHub tool was explicitly configured in frontmatter") } orchestratorToolsLog.Printf("hasExplicitGitHubTool: %v", hasExplicitGitHubTool)