Skip to content

Use safe RUNNER_TEMP paths in generated workflow scripts - #54303

Merged
pelikhan merged 5 commits into
mainfrom
copilot/gh-aw-fix-codeql-alerts
Aug 20, 2026
Merged

Use safe RUNNER_TEMP paths in generated workflow scripts#54303
pelikhan merged 5 commits into
mainfrom
copilot/gh-aw-fix-codeql-alerts

Conversation

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

gh aw compile generated lock workflows that embedded ${{ runner.temp }} directly in executable actions/github-script JavaScript and shell commands, triggering CodeQL code-injection alerts. This changes generated executable bodies to resolve runner temp paths at runtime instead.

  • Compiler output hardening

    • Rewrites generated github-script require() paths through path.join(process.env.RUNNER_TEMP, ...).
    • Rewrites generated shell action invocations to quoted ${RUNNER_TEMP} paths.
    • Adds validation to reject future generated executable bodies that reintroduce unsafe ${{ runner.temp }}/gh-aw/actions usage.
  • Generated workflow coverage

    • Applies the same safety finalization to normal compile output and standalone generated workflows.
    • Recompiled checked-in lock files and updated WASM golden fixtures.
const path = require('path');
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));

pr-sous-chef run https://github.com/github/gh-aw/actions/runs/32416237836> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 36.4 AIC · ⌖ 10.6 AIC · ⊞ 9.3K ·

Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Triage

Category: bug · Risk: medium · Priority: medium · Score: 28/100
Breakdown: impact 12 · urgency 12 · quality 4

Recommended action: batch_review

Security/CodeQL-motivated fix (runner.temp inline usage) but still early WIP, 0 files changed yet. Grouped for batch review once implementation lands.

Generated by 🔧 PR Triage Agent · auto · 50 AIC · ⌖ 5.31 AIC · ⊞ 8.3K ·

Copilot AI changed the title [WIP] Fix CodeQL alerts caused by runner.temp inline Use safe RUNNER_TEMP paths in generated workflow scripts Aug 20, 2026
Copilot AI requested a review from pelikhan August 20, 2026 18:32
@pelikhan
pelikhan marked this pull request as ready for review August 20, 2026 19:38
Copilot AI balanced review requested due to automatic review settings August 20, 2026 19:38
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch PR file list

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer failed. Please review the logs for details.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Generated by Ponytail Reviewer for #54303

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Hardens generated workflows against CodeQL injection alerts by resolving runner temporary paths at runtime.

Changes:

  • Adds executable-body rewriting and validation.
  • Applies finalization across compiler and standalone workflow generators.
  • Updates tests, WASM goldens, and generated workflows.
