From a9c4f37bf33823950ca5aaafcfecc430ea0de70a Mon Sep 17 00:00:00 2001 From: gh-aw bot Date: Tue, 3 Mar 2026 20:33:40 +0000 Subject: [PATCH 1/2] Add debug logging to 5 pkg/ files for better troubleshooting - workflow/agent_validation: log max-turns, max-continuations, and web-search feature validation with engine ID and config details - workflow/compiler_safe_outputs_core: log custom-token detection and base config collection results (logger was declared but unused) - cli/trial_repository: log repository lifecycle operations including cleanup, clone, write, modify, and commit/push steps - cli/generate_action_metadata_command: log file processing loop progress and per-action yml/README generation - parser/import_field_extractor: log field extraction entry with content size, engine config detection, and final result summary Co-Authored-By: Claude Sonnet 4.6 --- pkg/cli/generate_action_metadata_command.go | 6 ++++++ pkg/cli/trial_repository.go | 9 +++++++++ pkg/parser/import_field_extractor.go | 4 ++++ pkg/workflow/agent_validation.go | 9 +++++++++ pkg/workflow/compiler_safe_outputs_core.go | 5 +++++ 5 files changed, 33 insertions(+) diff --git a/pkg/cli/generate_action_metadata_command.go b/pkg/cli/generate_action_metadata_command.go index b9b0fadde9f..a119adcf894 100644 --- a/pkg/cli/generate_action_metadata_command.go +++ b/pkg/cli/generate_action_metadata_command.go @@ -59,12 +59,15 @@ func GenerateActionMetadataCommand() error { fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("🔍 Generating actions for %d JavaScript modules...", len(targetFiles)))) generatedCount := 0 + generateActionMetadataLog.Printf("Processing %d target JavaScript files in %s", len(targetFiles), jsDir) for _, filename := range targetFiles { jsPath := filepath.Join(jsDir, filename) + generateActionMetadataLog.Printf("Processing file: %s", filename) // Read file content directly from filesystem contentBytes, err := os.ReadFile(jsPath) if err != nil { + generateActionMetadataLog.Printf("Skipping %s: failed to read file: %v", filename, err) fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("⚠ Skipping %s: %s", filename, err.Error()))) continue } @@ -115,6 +118,7 @@ func GenerateActionMetadataCommand() error { generatedCount++ } + generateActionMetadataLog.Printf("Action metadata generation complete: generated=%d, total=%d", generatedCount, len(targetFiles)) if generatedCount == 0 { return errors.New("no actions were generated") } @@ -282,6 +286,7 @@ func extractDependencies(content string) []string { // generateActionYml generates an action.yml file func generateActionYml(actionDir string, metadata *ActionMetadata) error { + generateActionMetadataLog.Printf("Generating action.yml: action=%s, inputs=%d, outputs=%d", metadata.ActionName, len(metadata.Inputs), len(metadata.Outputs)) var content strings.Builder fmt.Fprintf(&content, "name: '%s'\n", metadata.Name) @@ -333,6 +338,7 @@ func generateActionYml(actionDir string, metadata *ActionMetadata) error { // generateReadme generates a README.md file func generateReadme(actionDir string, metadata *ActionMetadata) error { + generateActionMetadataLog.Printf("Generating README.md: action=%s, deps=%d", metadata.ActionName, len(metadata.Dependencies)) var content strings.Builder fmt.Fprintf(&content, "# %s\n\n", metadata.Name) diff --git a/pkg/cli/trial_repository.go b/pkg/cli/trial_repository.go index 368253993f1..daf018608b0 100644 --- a/pkg/cli/trial_repository.go +++ b/pkg/cli/trial_repository.go @@ -153,6 +153,7 @@ func ensureTrialRepository(repoSlug string, cloneRepoSlug string, forceDeleteHos } func cleanupTrialRepository(repoSlug string, verbose bool) error { + trialRepoLog.Printf("Cleaning up trial repository: %s", repoSlug) if verbose { fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Cleaning up host repository: "+repoSlug)) } @@ -161,9 +162,11 @@ func cleanupTrialRepository(repoSlug string, verbose bool) error { output, err := workflow.RunGHCombined("Deleting repository...", "repo", "delete", repoSlug, "--yes") if err != nil { + trialRepoLog.Printf("Failed to delete trial repository %s: %v", repoSlug, err) return fmt.Errorf("failed to delete host repository: %w (output: %s)", err, string(output)) } + trialRepoLog.Printf("Successfully deleted trial repository: %s", repoSlug) if verbose { fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Deleted host repository: "+repoSlug)) } @@ -172,6 +175,7 @@ func cleanupTrialRepository(repoSlug string, verbose bool) error { } func cloneTrialHostRepository(repoSlug string, verbose bool) (string, error) { + trialRepoLog.Printf("Cloning trial host repository: %s", repoSlug) // Create temporary directory tempDir := filepath.Join(os.TempDir(), fmt.Sprintf("gh-aw-trial-%x", time.Now().UnixNano())) @@ -183,12 +187,15 @@ func cloneTrialHostRepository(repoSlug string, verbose bool) (string, error) { // Clone the repository using the full slug repoURL := fmt.Sprintf("https://github.com/%s.git", repoSlug) + trialRepoLog.Printf("Cloning repository from URL to tempDir: %s", tempDir) output, err := workflow.RunGitCombined(fmt.Sprintf("Cloning %s...", repoSlug), "clone", repoURL, tempDir) if err != nil { + trialRepoLog.Printf("Failed to clone host repository %s: %v", repoSlug, err) return "", fmt.Errorf("failed to clone host repository %s: %w (output: %s)", repoURL, err, string(output)) } + trialRepoLog.Printf("Successfully cloned trial repository to: %s", tempDir) return tempDir, nil } @@ -333,6 +340,7 @@ type trialWorkflowWriteResult struct { // - Writing to destination // Returns the destination path and workflows directory for further processing. func writeWorkflowToTrialDir(tempDir string, workflowName string, content []byte, opts *TrialOptions) (*trialWorkflowWriteResult, error) { + trialRepoLog.Printf("Writing workflow to trial dir: workflow=%s, content_size=%d bytes, securityScanDisabled=%v", workflowName, len(content), opts.DisableSecurityScanner) // Security scan: reject workflows containing malicious or dangerous content if !opts.DisableSecurityScanner { if findings := workflow.ScanMarkdownSecurity(string(content)); len(findings) > 0 { @@ -387,6 +395,7 @@ func writeWorkflowToTrialDir(tempDir string, workflowName string, content []byte // modifyWorkflowForTrialMode modifies the workflow to work in trial mode func modifyWorkflowForTrialMode(tempDir, workflowName, logicalRepoSlug string, verbose bool) error { + trialRepoLog.Printf("Modifying workflow for trial mode: workflow=%s, logicalRepo=%s", workflowName, logicalRepoSlug) if verbose { fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Modifying workflow for trial mode")) } diff --git a/pkg/parser/import_field_extractor.go b/pkg/parser/import_field_extractor.go index 920a19fdea0..f1600f4e45b 100644 --- a/pkg/parser/import_field_extractor.go +++ b/pkg/parser/import_field_extractor.go @@ -67,6 +67,7 @@ func newImportAccumulator() *importAccumulator { // safe-inputs, steps, runtimes, services, network, permissions, secret-masking, bots, // skip-roles, skip-bots, plugins, post-steps, labels, cache, and features. func (acc *importAccumulator) extractAllImportFields(content []byte, item importQueueItem, visited map[string]bool) error { + log.Printf("Extracting all import fields: path=%s, section=%s, inputs=%d, content_size=%d bytes", item.fullPath, item.sectionName, len(item.inputs), len(content)) // Extract tools from imported file toolsContent, err := processIncludedFileWithVisited(item.fullPath, item.sectionName, true, visited) if err != nil { @@ -112,6 +113,7 @@ func (acc *importAccumulator) extractAllImportFields(content []byte, item import // Extract engines from imported file engineContent, err := extractFrontmatterField(string(content), "engine", "") if err == nil && engineContent != "" { + log.Printf("Found engine config in import: %s", item.fullPath) acc.engines = append(acc.engines, engineContent) } @@ -281,6 +283,8 @@ func (acc *importAccumulator) extractAllImportFields(content []byte, item import // toImportsResult converts the accumulated state to a final ImportsResult. // topologicalOrder is the result from topologicalSortImports. func (acc *importAccumulator) toImportsResult(topologicalOrder []string) *ImportsResult { + log.Printf("Building ImportsResult: importedFiles=%d, importPaths=%d, engines=%d, bots=%d, plugins=%d, labels=%d", + len(topologicalOrder), len(acc.importPaths), len(acc.engines), len(acc.bots), len(acc.plugins), len(acc.labels)) return &ImportsResult{ MergedTools: acc.toolsBuilder.String(), MergedMCPServers: acc.mcpServersBuilder.String(), diff --git a/pkg/workflow/agent_validation.go b/pkg/workflow/agent_validation.go index 09af8fed5a4..6f78af5be58 100644 --- a/pkg/workflow/agent_validation.go +++ b/pkg/workflow/agent_validation.go @@ -112,8 +112,11 @@ func (c *Compiler) validateMaxTurnsSupport(frontmatter map[string]any, engine Co return nil } + agentValidationLog.Printf("Validating max-turns support: engine=%s, maxTurns=%s", engine.GetID(), engineConfig.MaxTurns) + // max-turns is specified, check if the engine supports it if !engine.SupportsMaxTurns() { + agentValidationLog.Printf("Engine %s does not support max-turns feature", engine.GetID()) return fmt.Errorf("max-turns not supported: engine '%s' does not support the max-turns feature", engine.GetID()) } @@ -133,8 +136,11 @@ func (c *Compiler) validateMaxContinuationsSupport(frontmatter map[string]any, e return nil } + agentValidationLog.Printf("Validating max-continuations support: engine=%s, maxContinuations=%d", engine.GetID(), engineConfig.MaxContinuations) + // max-continuations is specified, check if the engine supports it if !engine.SupportsMaxContinuations() { + agentValidationLog.Printf("Engine %s does not support max-continuations feature", engine.GetID()) return fmt.Errorf("max-continuations not supported: engine '%s' does not support the max-continuations feature", engine.GetID()) } @@ -151,8 +157,11 @@ func (c *Compiler) validateWebSearchSupport(tools map[string]any, engine CodingA return } + agentValidationLog.Printf("Validating web-search support for engine: %s", engine.GetID()) + // web-search is specified, check if the engine supports it if !engine.SupportsWebSearch() { + agentValidationLog.Printf("Engine %s does not natively support web-search tool, emitting warning", engine.GetID()) fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Engine '%s' does not support the web-search tool. See https://github.github.com/gh-aw/guides/web-search/ for alternatives.", engine.GetID()))) c.IncrementWarningCount() } diff --git a/pkg/workflow/compiler_safe_outputs_core.go b/pkg/workflow/compiler_safe_outputs_core.go index c58f6406826..ccbe119d490 100644 --- a/pkg/workflow/compiler_safe_outputs_core.go +++ b/pkg/workflow/compiler_safe_outputs_core.go @@ -21,6 +21,7 @@ func (c *Compiler) hasCustomTokenSafeOutputs(safeOutputs *SafeOutputsConfig) boo if safeOutputs.UpdateProjects != nil || safeOutputs.CreateProjects != nil || safeOutputs.CreateProjectStatusUpdates != nil { + consolidatedSafeOutputsLog.Print("Custom token required: project-related safe outputs detected") return true } @@ -31,16 +32,19 @@ func (c *Compiler) hasCustomTokenSafeOutputs(safeOutputs *SafeOutputsConfig) boo // the npm install. for _, base := range c.collectBaseSafeOutputConfigs(safeOutputs) { if base != nil && base.GitHubToken != "" { + consolidatedSafeOutputsLog.Print("Custom token required: per-handler github-token configured") return true } } + consolidatedSafeOutputsLog.Print("No custom token required for safe outputs") return false } // collectBaseSafeOutputConfigs returns pointers to the BaseSafeOutputConfig // embedded in every configured safe output type. Nil entries are skipped by callers. func (c *Compiler) collectBaseSafeOutputConfigs(so *SafeOutputsConfig) []*BaseSafeOutputConfig { + consolidatedSafeOutputsLog.Print("Collecting base safe output configs for custom token check") var configs []*BaseSafeOutputConfig if so.CreateIssues != nil { configs = append(configs, &so.CreateIssues.BaseSafeOutputConfig) @@ -156,6 +160,7 @@ func (c *Compiler) collectBaseSafeOutputConfigs(so *SafeOutputsConfig) []*BaseSa if so.NoOp != nil { configs = append(configs, &so.NoOp.BaseSafeOutputConfig) } + consolidatedSafeOutputsLog.Printf("Collected %d base safe output configs", len(configs)) return configs } From 97034956c986a48cabc2b717aa581aefff440823 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 3 Mar 2026 20:36:09 +0000 Subject: [PATCH 2/2] ci: trigger checks