Skip to content

Fix actionlint error: agent job referencing needs.approval_allowlist it never depends on - #54028

Merged
pelikhan merged 8 commits into
mainfrom
copilot/static-analysis-report-2026-08-19
Aug 20, 2026
Merged

Fix actionlint error: agent job referencing needs.approval_allowlist it never depends on#54028
pelikhan merged 8 commits into
mainfrom
copilot/static-analysis-report-2026-08-19

Conversation

CopilotAI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The 2026-08-19 static analysis report flagged a new actionlint error at pr-sous-chef.lock.yml:837: ${{ toJSON(needs.approval_allowlist.outputs.eligible_pull_request_numbers) }} references a job that isn't in the agent job's dependency graph, likely explaining a series of open "Failed jobs: PR Sous Chef" issues.

Root cause

generateSafeOutputsConfig builds the agent job's own copy of config.json (GH_AW_SAFE_OUTPUTS_CONFIG) by reusing the same handler-registry output as the safe-outputs handler job's config (GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG). Jobs listed under safe-outputs.needs (e.g. approval_allowlist) are only ever wired as dependencies of the later handler job (buildSafeOutputsJobNeeds), never of agent. So any needs.<job> expression carried into the agent job's config is structurally unresolvable and trips actionlint's undefined-property check.

Fix

  • Added sanitizeAgentSafeOutputsConfig (compiler_safe_outputs_builder.go), invoked from generateSafeOutputsConfig, which walks the agent-job config map and neutralizes any templated field — single expression or slice-of-expressions — that references needs.<job> for a job in data.SafeOutputs.Needs, replacing it with an empty value.
  • The handler job's separately generated GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG is untouched, since that job legitimately depends on these custom jobs and still resolves the real expression at runtime.

Before/after for the agent job's config:

-"approve_workflow_run":{"allowed_pull_requests":${{ toJSON(needs.approval_allowlist.outputs.eligible_pull_request_numbers) }}, ...}+"approve_workflow_run":{"allowed_pull_requests":[], ...}

Recompiling pr-sous-chef.md confirms actionlint no longer reports the undefined-property error, while the handler config retains the real allow-list expression.


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

CopilotAI linked an issue Aug 19, 2026 that may be closed by this pull request
6 tasks
CopilotAIand others added 2 commits August 19, 2026 15:08
…gent job's safe-outputs config
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…gentSafeOutputsConfig
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Update static analysis report for 2026-08-19Fix actionlint error: agent job referencing needs.approval_allowlist it never depends onAug 19, 2026
CopilotAI requested a review from pelikhanAugust 19, 2026 15:16
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: bug · Risk: medium · Score: 57/100 (impact 25 + urgency 20 + quality 12)
Recommended action:fast_track

Root-caused compiler bug behind recurring PR Sous Chef job failures; affects generated workflow correctness.

Automated triage — see run report for full details.

Generated by 🔧 PR Triage Agent · auto · 90.2 AIC · ⌖ 2.82 AIC · ⊞ 8.3K ·

@pelikhan
pelikhan marked this pull request as ready for review August 19, 2026 21:50
CopilotAI balanced review requested due to automatic review settings August 19, 2026 21:50
@github-actions

github-actionsBot commented Aug 19, 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-actionsBot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #54028

@github-actions

github-actionsBot commented Aug 19, 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-actionsBot commented Aug 19, 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 test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actionsBot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ failed during design decision gate check.

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.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actionsgithub-actionsBot 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.

The fix is clean and correct. sanitizeAgentSafeOutputsConfig properly neutralizes needs.<job>.* expressions that are unresolvable in the agent job config copy, replacing templated allowed_pull_requests values with empty arrays. Only the agent job copy is affected; the handler job config retains the real expression. The test is well-targeted and the lock file update confirms end-to-end correctness.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 18.4 AIC · ⌖ 8.8 AIC · ⊞ 5.7K