Show a summary per file
File Description
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/with-imports.golden Updates WASM output paths.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden Updates WASM output paths.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden Updates WASM output paths.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/basic-copilot.golden Updates WASM output paths.
pkg/workflow/testdata/TestWasmGolden_AllEngines/pi.golden Updates Pi golden output.
pkg/workflow/testdata/TestWasmGolden_AllEngines/gemini.golden Updates Gemini golden output.
pkg/workflow/testdata/TestWasmGolden_AllEngines/copilot.golden Updates Copilot golden output.
pkg/workflow/testdata/TestWasmGolden_AllEngines/codex.golden Updates Codex golden output.
pkg/workflow/testdata/TestWasmGolden_AllEngines/claude.golden Updates Claude golden output.
pkg/workflow/template_rendering_test.go Updates safe-path assertions.
pkg/workflow/step_summary_test.go Updates helper-path assertions.
pkg/workflow/side_repo_maintenance.go Finalizes side-repository workflows.
pkg/workflow/runner_temp_safety.go Implements rewriting and validation.
pkg/workflow/runner_temp_safety_test.go Tests path safety behavior.
pkg/workflow/repo_memory_integration_test.go Updates repository-memory assertion.
pkg/workflow/observability_job_summary_test.go Updates observability assertion.
pkg/workflow/maintenance_workflow_yaml.go Finalizes maintenance workflows.
pkg/workflow/maintenance_workflow_test.go Updates maintenance assertion.
pkg/workflow/detection_success_test.go Updates detection assertions.
pkg/workflow/compiler_yaml.go Finalizes standard compiler output.
pkg/workflow/central_slash_command_workflow.go Finalizes slash-command workflow output.
pkg/workflow/central_slash_command_workflow_test.go Updates slash-command assertions.
pkg/workflow/aw_info_tmp_test.go Updates agent-information assertion.
pkg/workflow/auto_update_workflow.go Finalizes auto-upgrade workflows.
.github/workflows/notion-issue-summary.lock.yml Recompiles paths safely.
.github/workflows/hippo-embed.lock.yml Recompiles paths safely.
.github/workflows/firewall.lock.yml Recompiles paths safely.
.github/workflows/example-permissions-warning.lock.yml Recompiles paths safely.
.github/workflows/example-failure-category-filter.lock.yml Recompiles paths safely.
.github/workflows/designer-drift-audit.lock.yml Recompiles paths safely.
.github/workflows/daily-max-ai-credits-test.lock.yml Recompiles paths safely.
.github/workflows/codex-github-remote-mcp-test.lock.yml Recompiles paths safely.
.github/workflows/agentics-maintenance.yml Uses runtime-safe JavaScript paths.
.github/workflows/agentic-auto-upgrade.yml Uses runtime-safe JavaScript paths.
.github/workflows/agentic_commands.yml Uses runtime-safe JavaScript paths.

Review details

  • Files reviewed: 36/313 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pkg/workflow/side_repo_maintenance.go Outdated
Comment on lines +330 to +333
finalYAML, err := finalizeRunnerTempSafety(yaml.String())
if err != nil {
maintenanceLog.Printf("Runner temp safety validation failed for side-repo maintenance workflow: %v", err)
return yaml.String()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592: side-repo workflow generation now propagates runner-temp safety failures and does not write unsafe YAML.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-20T20:00:00Z
review_event: COMMENT
top_themes:
  - runner.temp hardening looks consistent across generator entry points
  - no changed-line blocker found on second pass
files_reviewed:
  - .github/workflows/agentic-auto-upgrade.yml
  - .github/workflows/agentic_commands.yml
  - .github/workflows/agentics-maintenance.yml
  - pkg/workflow/auto_update_workflow.go
  - pkg/workflow/central_slash_command_workflow.go
  - pkg/workflow/compiler_yaml.go
  - pkg/workflow/maintenance_workflow_yaml.go
  - pkg/workflow/runner_temp_safety.go
  - pkg/workflow/runner_temp_safety_test.go
  - pkg/workflow/side_repo_maintenance.go
comment_count: 0

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 25.8 AIC · ⌖ 6.79 AIC · ⊞ 7K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: non-blocking

I didn't find a changed-line correctness or security regression in the runner-temp hardening itself.

What I checked
  • the new executable-body rewrite/validation pass in pkg/workflow/runner_temp_safety.go
  • all direct call sites that now finalize generated YAML
  • representative generated workflow diffs for agentic-auto-upgrade, agentic_commands, and agentics-maintenance
  • test updates covering github-script and shell rewrites

The background grumpy-coder pass did not produce usable output in this run, so this review is based on my own pass only.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 25.8 AIC · ⌖ 6.79 AIC · ⊞ 7K
Comment /review to run again

…ed workflows

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (591 new lines in business logic directories) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/54303-runtime-path-resolution-for-generated-workflow-scripts.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-54303: Runtime Path Resolution for Generated Workflow Scripts

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 0042-use-postgresql.md for PR #42).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 57.9 AIC · ⌖ 28.7 AIC · ⊞ 9.1K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — requesting changes on a security-critical fail-open pattern.

📋 Key Themes & Highlights

Key Themes

  • Fail-open on error (security regression): auto_update_workflow.go, maintenance_workflow_yaml.go, and side_repo_maintenance.go all log-and-return the unsafe YAML when finalizeRunnerTempSafety errors. This means a validation or rewrite failure silently produces the exact unsafe output this PR is fixing. Compare with central_slash_command_workflow.go, which correctly propagates the error — the other three callers should follow that model.

  • CRLF edge case in rewriter: rewriteRunnerTempInExecutableBodies splits on \n only. CRLF line endings leave a trailing \r on each line that will defeat regex matching, silently leaving unsafe ${{ runner.temp }} expressions in place. A normalisation step + regression test is needed.

  • Missing idempotency test: No test covers running the rewriter twice on already-safe output, which could mask a double-injection bug.

Positive Highlights

  • central_slash_command_workflow.go and compiler_yaml.go correctly propagate errors from finalizeRunnerTempSafety — good model for the three failing callers.
  • validateNoRunnerTempInExecutableBodies correctly distinguishes executable bodies from plain YAML field values.
  • ✅ Test suite covers the main happy path, the shell-command case, and the regression-rejection case.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 65.7 AIC · ⌖ 11.6 AIC · ⊞ 7.8K
Comment /matt to run again

Comment thread pkg/workflow/auto_update_workflow.go Outdated
finalYAML, err := finalizeRunnerTempSafety(yaml)
if err != nil {
autoUpdateWorkflowLog.Printf("Runner temp safety validation failed for auto-update workflow: %v", err)
return yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/diagnosing-bugs] Silent fail-open: when finalizeRunnerTempSafety returns an error here, the function logs and returns the unsafe, un-rewritten YAML — the very content this PR exists to eliminate. The CodeQL injection path remains open whenever a rewrite/validation failure occurs.

💡 Suggested fix

Change the return signature to (string, error) to match central_slash_command_workflow.go, or at minimum never return the unsafe YAML:

finalYAML, err := finalizeRunnerTempSafety(yaml)
if err != nil {
    return "", fmt.Errorf("runner temp safety: %w", err)
}
return finalYAML

The same fail-open pattern exists in maintenance_workflow_yaml.go line 63 and side_repo_maintenance.go line 333 — all three need the same fix.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592: auto-update workflow generation now propagates safety-finalization errors instead of emitting unsafe YAML.

finalYAML, err := finalizeRunnerTempSafety(yaml.String())
if err != nil {
maintenanceWorkflowYAMLLog.Printf("Runner temp safety validation failed for maintenance workflow: %v", err)
return yaml.String()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/diagnosing-bugs] Same silent fail-open as auto_update_workflow.go:235 — an error from finalizeRunnerTempSafety silently falls through and returns the unsafe YAML. This negates the security guarantee for the maintenance workflow.

💡 Suggested fix

Change the function signature to return (string, error) and propagate, or treat a safety error as fatal:

finalYAML, err := finalizeRunnerTempSafety(yaml.String())
if err != nil {
    return "", fmt.Errorf("runner temp safety: %w", err)
}
return finalYAML, nil

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592: maintenance workflow generation now fails closed when runner-temp safety finalization fails.

Comment thread pkg/workflow/side_repo_maintenance.go Outdated
finalYAML, err := finalizeRunnerTempSafety(yaml.String())
if err != nil {
maintenanceLog.Printf("Runner temp safety validation failed for side-repo maintenance workflow: %v", err)
return yaml.String()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/diagnosing-bugs] Same silent fail-open pattern — error from finalizeRunnerTempSafety is logged then the function returns the unpatched YAML. All three fail-open callers should be fixed consistently.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592: side-repo workflow generation now propagates safety failures before writing output.

if inScriptBlock {
if strings.Contains(rewrittenLine, safeActionsDirLine) {
scriptBlockHasActionsDir = true
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] The rewriteRunnerTempInExecutableBodies function uses \n-only line splitting via strings.SplitAfter(yamlContent, "\n"). On Windows-generated YAML (CRLF), the trailing \r will be included in lineWithoutNewline, causing regex matches against blockScalarHeaderRE and githubScriptActionRequireRE to silently miss, leaving unsafe paths unrewritten.

💡 Suggested fix + test

Normalize line endings before splitting:

func rewriteRunnerTempInExecutableBodies(yamlContent string) string {
    yamlContent = strings.ReplaceAll(yamlContent, "\r\n", "\n")
    lines := strings.SplitAfter(yamlContent, "\n")
    ...

Add a regression test:

func TestRewriteRunnerTempCRLF(t *testing.T) {
    input := "steps:\r\n  - run: node ${{ runner.temp }}/gh-aw/actions/foo.cjs\r\n"
    got := rewriteRunnerTempInExecutableBodies(input)
    if strings.Contains(got, "${{ runner.temp }}") {
        t.Fatalf("CRLF input not rewritten: %s", got)
    }
}

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added CRLF regression coverage in 75c7592. The existing line handling preserves CRLF and safely rewrites the executable command.

out.WriteString(indent)
out.WriteString(safeActionsDirLine)
out.WriteString("\n")
scriptBlockHasActionsDir = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] No test covers the case where a script: block already has actionsDir declared (e.g. from a partial rewrite) — in that case the function skips injecting the path prelude. A test verifying idempotency would guard against double-injection regressions.

💡 Suggested test
func TestRewriteIsIdempotent(t *testing.T) {
    input := `steps:
  - uses: actions/github-script@v7
    with:
      script: |
        const path = require('path');
        const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
        const { main } = require(path.join(actionsDir, 'generate_aw_info.cjs'));
`
    once := rewriteRunnerTempInExecutableBodies(input)
    twice := rewriteRunnerTempInExecutableBodies(once)
    if once != twice {
        t.Fatalf("rewrite is not idempotent\nfirst:\n%s\nsecond:\n%s", once, twice)
    }
}

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added an idempotency regression test in 75c7592 for an already-safe github-script block.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: Use safe RUNNER_TEMP paths in generated workflow scripts

The approach is sound: rewrite ${{ runner.temp }}/gh-aw/actions/... expressions in generated YAML to runtime-resolved paths, then validate no unsafe expressions remain. The test coverage is good.

Blocking issues

1. shellActionCommandRE rewrites non-executable YAML fields (see inline comment on line 55)

The shellActionCommandRE.ReplaceAllString runs on every line unconditionally, not just lines in run: executable contexts. A YAML with: sub-field or other non-executable field containing node ${{ runner.temp }}/gh-aw/actions/foo.cjs would be incorrectly rewritten to a shell variable reference "${RUNNER_TEMP}/...". That shell syntax is only valid when executed as shell, not as a static string value. This should be gated on inRunBlock || singleLineExecutableRE.MatchString(lineWithoutNewline).

Non-blocking

2. Bare error return loses context (line 217, compiler_yaml.go) — all other error returns in generateYAML wrap with fmt.Errorf("context: %w", err). This one doesn't.

3. Misleading inScriptBlock variable — tracks only script: blocks; run: block content is implicitly handled by the unconditional shell rewrite. A comment or a parallel inRunBlock flag would clarify the intent.

Logic verified correct
  • path.join prelude injection: correctly injected once per script block at the indent of the first matching require() line.
  • CRLF handling: strings.SplitAfter(s, "\n") + TrimSuffix(line, "\n") correctly preserves CRLF line endings.
  • Block exit logic: checking trimmed != "" && currentIndent <= scriptBlockIndent before the enter check correctly handles back-to-back blocks.
  • $$ in Go regex replacement: "$${RUNNER_TEMP}/..." correctly produces "${RUNNER_TEMP}/..." in output.
  • Validation function: correctly rejects unsafe patterns in both block scalar and single-line executable contexts.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 114.7 AIC · ⌖ 9.38 AIC · ⊞ 5.7K

Comment thread pkg/workflow/runner_temp_safety.go Outdated
}
}

rewrittenLine := shellActionCommandRE.ReplaceAllString(lineWithoutNewline, `${1} "$${RUNNER_TEMP}/gh-aw/actions/${2}"`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: shellActionCommandRE rewrite runs on ALL YAML lines, not just executable contexts.

The rewrite at this line is unconditional — it fires on every line regardless of whether the line is inside a run: block scalar, a single-line run:, or an unrelated YAML field like command:, args:, or any with: sub-field.

This means a non-executable YAML field containing node ${{ runner.temp }}/gh-aw/actions/foo.cjs would be incorrectly rewritten to the shell-variable form "${RUNNER_TEMP}/gh-aw/actions/foo.cjs" — a form that is only valid in shell contexts, not as a static YAML string value.

The fix is to gate this rewrite on an inRunBlock flag (analogous to inScriptBlock), or at minimum check inRunBlock || singleLineExecutableRE.MatchString(lineWithoutNewline) before applying the substitution:

// Only rewrite shell commands inside run: executable contexts
if inRunBlock || singleLineExecutableRE.MatchString(lineWithoutNewline) {
    rewrittenLine = shellActionCommandRE.ReplaceAllString(
        lineWithoutNewline, `${1} "$${RUNNER_TEMP}/gh-aw/actions/${2}"`)
} else {
    rewrittenLine = lineWithoutNewline
}

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592: shell command rewrites are now limited to block and single-line run: contexts; non-executable YAML fields remain unchanged.

Comment thread pkg/workflow/compiler_yaml.go Outdated
@@ -212,6 +212,11 @@ func (c *Compiler) generateYAML(data *WorkflowData, markdownPath string) (string
yamlContent = c.replaceIssueNumberReferences(yamlContent)
}

yamlContent, err := finalizeRunnerTempSafety(yamlContent)
if err != nil {
return "", nil, nil, err

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Inconsistency: error returned bare without context wrapping.

All other error returns in generateYAML wrap with fmt.Errorf("...%w", err) to provide context. This bare return loses the call site context, making it harder to diagnose failures.

Suggested fix:

yamlContent, err := finalizeRunnerTempSafety(yamlContent)
if err != nil {
    return "", nil, nil, fmt.Errorf("failed to finalize runner temp safety in generated YAML: %w", err)
}

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592: the compiler now wraps runner-temp safety finalization failures with generated-YAML context.

Comment thread pkg/workflow/runner_temp_safety.go Outdated
}
}

rewrittenLine := shellActionCommandRE.ReplaceAllString(lineWithoutNewline, `${1} "$${RUNNER_TEMP}/gh-aw/actions/${2}"`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Misleading state variable name: inScriptBlock tracks only script: blocks, not run: blocks.

The variable inScriptBlock and its companion scriptBlockHasActionsDir are set only when the block header is script: (line 48: inScriptBlock = matches[2] == "script"). The shell command rewrite on line 55 then runs unconditionally on all lines.

This means:

  • run: block scalar content IS rewritten by shellActionCommandRE (correct), but inScriptBlock is false during that content.
  • The require() guard at line 56 (if inScriptBlock) correctly skips JS require-rewriting for run: blocks.

However, the asymmetry — shell rewrite is unconditional but require-rewrite is guarded — makes the logic hard to follow and maintain. A run: block scalar should ideally be tracked similarly to script:. At minimum, add a comment explaining that shellActionCommandRE is intentionally applied to all lines:

// shellActionCommandRE is intentionally applied to all lines (including run: block scalars
// and single-line run: steps); the inScriptBlock guard below only applies to the JS require() rewrite.
rewrittenLine := shellActionCommandRE.ReplaceAllString(lineWithoutNewline, `${1} "$${RUNNER_TEMP}/gh-aw/actions/${2}"`)

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 75c7592 by tracking run: block state explicitly, so shell rewrites are scoped to shell-executable contexts.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please take a maintainer-facing finish pass on this PR.

Current blockers on this head:

  • blocking review feedback remains on the PR; address the highest-signal review comments and reply thread-by-thread where needed
  • review the ADR draft committed on this branch and update the PR handoff with its status
  • re-check merge readiness on the latest head

Then run the pr-finisher skill and leave a concise maintainer handoff with validation status and any remaining human actions.

Generated by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/32413123177

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 17 AIC · ⌖ 8.15 AIC · ⊞ 9.3K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Thanks for the quick follow-up on the review threads here. Several unresolved threads now have author replies on the latest head, but they still need thread-by-thread resolution and a maintainer-facing finish pass.

Please:

  • revisit the unresolved review threads on pkg/workflow/side_repo_maintenance.go, pkg/workflow/auto_update_workflow.go, pkg/workflow/maintenance_workflow_yaml.go, pkg/workflow/compiler_yaml.go, and pkg/workflow/runner_temp_safety.go
  • reply or mark each thread resolved where the latest changes addressed the concern
  • refresh the branch if GitHub offers an update path
  • run the pr-finisher skill and leave a concise maintainer handoff with validation status and any remaining human actions

Generated by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/32414851914

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 17.5 AIC · ⌖ 8.23 AIC · ⊞ 9.3K ·
Comment /souschef to run again

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please take a maintainer-facing finish pass on this PR.

Current blockers on this head:...

Finish pass complete on 75c7592. The nine high-signal review threads already have substantive, accurate per-thread replies and the corresponding fail-closed, executable-context, CRLF, idempotency, and error-context fixes are present. docs/adr/54303-runtime-path-resolution-for-generated-workflow-scripts.md is a complete Draft (Context, Decision, Alternatives, Consequences); a maintainer must accept it and add its link to the PR body to satisfy the ADR gate.

Validated locally: make fmt, make lint, targeted runner-temp tests, make test, and make recompile (286/286) pass. Full make test-unit is blocked by the checkout lacking origin/main, then its full fallback hits an unrelated pkg/cli completion-test closed-pipe race; the affected runner-temp tests pass. The latest PR check is still in progress; prior action_required runs had no failed jobs.

Human actions: resolve the nine already-replied review threads, accept/link the ADR in the PR body, and re-trigger CI on this head. Merge state is currently blocked pending those PR gates.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please take a maintainer-facing finish pass on this PR.

Current blockers on this head:

  • unresolved review-thread follow-up is still needed on pkg/workflow/side_repo_maintenance.go, pkg/workflow/auto_update_workflow.go, pkg/workflow/maintenance_workflow_yaml.go, pkg/workflow/compiler_yaml.go, and pkg/workflow/runner_temp_safety.go
  • failed check: Ponytail Reviewer — https://github.com/github/gh-aw/actions/runs/32409795747
  • ADR draft committed on this branch should be reviewed, finalized, and linked in the PR body
  • refresh the branch if GitHub offers it

Then run the pr-finisher skill and leave a concise maintainer handoff with validation status and any remaining human actions.

Generated by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/32416237836

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 36.4 AIC · ⌖ 10.6 AIC · ⊞ 9.3K ·
Comment /souschef to run again

…eql-alerts

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Thanks for the quick follow-up on the review threads here. Several unresolved threads now have author replies on the latest head, but they still need thread-by-thread resolution and a maintai...

Updated from main in merge commit 0e6481d375; the branch is now based on b1a5e80bae with a clean worktree. All nine identified threads remain accurately answered by the existing 75c7592 replies, but the available GitHub tools do not expose review-thread resolution and direct GraphQL resolution is blocked in this environment. Local validation passes with GOTOOLCHAIN=auto: make fmt, make lint, make test-unit, make test, make recompile, and make agent-report-progress.

The previous Smoke Copilot run failed in its agent job without an actionable product-test error in the available logs. CI has no checks on the merged head, so a maintainer must resolve the nine addressed threads and re-trigger CI.

@pelikhan
pelikhan merged commit 4202f2d into main Aug 20, 2026
3 of 4 checks passed
@pelikhan
pelikhan deleted the copilot/gh-aw-fix-codeql-alerts branch August 20, 2026 21:23
Copilot stopped work on behalf of gh-aw-bot due to an error August 20, 2026 21:24
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh aw compile generates CODEQL actions/code-inject alerts by inlining ${{ runner.temp }} in github-script

4 participants