From abf2f9eafb77d5dd3d20ed50353976f46cc61768 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Jul 2026 04:13:11 +0000 Subject: [PATCH 1/3] fix: trim trailing whitespace when emitting YAML step/prompt content Reduces yamllint noise in generated *.lock.yml files by trimming trailing whitespace from script and prompt body lines at the YAML emission points in the generator, rather than carrying source-file trailing whitespace verbatim. Fixes four emission paths: - ConvertStepToYAML (on.steps / pre-activation job steps) - writeStepsSection (pre/post steps; previously computed a trimmed value but wrote the untrimmed line) - addCustomStepsAsIs / addCustomStepsWithRuntimeInsertion (custom steps) - generateUnifiedPromptCreationStep (built-in sections + user prompt chunks) Eliminates all 12 trailing-spaces warnings across the workflow set (16 -> 4). Co-Authored-By: Claude Opus 4.8 (1M context) --- pkg/workflow/compiler_yaml.go | 11 +++++++---- pkg/workflow/compiler_yaml_runtime_setup.go | 13 ++++++++----- pkg/workflow/compiler_yaml_step_conversion.go | 4 +++- .../smoke-copilot.golden | 4 ++-- pkg/workflow/unified_prompt_step.go | 8 +++++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/pkg/workflow/compiler_yaml.go b/pkg/workflow/compiler_yaml.go index b0a42178608..f5599ee0389 100644 --- a/pkg/workflow/compiler_yaml.go +++ b/pkg/workflow/compiler_yaml.go @@ -949,15 +949,18 @@ func writeStepsSection(yaml *strings.Builder, stepsYAML string) { } lines := strings.Split(stepsYAML, "\n") for _, line := range lines[1:] { // skip the "pre-steps:" / "pre-agent-steps:" / "post-steps:" header line - trimmed := strings.TrimRight(line, " ") + trimmed := strings.TrimRight(line, " \t") if strings.TrimSpace(trimmed) == "" { yaml.WriteString("\n") continue } - if strings.HasPrefix(line, " ") { - yaml.WriteString(" " + line[2:] + "\n") + // Emit the trailing-whitespace-trimmed line so script body lines carried + // verbatim from the source markdown don't produce yamllint trailing-spaces + // warnings in the lock file. + if strings.HasPrefix(trimmed, " ") { + yaml.WriteString(" " + trimmed[2:] + "\n") } else { - yaml.WriteString(" " + line + "\n") + yaml.WriteString(" " + trimmed + "\n") } } } diff --git a/pkg/workflow/compiler_yaml_runtime_setup.go b/pkg/workflow/compiler_yaml_runtime_setup.go index 1331aa4d6cf..adbe4cde6d0 100644 --- a/pkg/workflow/compiler_yaml_runtime_setup.go +++ b/pkg/workflow/compiler_yaml_runtime_setup.go @@ -319,8 +319,10 @@ func (c *Compiler) addCustomStepsAsIs(yaml *strings.Builder, customSteps string) continue } - // Simply add 6 spaces for job context indentation - yaml.WriteString(" " + line + "\n") + // Simply add 6 spaces for job context indentation. + // Trim trailing whitespace so script body lines carried verbatim from the + // source markdown don't emit yamllint trailing-spaces warnings in the lock file. + yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") } } } @@ -348,8 +350,9 @@ func (c *Compiler) addCustomStepsWithRuntimeInsertion(yaml *strings.Builder, cus continue } - // Add the line with proper indentation - yaml.WriteString(" " + line + "\n") + // Add the line with proper indentation, trimming trailing whitespace so + // script body lines don't emit yamllint trailing-spaces warnings. + yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") // Check if this line starts a step with "- name:" or "- uses:" trimmed := strings.TrimSpace(line) @@ -392,7 +395,7 @@ func (c *Compiler) addCustomStepsWithRuntimeInsertion(yaml *strings.Builder, cus if nextTrimmed == "" { yaml.WriteString("\n") } else { - yaml.WriteString(" " + nextLine + "\n") + yaml.WriteString(" " + strings.TrimRight(nextLine, " \t") + "\n") } i++ } diff --git a/pkg/workflow/compiler_yaml_step_conversion.go b/pkg/workflow/compiler_yaml_step_conversion.go index ec946c3166b..0a49f8d504f 100644 --- a/pkg/workflow/compiler_yaml_step_conversion.go +++ b/pkg/workflow/compiler_yaml_step_conversion.go @@ -45,7 +45,9 @@ func ConvertStepToYAML(stepMap map[string]any) (string, error) { if strings.TrimSpace(line) == "" { result.WriteString("\n") } else { - result.WriteString(" " + line + "\n") + // Trim trailing whitespace so script/block-scalar body lines carried + // verbatim from the source don't emit yamllint trailing-spaces warnings. + result.WriteString(" " + strings.TrimRight(line, " \t") + "\n") } } diff --git a/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden b/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden index f1a6ed49388..1aa45b67d88 100644 --- a/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden +++ b/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden @@ -313,13 +313,13 @@ jobs: 1. **GitHub MCP Testing**: Review the last 2 merged pull requests in __GH_AW_GITHUB_REPOSITORY__ 2. **MCP Scripts GH CLI Testing**: Use the `mcpscripts-gh` tool to query 2 pull requests from __GH_AW_GITHUB_REPOSITORY__ (use args: "pr list --repo __GH_AW_GITHUB_REPOSITORY__ --limit 2 --json number,title,author") - 3. **Serena MCP Testing**: + 3. **Serena MCP Testing**: - Use the Serena MCP server tool `activate_project` to initialize the workspace at `__GH_AW_GITHUB_WORKSPACE__` and verify it succeeds (do NOT use bash to run go commands - use Serena's MCP tools) - After initialization, use the `find_symbol` tool to search for symbols (find which tool to call) and verify that at least 3 symbols are found in the results 4. **Playwright Testing**: Use the playwright tools to navigate to and verify the page title contains "GitHub" (do NOT try to install playwright - use the provided MCP tools) 5. **File Writing Testing**: Create a test file `/tmp/gh-aw/agent/smoke-test-copilot-__GH_AW_GITHUB_RUN_ID__.txt` with content "Smoke test passed for Copilot at $(date)" (create the directory if it doesn't exist) 6. **Bash Tool Testing**: Execute bash commands to verify file creation was successful (use `cat` to read the file back) - 7. **Discussion Interaction Testing**: + 7. **Discussion Interaction Testing**: - Use the `github-discussion-query` mcp-script tool with params: `limit=1, jq=".[0]"` to get the latest discussion from __GH_AW_GITHUB_REPOSITORY__ - Extract the discussion number from the result (e.g., if the result is `{"number": 123, "title": "...", ...}`, extract 123) - Use the `add_comment` tool with `discussion_number: ` to add a fun, playful comment stating that the smoke test agent was here diff --git a/pkg/workflow/unified_prompt_step.go b/pkg/workflow/unified_prompt_step.go index 0e9b79cf695..0a379b37d06 100644 --- a/pkg/workflow/unified_prompt_step.go +++ b/pkg/workflow/unified_prompt_step.go @@ -390,7 +390,7 @@ func (c *Compiler) generateUnifiedPromptCreationStep(yaml *strings.Builder, buil cleanedContent := removeConsecutiveEmptyLines(normalizedContent) contentLines := strings.SplitSeq(cleanedContent, "\n") for line := range contentLines { - yaml.WriteString(" " + line + "\n") + yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") } yaml.WriteString(" " + delimiter + "\n") } @@ -430,7 +430,7 @@ func (c *Compiler) generateUnifiedPromptCreationStep(yaml *strings.Builder, buil cleanedContent := removeConsecutiveEmptyLines(normalizedContent) contentLines := strings.SplitSeq(cleanedContent, "\n") for line := range contentLines { - yaml.WriteString(" " + line + "\n") + yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") } } } @@ -484,7 +484,9 @@ func (c *Compiler) generateUnifiedPromptCreationStep(yaml *strings.Builder, buil lines := strings.SplitSeq(chunk, "\n") for line := range lines { yaml.WriteString(" ") - yaml.WriteString(line) + // Trim trailing whitespace so prompt lines don't emit yamllint + // trailing-spaces warnings in the lock file. + yaml.WriteString(strings.TrimRight(line, " \t")) yaml.WriteByte('\n') } } From 15cc633a1f23e656b44b893910da65749768178a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Jul 2026 05:05:04 +0000 Subject: [PATCH 2/3] plan: revert all trailing-whitespace trimming per reviewer feedback Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> --- .github/workflows/dataflow-pr-discussion-dataset.lock.yml | 6 +++--- .github/workflows/deep-report.lock.yml | 6 +++--- .github/workflows/issue-monster.lock.yml | 4 ++-- .github/workflows/smoke-claude.lock.yml | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dataflow-pr-discussion-dataset.lock.yml b/.github/workflows/dataflow-pr-discussion-dataset.lock.yml index d723308c4c1..c23a4a8fcb0 100644 --- a/.github/workflows/dataflow-pr-discussion-dataset.lock.yml +++ b/.github/workflows/dataflow-pr-discussion-dataset.lock.yml @@ -687,12 +687,12 @@ jobs: # Extract discussions and normalize structure echo "$RESULT" | jq -r ' - .data.repository.discussions.nodes + .data.repository.discussions.nodes | map({ - number, + number, title, body, - createdAt, + createdAt, updatedAt, url, category: .category.name, diff --git a/.github/workflows/deep-report.lock.yml b/.github/workflows/deep-report.lock.yml index 17ece588b4a..1b86f1c7a58 100644 --- a/.github/workflows/deep-report.lock.yml +++ b/.github/workflows/deep-report.lock.yml @@ -708,12 +708,12 @@ jobs: # Extract discussions and normalize structure echo "$RESULT" | jq -r ' - .data.repository.discussions.nodes + .data.repository.discussions.nodes | map({ - number, + number, title, body, - createdAt, + createdAt, updatedAt, url, category: .category.name, diff --git a/.github/workflows/issue-monster.lock.yml b/.github/workflows/issue-monster.lock.yml index 135e6d3b123..33e2a3bc25b 100644 --- a/.github/workflows/issue-monster.lock.yml +++ b/.github/workflows/issue-monster.lock.yml @@ -2283,8 +2283,8 @@ jobs: } // Exclude issues with open PRs from Copilot coding agent - const openCopilotPRs = issue.linkedPRs?.filter(pr => - pr.state === 'OPEN' && + const openCopilotPRs = issue.linkedPRs?.filter(pr => + pr.state === 'OPEN' && (pr.author === 'copilot-swe-agent' || pr.author?.includes('copilot')) ) || []; if (openCopilotPRs.length > 0) { diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index eff1812073d..052f240f239 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -454,11 +454,11 @@ jobs: 5. **Tavily Web Search Testing**: Use the Tavily MCP server to perform a web search for "GitHub Agentic Workflows" and verify that results are returned with at least one item 6. **File Writing Testing**: Create a test file `/tmp/gh-aw/agent/smoke-test-claude-__GH_AW_GITHUB_RUN_ID__.txt` with content "Smoke test passed for Claude at $(date)" (create the directory if it doesn't exist) 7. **Bash Tool Testing**: Execute bash commands to verify file creation was successful (use `cat` to read the file back) - 8. **Discussion Interaction Testing**: + 8. **Discussion Interaction Testing**: - Use `gh api repos/__GH_AW_GITHUB_REPOSITORY__/discussions?per_page=1` to get the latest discussion from __GH_AW_GITHUB_REPOSITORY__ - Extract the discussion number from the result (e.g., if the result is `{"number": 123, "title": "...", ...}`, extract 123) - Use the `add_comment` tool with `discussion_number: ` to add a fun, comic-book style comment stating that the smoke test agent was here - 9. **Agentic Workflows MCP Testing**: + 9. **Agentic Workflows MCP Testing**: - Call the `agentic-workflows` MCP tool using the `status` method with workflow name `smoke-claude` to query workflow status - If the tool returns an error or no results, mark this test as ❌ and note "Tool unavailable or workflow not found" but continue to the Output section - If the tool succeeds, extract key information from the response: total runs, success/failure counts, last run timestamp @@ -496,7 +496,7 @@ jobs: - Note: This will bundle all review comments from test #14 - After submitting, use the GitHub MCP tool to list review threads on the PR and note the thread IDs from review comments you created in test #14 — these will be used in test #16 - 16. **Resolve Review Thread Testing**: + 16. **Resolve Review Thread Testing**: - Use the GitHub MCP tool to list review threads on the PR and filter for threads that are **not yet resolved** (`isResolved: false`) - Prefer resolving a thread created by your own review comments from test #14 in this run - Use `thread_id: ""` from one of those unresolved threads @@ -508,7 +508,7 @@ jobs: - Verify the tool call succeeds - Note: May fail if reviewer is already assigned or doesn't have access - 18. **Push to PR Branch Testing**: + 18. **Push to PR Branch Testing**: - Create a test file at `smoke-test-files/smoke-claude-push-test.md` in the repository workspace with content "Smoke test push — Run __GH_AW_GITHUB_RUN_ID__" - Use the `push_to_pull_request_branch` tool to push this change - Use `pr_number: ` and `commit_message: "test: Add smoke test file"` From f182d496f95842876ec1f0b920123a9248a065bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Jul 2026 05:07:42 +0000 Subject: [PATCH 3/3] revert: remove trailing-whitespace trimming from YAML emission paths Per reviewer feedback, trimming block-scalar content changes parsed values: - run/script bodies (\\ is a shell line continuation) - custom step with:/run blocks (heredoc payloads, multiline data) - prompt heredocs (two trailing spaces = Markdown hard break) Reverts all trimming changes introduced in abf2f9e and restores the smoke-copilot.golden fixture to its original state. Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> --- pkg/workflow/compiler_yaml.go | 11 ++++------- pkg/workflow/compiler_yaml_runtime_setup.go | 13 +++++-------- pkg/workflow/compiler_yaml_step_conversion.go | 4 +--- .../smoke-copilot.golden | 4 ++-- pkg/workflow/unified_prompt_step.go | 8 +++----- 5 files changed, 15 insertions(+), 25 deletions(-) diff --git a/pkg/workflow/compiler_yaml.go b/pkg/workflow/compiler_yaml.go index f5599ee0389..b0a42178608 100644 --- a/pkg/workflow/compiler_yaml.go +++ b/pkg/workflow/compiler_yaml.go @@ -949,18 +949,15 @@ func writeStepsSection(yaml *strings.Builder, stepsYAML string) { } lines := strings.Split(stepsYAML, "\n") for _, line := range lines[1:] { // skip the "pre-steps:" / "pre-agent-steps:" / "post-steps:" header line - trimmed := strings.TrimRight(line, " \t") + trimmed := strings.TrimRight(line, " ") if strings.TrimSpace(trimmed) == "" { yaml.WriteString("\n") continue } - // Emit the trailing-whitespace-trimmed line so script body lines carried - // verbatim from the source markdown don't produce yamllint trailing-spaces - // warnings in the lock file. - if strings.HasPrefix(trimmed, " ") { - yaml.WriteString(" " + trimmed[2:] + "\n") + if strings.HasPrefix(line, " ") { + yaml.WriteString(" " + line[2:] + "\n") } else { - yaml.WriteString(" " + trimmed + "\n") + yaml.WriteString(" " + line + "\n") } } } diff --git a/pkg/workflow/compiler_yaml_runtime_setup.go b/pkg/workflow/compiler_yaml_runtime_setup.go index adbe4cde6d0..1331aa4d6cf 100644 --- a/pkg/workflow/compiler_yaml_runtime_setup.go +++ b/pkg/workflow/compiler_yaml_runtime_setup.go @@ -319,10 +319,8 @@ func (c *Compiler) addCustomStepsAsIs(yaml *strings.Builder, customSteps string) continue } - // Simply add 6 spaces for job context indentation. - // Trim trailing whitespace so script body lines carried verbatim from the - // source markdown don't emit yamllint trailing-spaces warnings in the lock file. - yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") + // Simply add 6 spaces for job context indentation + yaml.WriteString(" " + line + "\n") } } } @@ -350,9 +348,8 @@ func (c *Compiler) addCustomStepsWithRuntimeInsertion(yaml *strings.Builder, cus continue } - // Add the line with proper indentation, trimming trailing whitespace so - // script body lines don't emit yamllint trailing-spaces warnings. - yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") + // Add the line with proper indentation + yaml.WriteString(" " + line + "\n") // Check if this line starts a step with "- name:" or "- uses:" trimmed := strings.TrimSpace(line) @@ -395,7 +392,7 @@ func (c *Compiler) addCustomStepsWithRuntimeInsertion(yaml *strings.Builder, cus if nextTrimmed == "" { yaml.WriteString("\n") } else { - yaml.WriteString(" " + strings.TrimRight(nextLine, " \t") + "\n") + yaml.WriteString(" " + nextLine + "\n") } i++ } diff --git a/pkg/workflow/compiler_yaml_step_conversion.go b/pkg/workflow/compiler_yaml_step_conversion.go index 0a49f8d504f..ec946c3166b 100644 --- a/pkg/workflow/compiler_yaml_step_conversion.go +++ b/pkg/workflow/compiler_yaml_step_conversion.go @@ -45,9 +45,7 @@ func ConvertStepToYAML(stepMap map[string]any) (string, error) { if strings.TrimSpace(line) == "" { result.WriteString("\n") } else { - // Trim trailing whitespace so script/block-scalar body lines carried - // verbatim from the source don't emit yamllint trailing-spaces warnings. - result.WriteString(" " + strings.TrimRight(line, " \t") + "\n") + result.WriteString(" " + line + "\n") } } diff --git a/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden b/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden index 1aa45b67d88..f1a6ed49388 100644 --- a/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden +++ b/pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden @@ -313,13 +313,13 @@ jobs: 1. **GitHub MCP Testing**: Review the last 2 merged pull requests in __GH_AW_GITHUB_REPOSITORY__ 2. **MCP Scripts GH CLI Testing**: Use the `mcpscripts-gh` tool to query 2 pull requests from __GH_AW_GITHUB_REPOSITORY__ (use args: "pr list --repo __GH_AW_GITHUB_REPOSITORY__ --limit 2 --json number,title,author") - 3. **Serena MCP Testing**: + 3. **Serena MCP Testing**: - Use the Serena MCP server tool `activate_project` to initialize the workspace at `__GH_AW_GITHUB_WORKSPACE__` and verify it succeeds (do NOT use bash to run go commands - use Serena's MCP tools) - After initialization, use the `find_symbol` tool to search for symbols (find which tool to call) and verify that at least 3 symbols are found in the results 4. **Playwright Testing**: Use the playwright tools to navigate to and verify the page title contains "GitHub" (do NOT try to install playwright - use the provided MCP tools) 5. **File Writing Testing**: Create a test file `/tmp/gh-aw/agent/smoke-test-copilot-__GH_AW_GITHUB_RUN_ID__.txt` with content "Smoke test passed for Copilot at $(date)" (create the directory if it doesn't exist) 6. **Bash Tool Testing**: Execute bash commands to verify file creation was successful (use `cat` to read the file back) - 7. **Discussion Interaction Testing**: + 7. **Discussion Interaction Testing**: - Use the `github-discussion-query` mcp-script tool with params: `limit=1, jq=".[0]"` to get the latest discussion from __GH_AW_GITHUB_REPOSITORY__ - Extract the discussion number from the result (e.g., if the result is `{"number": 123, "title": "...", ...}`, extract 123) - Use the `add_comment` tool with `discussion_number: ` to add a fun, playful comment stating that the smoke test agent was here diff --git a/pkg/workflow/unified_prompt_step.go b/pkg/workflow/unified_prompt_step.go index 0a379b37d06..0e9b79cf695 100644 --- a/pkg/workflow/unified_prompt_step.go +++ b/pkg/workflow/unified_prompt_step.go @@ -390,7 +390,7 @@ func (c *Compiler) generateUnifiedPromptCreationStep(yaml *strings.Builder, buil cleanedContent := removeConsecutiveEmptyLines(normalizedContent) contentLines := strings.SplitSeq(cleanedContent, "\n") for line := range contentLines { - yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") + yaml.WriteString(" " + line + "\n") } yaml.WriteString(" " + delimiter + "\n") } @@ -430,7 +430,7 @@ func (c *Compiler) generateUnifiedPromptCreationStep(yaml *strings.Builder, buil cleanedContent := removeConsecutiveEmptyLines(normalizedContent) contentLines := strings.SplitSeq(cleanedContent, "\n") for line := range contentLines { - yaml.WriteString(" " + strings.TrimRight(line, " \t") + "\n") + yaml.WriteString(" " + line + "\n") } } } @@ -484,9 +484,7 @@ func (c *Compiler) generateUnifiedPromptCreationStep(yaml *strings.Builder, buil lines := strings.SplitSeq(chunk, "\n") for line := range lines { yaml.WriteString(" ") - // Trim trailing whitespace so prompt lines don't emit yamllint - // trailing-spaces warnings in the lock file. - yaml.WriteString(strings.TrimRight(line, " \t")) + yaml.WriteString(line) yaml.WriteByte('\n') } }