@github-actionsgithub-actionsBot 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 — approving with minor suggestions.

📋 Key Themes & Highlights

Key Themes

  • Asymmetric neutralization: the string expression branch deletes the key while the templatableJSONExpression branch replaces it with []any{} — worth making consistent and testing.
  • Test coverage: the new test covers the happy path well but misses the string-expression and early-exit branches of sanitizeAgentSafeOutputsConfig.

Positive Highlights

  • ✅ Root cause is correctly diagnosed and clearly explained in the PR description
  • ✅ The fix is surgical — handler config is intentionally untouched
  • ✅ Regression test added alongside the fix
  • ✅ Recompile confirms actionlint is clean

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

return isExpression(v) && referencesUnresolvableJob(v)
}
return false
}

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] The string-expression branch deletes the key entirely (delete(v, key)), while the templatableJSONExpression branch replaces with []any{}. For a non-slice field expressed as a string template, silently dropping the key could behave differently from setting it to an empty value, and there is no test exercising this code path.

💡 Suggested fix

Consider replacing rather than deleting for consistency:

case string:
ifisExpression(fv) &&referencesUnresolvableJob(fv) {
v[key] =""// explicit empty rather than absent
}

Or add a test case that covers a string-typed expression field to document the deletion as intentional.

@copilot please address this.


