Skip to content

Allow PR Sous Chef to approve CJS and CGO action-required runs - #53679

Merged
pelikhan merged 4 commits into
mainfrom
copilot/extend-pr-sous-chef-workflow
Aug 18, 2026
Merged

Allow PR Sous Chef to approve CJS and CGO action-required runs#53679
pelikhan merged 4 commits into
mainfrom
copilot/extend-pr-sous-chef-workflow

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

PR Sous Chef skipped PRs blocked only by approval-gated workflows. It now allows eligible PRs through when the pending workflow can be safely approved, limited to CJS and CGO.

  • Safe output

    • Adds approve-workflow-run to PR Sous Chef.
    • Uses the existing maintenance token fallback.
    • Restricts approvals to cjs.yml and cgo.yml.
    • Scopes approvals to PR numbers selected by the prefilter.
  • Eligibility

    • Keeps WAITING check runs eligible for agent inspection.
    • Continues filtering other short-running pending checks before agent execution.
  • Agent behavior

    • Instructs PR Sous Chef to approve matching action-required workflow runs before deciding whether to nudge.
    • Tracks approved workflow runs in the run summary.
approve-workflow-run:
  max: 8
  allowed-workflows: [cjs.yml, cgo.yml]
  allowed-pull-requests: ${{ steps.fetch-prs.outputs.eligible_pull_request_numbers }}
  fork: true
  github-token: ${{ secrets.AWI_MAINTENANCE_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

Copilot AI and others added 2 commits August 18, 2026 12:11
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Comment thread .github/workflows/pr-sous-chef.md Outdated
max: 8
allowed-workflows: [cjs.yml, cgo.yml]
allowed-pull-requests: ${{ steps.fetch-prs.outputs.eligible_pull_request_numbers }}
fork: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot fork false!

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.

Addressed in 7aafd4a by setting approve-workflow-run to fork: false and recompiling the workflow lock file.

@pelikhan
pelikhan marked this pull request as ready for review August 18, 2026 12:29
Copilot AI balanced review requested due to automatic review settings August 18, 2026 12:29
@github-actions

github-actions Bot commented Aug 18, 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 18, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. This PR only modifies workflow files (.github/workflows/pr-sous-chef.lock.yml and .github/workflows/pr-sous-chef.md). Test Quality Sentinel skipped.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 18, 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 18, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #53679

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR #53679 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-18T12:34:00Z
review_event: REQUEST_CHANGES
top_themes:
  - workflow config uses fork approval despite prior review warning
  - WAITING checks are relabeled as ACTION_REQUIRED, risking incorrect nudges/summary
files_reviewed:
  - .github/workflows/pr-sous-chef.md
  - .github/workflows/pr-sous-chef.lock.yml
comment_count: 1

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 · 11.1 AIC · ⌖ 6.88 AIC · ⊞ 4.5K ·
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.

Request changes

This still introduces an unsafe auto-approval path for forked workflow runs.

Blocking theme

The new approve-workflow-run config is explicitly enabled with fork: true, which means PR Sous Chef can waive GitHub's manual approval gate for workflows originating from forks. Limiting approvals to cjs.yml and cgo.yml is not enough, because those workflows still execute the PR's code after approval.

That is a security boundary change, not just a convenience tweak, and it needs to be removed or replaced with a stronger trust policy before this can merge.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 11.1 AIC · ⌖ 6.88 AIC · ⊞ 4.5K
Comment /review to run again

target: "*"
github-token: ${{ secrets.AWI_MAINTENANCE_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
approve-workflow-run:
max: 8

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.

This enables fork approvals for workflow runs even though the existing review already called out fork false!, so the workflow is still authorizing execution of untrusted fork code rather than closing that risk.

💡 Why this blocks merge

approve-workflow-run is the mechanism that explicitly lifts GitHub's approval gate for fork-originated workflow runs. Setting fork: true means PR Sous Chef can now approve those runs automatically, which is exactly the high-risk path the review feedback was trying to stop. Restricting by workflow filename is not a meaningful safety boundary here: cjs.yml and cgo.yml still execute repository code from the PR branch after approval.

Please remove fork approval entirely or gate this behind a much stronger trust decision than "workflow name matches". At minimum, this needs to stay off for forked PRs until there is a reviewed policy proving those workflows are safe to auto-approve.

@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.

The changes are well-scoped and internally consistent.

  • approve_workflow_run is narrowly gated to cjs.yml/cgo.yml, fork PRs are handled via fork: true, and protected_files + allowed_pull_requests (dynamically scoped to eligible PRs from the prefilter) prevent over-approval.
  • The WAITING reclassification is coherent: WAITING no longer blocks the nudge timer (removed from the pending list) but surfaces as ACTION_REQUIRED in failed-checks so the agent knows to act on it.
  • actions: write permission is correctly added in both the compile and handler jobs.

No blocking issues found. ✅

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 24.4 AIC · ⌖ 8.79 AIC · ⊞ 5.7K

@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 /codebase-design — requesting changes on two issues.

📋 Key Themes & Highlights

Issues

  1. fork: true on approve-workflow-run (line 273) — already flagged in thread. Approving workflows from fork PRs defeats the "action required" security gate. Should be fork: false.

  2. Missing run ID discovery guidance (line 366) — Step 0 tells the agent to call approve_workflow_run --run_id <RUN_ID> but never explains how to obtain that ID. The agent must query gh run list filtering by path and headBranch to resolve it.

Positive Highlights

  • ✅ Clean eligibility guard: allowed-pull-requests scoped to the prefilter output prevents approvals outside the eligible set.
  • ✅ Graceful failure path: approve_workflow_run_failed skip reason keeps the per-PR loop going rather than aborting the run.
  • ✅ Correct skip condition for the nudge comment after a clean approval-only run.

@copilot please address the review comments above.

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


0. **Run formatters and push if needed**
0. **Approve allowed action-required workflow runs**
- If the compact JSON `failed_checks` list contains `ACTION_REQUIRED`, inspect the PR's waiting workflow runs and call `safeoutputs approve_workflow_run --run_id <RUN_ID>` only for matching CJS/CGO runs.

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] Step 0 instructs the agent to call approve_workflow_run --run_id <RUN_ID> but gives no guidance on how to discover that run ID — the agent will likely stall or produce an incorrect approval.

💡 Suggested addition

Add an explicit lookup step, for example:

- To find the run IDs, query:
  `gh run list --json databaseId,path,status,headBranch --jq '[.[] | select(.status == "action_required")]'`
  Filter by `path` matching `.github/workflows/cjs.yml` or `.github/workflows/cgo.yml` and `headBranch` matching the PR's head branch.

Without this, the agent has no deterministic path to resolve <RUN_ID> and may either silently fail or approve the wrong run.

@copilot please address this.

Comment thread .github/workflows/pr-sous-chef.md Outdated
max: 8
allowed-workflows: [cjs.yml, cgo.yml]
allowed-pull-requests: ${{ steps.fetch-prs.outputs.eligible_pull_request_numbers }}
fork: 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.

[/codebase-design] fork: true is set on approve-workflow-run, meaning the safe-output handler will approve workflows from fork PRs. This is flagged by the existing review comment on this line — it is almost certainly incorrect, as approving fork-originated workflow runs defeats the security purpose of the "action required" gate.

💡 Why this matters

The "action required" status exists specifically to prevent untrusted fork code from running with repository secrets. Setting fork: true bypasses that protection. For PRs from forks, workflow approval should remain manual.

Change to fork: false (or remove the field, since false is the safer default).

@copilot please address this.

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

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

Enables PR Sous Chef to approve eligible CJS/CGO workflow runs awaiting approval.

Changes:

  • Treats WAITING checks as agent-inspectable.
  • Adds scoped approve-workflow-run safe output.
  • Reports successful workflow approvals.
Show a summary per file
File Description
.github/workflows/pr-sous-chef.md Adds approval eligibility, configuration, and agent instructions.
.github/workflows/pr-sous-chef.lock.yml Regenerates the compiled workflow.

Review details

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

Comment thread .github/workflows/pr-sous-chef.md Outdated
approve-workflow-run:
max: 8
allowed-workflows: [cjs.yml, cgo.yml]
allowed-pull-requests: ${{ steps.fetch-prs.outputs.eligible_pull_request_numbers }}
Comment thread .github/workflows/pr-sous-chef.md Outdated
- Otherwise, attempt `update_pull_request` with `update_branch: true` and a minimal append body marker including `pr-sous-chef` and the run URL.

2. **Post exactly one combined nudge comment** (at most ONE `add_comment` per PR per run)
3. **Post exactly one combined nudge comment** (at most ONE `add_comment` per PR per run)
@github-actions github-actions Bot mentioned this pull request Aug 18, 2026
Copilot AI requested a review from pelikhan August 18, 2026 12:44
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the blocking review feedback on this PR, then run the pr-finisher skill and report back with validation results and any remaining blockers.

  • Unresolved blocking feedback is focused on the unsafe fork: true workflow approval path and the missing run-ID discovery guidance.
  • No failed checks were listed in the compact queue for this run.
  • Branch refresh was not requested because local make fmt could not run in this sandbox (go.mod requires Go >= 1.26.5; installed Go is 1.24.13).
  • After fixes, please identify any addressed review threads or stale blocking reviews that can be resolved or dismissed.

Run: https://github.com/github/gh-aw/actions/runs/32137770714

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20 AIC · ⌖ 7.86 AIC · ⊞ 6.4K ·
Comment /souschef to run again

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

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address the blocking review feedback on this PR, then run the pr-finisher skill and report back with validation results and any remaining blockers.

  • Unresolved blocking feedback is...

Addressed in 89edffa751.

  • Kept approve-workflow-run at fork: false in the source and regenerated lock file.
  • Added explicit CJS/CGO waiting-run ID discovery guidance before approve_workflow_run calls.
  • Propagated the eligible PR allowlist into safe_outputs through an approval_allowlist job output and made the handler parse JSON-string allowlists.
  • Made approval-only PR nudges conditional so they do not force a @copilot comment.

Validation: make fmt, make recompile, make lint, focused npm test --prefix actions/setup/js -- approve_workflow_run.test.cjs, make test-unit, make test, make agent-report-progress-no-test, and make agent-report-progress passed. Code review rerun had no comments. CodeQL checker was invoked after push but timed out and instructed not to rerun.

Stale/addressed review threads that can be resolved or dismissed: the fork-approval threads, missing run-ID guidance thread, safe-output allowlist propagation thread, and unconditional nudge thread.

Copilot AI requested a review from gh-aw-bot August 18, 2026 13:14
@pelikhan
pelikhan merged commit 75a9cde into main Aug 18, 2026
@pelikhan
pelikhan deleted the copilot/extend-pr-sous-chef-workflow branch August 18, 2026 13:22
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants