Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/parser/schedule_time_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func parseTimeToMinutes(hourStr, minuteStr string) int {
// parseTime converts a time string to minute and hour, with optional UTC offset
// Supports formats: HH:MM, midnight, noon, 3pm, 1am, HH:MM utc+N, HH:MM utc+HH:MM, HH:MM utc-N, 3pm utc+9
func parseTime(timeStr string) (minute string, hour string) {
scheduleTimeUtilsLog.Printf("Parsing time string: %q", timeStr)
// Check for UTC offset
parts := strings.Split(timeStr, " ")
var utcOffset int
Expand Down Expand Up @@ -241,5 +242,9 @@ func mapWeekday(day string) string {
"saturday": "6",
"sat": "6",
}
return weekdays[day]
result := weekdays[day]
if result == "" {
scheduleTimeUtilsLog.Printf("Unrecognized weekday name: %q", day)
}
return result
}
7 changes: 7 additions & 0 deletions pkg/parser/schema_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import (
"maps"

"github.com/github/gh-aw/pkg/constants"
"github.com/github/gh-aw/pkg/logger"
)

var schemaValidationLog = logger.New("parser:schema_validation")

// sharedWorkflowForbiddenFields is a map for O(1) lookup of forbidden fields in shared workflows
var sharedWorkflowForbiddenFields = buildForbiddenFieldsMap()

Expand All @@ -21,6 +24,7 @@ func buildForbiddenFieldsMap() map[string]bool {

// validateSharedWorkflowFields checks that a shared workflow doesn't contain forbidden fields
func validateSharedWorkflowFields(frontmatter map[string]any) error {
schemaValidationLog.Printf("Checking shared workflow for forbidden fields: %d fields present", len(frontmatter))
var forbiddenFound []string

for key := range frontmatter {
Expand All @@ -30,6 +34,7 @@ func validateSharedWorkflowFields(frontmatter map[string]any) error {
}

if len(forbiddenFound) > 0 {
schemaValidationLog.Printf("Found %d forbidden field(s) in shared workflow: %v", len(forbiddenFound), forbiddenFound)
if len(forbiddenFound) == 1 {
return fmt.Errorf("field '%s' cannot be used in shared workflows (only allowed in main workflows with 'on' trigger)", forbiddenFound[0])
}
Expand All @@ -52,6 +57,7 @@ func validateSharedWorkflowFields(frontmatter map[string]any) error {

// ValidateMainWorkflowFrontmatterWithSchemaAndLocation validates main workflow frontmatter with file location info
func ValidateMainWorkflowFrontmatterWithSchemaAndLocation(frontmatter map[string]any, filePath string) error {
schemaValidationLog.Printf("Validating main workflow frontmatter: file=%s, fields=%d", filePath, len(frontmatter))
// Filter out ignored fields before validation
filtered := filterIgnoredFields(frontmatter)

Expand All @@ -73,6 +79,7 @@ func ValidateMainWorkflowFrontmatterWithSchemaAndLocation(frontmatter map[string

// ValidateIncludedFileFrontmatterWithSchemaAndLocation validates included file frontmatter with file location info
func ValidateIncludedFileFrontmatterWithSchemaAndLocation(frontmatter map[string]any, filePath string) error {
schemaValidationLog.Printf("Validating included file frontmatter: file=%s, fields=%d", filePath, len(frontmatter))
// Filter out ignored fields before validation
filtered := filterIgnoredFields(frontmatter)

Expand Down
2 changes: 2 additions & 0 deletions pkg/parser/yaml_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func adjustLineNumbersInFormattedError(formatted string, offset int) string {
return formatted
}

yamlErrorLog.Printf("Adjusting YAML error line numbers with offset: +%d", offset)

// Pattern to match line numbers in the format:
// [line:col] at the start
// " 1 | content" in the source context
Expand Down
1 change: 1 addition & 0 deletions pkg/workflow/copilot_mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (e *CopilotEngine) renderCopilotMCPConfigWithContext(yaml *strings.Builder,
// Determine if localhost URLs should be rewritten to host.docker.internal
// This is needed when firewall is enabled (agent is not disabled)
rewriteLocalhost := shouldRewriteLocalhostToDocker(workflowData)
copilotMCPLog.Printf("Localhost URL rewriting for tool %s: enabled=%t", toolName, rewriteLocalhost)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new log line at line 91 redundantly includes toolName in the format string ("Localhost URL rewriting for tool %s: enabled=%t"), even though toolName was already logged on the immediately preceding line 86 ("Rendering custom MCP config for tool: %s"). Since both log lines are always executed together, repeating toolName adds noise to the log output. The new line should convey only the new information — i.e., whether localhost URL rewriting is enabled — without repeating the tool name that is already in context from the previous log message.

Suggested change
copilotMCPLog.Printf("Localhost URL rewriting for tool %s: enabled=%t", toolName, rewriteLocalhost)
copilotMCPLog.Printf("Localhost URL rewriting: enabled=%t", rewriteLocalhost)

Copilot uses AI. Check for mistakes.

// Use the shared renderer with copilot-specific requirements
renderer := MCPConfigRenderer{
Expand Down
2 changes: 2 additions & 0 deletions pkg/workflow/mcp_config_playwright_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ func renderPlaywrightMCPConfig(yaml *strings.Builder, playwrightConfig *Playwrig
// Per MCP Gateway Specification v1.0.0 section 3.2.1, stdio-based MCP servers MUST be containerized.
// Uses MCP Gateway spec format: container, entrypointArgs, mounts, and args fields.
func renderPlaywrightMCPConfigWithOptions(yaml *strings.Builder, playwrightConfig *PlaywrightToolConfig, isLast bool, includeCopilotFields bool, inlineArgs bool) {
mcpPlaywrightLog.Printf("Rendering Playwright MCP config options: copilot_fields=%t, inline_args=%t", includeCopilotFields, inlineArgs)
customArgs := getPlaywrightCustomArgs(playwrightConfig)

// Extract all expressions from playwright arguments and replace them with env var references
expressions := extractExpressionsFromPlaywrightArgs(customArgs)

// Replace expressions in custom args
if len(customArgs) > 0 {
mcpPlaywrightLog.Printf("Applying %d custom Playwright args with %d extracted expressions", len(customArgs), len(expressions))
customArgs = replaceExpressionsInPlaywrightArgs(customArgs, expressions)
}

Expand Down
Loading