func TestGenerateSafeOutputsConfigCommentMemoryToolsOnly(t *testing.T) {
data := &WorkflowData{
CommentMemoryConfig: &CommentMemoryConfig{

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 new test only exercises AllowedPullRequests (the []any / templatableJSONExpression path). Neither the string expression path nor the "no unresolvable jobs" early-exit path is covered. Adding those cases would turn the test into a complete specification of sanitizeAgentSafeOutputsConfig.

💡 Suggested additional test cases
// empty unresolvableJobs — config must be unchangedfuncTestSanitizeAgentSafeOutputsConfigNoOp(t*testing.T) { ... }
// string-typed expression field — verify deletion vs empty-string behaviourfuncTestSanitizeAgentSafeOutputsConfigStringExpr(t*testing.T) { ... }

@copilot please address this.

CopilotAI 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

Fixes invalid needs references in agent-job safe-output configuration while preserving handler-job expressions.

Changes:

  • Sanitizes unresolvable safe-output expressions.
  • Adds regression coverage.
  • Regenerates the PR Sous Chef workflow.
Show a summary per file
FileDescription
pkg/workflow/safe_outputs_config_generation.goApplies agent config sanitization.
pkg/workflow/compiler_safe_outputs_builder.goImplements recursive expression sanitization.
pkg/workflow/safe_outputs_config_generation_test.goTests expression neutralization.
.github/workflows/pr-sous-chef.lock.ymlUpdates generated agent configuration.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment on lines +176 to +183
referencesUnresolvableJob := func(expr string) bool {
for _, job := range unresolvableJobs {
if strings.Contains(expr, "needs."+job+".") {
return true
}
}
return false
}
Comment on lines +209 to +226
case []any:
// A slice field is only ever templated as a whole (a single-element
// expression slice); replace the entire slice if any element references
// an unresolvable job, since individual elements cannot be mutated
// in place through the parent map.
replaced := false
for _, item := range fv {
if itemReferencesUnresolvableJob(item) {
v[key] = []any{}
replaced = true
break
}
}
if !replaced {
for _, item := range fv {
visit(item)
}
}
Comment threadpkg/workflow/safe_outputs_config_generation_test.go Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-19T21:56:34Z
review_event: COMMENT
top_themes:
- no actionable blocking issues in changed lines
- sanitize agent-only safe-outputs config to avoid unresolved needs expressions
files_reviewed:
- .github/workflows/pr-sous-chef.lock.yml
- pkg/workflow/compiler_safe_outputs_builder.go
- pkg/workflow/safe_outputs_config_generation.go
- pkg/workflow/safe_outputs_config_generation_test.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 · 9.44 AIC · ⌖ 9.96 AIC · ⊞ 7K ·
Comment /review to run again

@github-actionsgithub-actionsBot 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: comment

No blocking issues stood up in the changed lines after reviewing the config sanitization path and its regression test.

Notes
  • The new sanitization is scoped to the agent job's copy of GH_AW_SAFE_OUTPUTS_CONFIG, while the handler config keeps the real needs.* expression.
  • I did not find a changed-line regression that would break approve_workflow_run semantics beyond the intended agent-side neutralization.
  • The requested grumpy-coder sub-agent was not available in this harness, so its advisory pass was skipped.

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

@github-actionsgithub-actionsBot 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.

Ponytail review (over-engineering only).

L195: yagni: recursive generic tree walker (visit handles arbitrary nested map[string]any/[]any) but only ever called on a config whose real shapes are flat (tool -> field map -> scalar/slice). A single non-recursive loop over each tool's fields covers every actual case; the recursion for nested []any/map depths never occurs here.

net: -20 lines possible.

Generated by ✂️ Ponytail Reviewer for #54028 · auto · 48.6 AIC · ⌖ 3.96 AIC · ⊞ 7.3K
Comment /ponytail to run again

}
return false
}
var visit func(value any)

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.

yagni: recursive generic tree walker (visit handles arbitrary nested map[string]any/[]any) but only ever called on a config whose actual shapes are flat: each safe-output tool maps to a flat field map like allowed_pull_requests. Nothing here nests deeper than tool -> field -> scalar/slice. A single non-recursive loop over each tool's field map covers every real case; the default: visit(fieldValue) and top-level case []any recursion branches handle depths that never occur in this config.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR has unresolved review feedback and failing checks that still need a forward-progress pass.

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

CopilotAIand others added 2 commits August 19, 2026 22:26
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

CopilotAI commented Aug 19, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot This PR has unresolved review feedback and failing checks that still need a forward-progress pass.

  • Unresolved review items (newest first):...

Addressed the sanitizer feedback in commit 0f649f9: bracket-notation needs[...] and []string fields are now covered, unresolved string fields use explicit empty values, the walker is a flat field pass, and regression tests cover no-op and string cases. Targeted workflow tests and final impacted validation pass.

@pelikhan

Copy link
Copy Markdown
Collaborator

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

CopilotAI commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot fix https://github.com/github/gh-aw/actions/runs/32309269690/job/96254084660#step:8:1

Fixed in commit 531301d. The sanitizer now uses package-level compile-time regex patterns, preserving both dot/bracket needs matching while resolving the CI regexpcompileinfunction lint failure.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR still needs a forward-progress pass.

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

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

CopilotAI commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot This PR still needs a forward-progress pass.

  • Unresolved review items (newest first):...

Completed the requested forward-progress pass in commit c6e7957. The sanitizer now uses a flat field pass, retains dot/bracket matching and []string handling, and the regression suite explicitly covers no-op and string-expression behavior. The test references issue #53909. Targeted tests and Go validation pass.

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: bug
  • Risk: medium
  • Priority score: 72 / 100 (impact 35 + urgency 25 + quality 12)
  • Recommended action:fast_track

Fixes an actionlint validation error affecting agent job dependency wiring platform-wide. mergeable_state:blocked pending checks; already labeled needs-review.

Automated triage by PR Triage Agent.

Generated by 🔧 PR Triage Agent · auto · 57.1 AIC · ⌖ 2.88 AIC · ⊞ 8.3K ·

@pelikhan
pelikhan merged commit c59ac15 into mainAug 20, 2026
28 checks passed
@pelikhan
pelikhan deleted the copilot/static-analysis-report-2026-08-19 branch August 20, 2026 00:57
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.2

Sign up for freeto 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.

[static-analysis] Report - 2026-08-19

4 participants

@gh-aw-bot@pelikhan