-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
ai-generatedcookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!debuggingenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersplan
Description
Objective
Add strategic debug logging throughout MCP configuration and compilation to improve troubleshooting. Currently only 35 debug loggers exist across 10,979 LOC (0.3% coverage). Focus on key decision points: mode selection, toolset resolution, validation, and server startup.
Context
From the MCP Server Integration Quality analysis:
- Minimal debug logging makes MCP configuration issues difficult to diagnose
- No debug logging for critical paths: server startup, toolset resolution, mode selection, validation
- Need visibility into configuration decisions for troubleshooting
Approach
- Create loggers following naming convention:
pkg:filename - Add logging at key decision points throughout MCP flow
- Use existing logger package infrastructure
- Enable with
DEBUG=workflow:mcp* gh aw compile
Files to Modify
pkg/workflow/mcp_config_validation.go- Validation decisionspkg/workflow/mcp_github_config.go- Toolset expansionpkg/workflow/mcp_setup_generator.go- Setup generationpkg/workflow/mcp_gateway_config.go- Gateway configurationpkg/workflow/mcp_renderer.go- YAML rendering decisions
Logging Patterns
Create logger:
import "github.com/githubnext/gh-aw/pkg/logger"
var log = logger.New("workflow:mcp_config_validation")Mode selection:
if mcpServer.Mode == "" {
log.Printf("MCP server '%s' missing mode, defaulting to 'remote'", serverName)
mcpServer.Mode = "remote"
} else {
log.Printf("MCP server '%s' using explicit mode: %s", serverName, mcpServer.Mode)
}Toolset resolution:
log.Printf("Resolving GitHub toolsets for server '%s': %v", serverName, toolsets)
if len(toolsets) == 0 {
log.Printf("Empty toolsets, defaulting to [default]")
}
expandedTools := expandToolsets(toolsets)
log.Printf("Expanded to %d tools: %v", len(expandedTools), expandedTools)Validation entry/exit:
log.Printf("Starting MCP configuration validation for %d servers", len(servers))
// ... validation logic ...
log.Printf("Validation complete: %d errors, %d warnings", len(errors), len(warnings))Server setup:
log.Printf("Generating MCP setup for %d servers", len(config.Servers))
for name, server := range config.Servers {
log.Printf("Configuring server '%s': mode=%s, type=%s", name, server.Mode, server.Type)
}Testing
After implementation, test with:
DEBUG=workflow:mcp* ./gh-aw compile test-workflow.mdAcceptance Criteria
- Debug logging added for mode selection logic
- Toolset resolution decisions logged
- Validation entry/exit points logged
- Server configuration steps logged
- Follows logger naming convention (
pkg:filename) - Uses existing logger package infrastructure
- Debug logs can be enabled with
DEBUG=workflow:mcp* gh aw compile -
make agent-finishpasses without errors
Related
- Discussion: 🎯 Repository Quality: MCP Server Integration Quality #11508 (MCP Server Integration Quality)
- Priority: Medium
- Effort: Small
AI generated by Plan Command for discussion #11508
Metadata
Metadata
Assignees
Labels
ai-generatedcookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!debuggingenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersplan