From 7bd0f9a33b7caccd30ae636788f1dc048978d3f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Jul 2026 07:10:17 +0000 Subject: [PATCH 1/2] Initial plan From 401596a78953ac81f3e30fb4ab1a9c62daa4fd51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Jul 2026 07:20:53 +0000 Subject: [PATCH 2/2] refactor: extract extractEngineMCPSettings helper to reduce extractEngineConfig length Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/parser/import_field_extractor.go | 38 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/pkg/parser/import_field_extractor.go b/pkg/parser/import_field_extractor.go index 9dee5fb6353..ee52fde4770 100644 --- a/pkg/parser/import_field_extractor.go +++ b/pkg/parser/import_field_extractor.go @@ -321,22 +321,7 @@ func (acc *importAccumulator) extractEngineConfig(fm map[string]any, fullPath st // Object engine — extract engine.mcp.* settings first, then decide // whether to add to engines based on whether an engine ID is present. if mcpVal, hasMCP := v["mcp"]; hasMCP { - if mcpMap, ok := mcpVal.(map[string]any); ok { - // Extract tool-timeout (first-wins across all imports) - if acc.mergedEngineMCPToolTimeout == "" { - if ttStr, ok := mcpMap["tool-timeout"].(string); ok && ttStr != "" { - acc.mergedEngineMCPToolTimeout = ttStr - parserLog.Printf("Extracted engine.mcp.tool-timeout from import %s: %s", fullPath, ttStr) - } - } - // Extract session-timeout (first-wins across all imports) - if acc.mergedEngineMCPSessionTimeout == "" { - if stStr, ok := mcpMap["session-timeout"].(string); ok && stStr != "" { - acc.mergedEngineMCPSessionTimeout = stStr - parserLog.Printf("Extracted engine.mcp.session-timeout from import %s: %s", fullPath, stStr) - } - } - } + acc.extractEngineMCPSettings(mcpVal, fullPath) } // Only add to engines list if this config specifies an actual engine // (i.e. it carries an 'id' or 'runtime' field). Configs with only @@ -367,6 +352,27 @@ func (acc *importAccumulator) extractEngineConfig(fm map[string]any, fullPath st } } +// extractEngineMCPSettings extracts engine.mcp.tool-timeout and engine.mcp.session-timeout +// from mcpVal (first-wins across all imports). +func (acc *importAccumulator) extractEngineMCPSettings(mcpVal any, fullPath string) { + mcpMap, ok := mcpVal.(map[string]any) + if !ok { + return + } + if acc.mergedEngineMCPToolTimeout == "" { + if ttStr, ok := mcpMap["tool-timeout"].(string); ok && ttStr != "" { + acc.mergedEngineMCPToolTimeout = ttStr + parserLog.Printf("Extracted engine.mcp.tool-timeout from import %s: %s", fullPath, ttStr) + } + } + if acc.mergedEngineMCPSessionTimeout == "" { + if stStr, ok := mcpMap["session-timeout"].(string); ok && stStr != "" { + acc.mergedEngineMCPSessionTimeout = stStr + parserLog.Printf("Extracted engine.mcp.session-timeout from import %s: %s", fullPath, stStr) + } + } +} + // extractConfigFields extracts scalar and builder-based configuration fields from the // frontmatter map and writes them into the appropriate accumulator builders and slices. //