Skip to content

Add a scheduled code-review orchestrator and path-specific review instructions#130339

Open
jeffhandley wants to merge 11 commits into
dotnet:mainfrom
jeffhandley:jeffhandley/code-review-orchestration
Open

Add a scheduled code-review orchestrator and path-specific review instructions#130339
jeffhandley wants to merge 11 commits into
dotnet:mainfrom
jeffhandley:jeffhandley/code-review-orchestration

Conversation

@jeffhandley

Copy link
Copy Markdown
Member

Summary

Reworks the repo's customized code-review automation into two related parts:

  1. A scheduled orchestrator + per-PR worker that replaces the previous
    pull_request-triggered code-review.md.
  2. Path-specific review instructions broken out of the code-review skill so the
    built-in Copilot code review agent applies them too.

This is separate from -- and complements -- GitHub's built-in Copilot code review agent.
The dispatched worker posts a single holistic review comment ("Holistic Runtime Review")
on each PR.

Changes

Scheduled orchestrator / worker

  • code-review-orchestrator.md -- on a 10-minute schedule (and workflow_dispatch),
    polls open PRs, computes the new/updated set deterministically from a reviewed-SHA
    actions/cache, and dispatches the worker per PR via the dispatch-workflow safe output.
    Follows the OrchestratorOps, DeterministicOps, and WorkQueueOps patterns from gh-aw.
  • code-review.md -- reworked from a pull_request-triggered workflow into a per-PR
    worker (workflow_dispatch); reviews one PR using the code-review skill and posts one
    holistic comment.
  • Both run in the copilot-pat-pool environment and draw a token from the Copilot PAT pool
    (shared/pat_pool.md), matching the convention already in main.

Path-specific review instructions

The review rules move verbatim out of .github/skills/code-review/SKILL.md into path-scoped
instruction files, each with an applyTo glob:

  • review-all-src.instructions.md (src/**) -- reviewer mindset, Holistic PR Assessment,
    PR hygiene, codebase consistency, documentation.
  • review-csharp.instructions.md (**/*.cs) -- error handling, thread safety, security,
    correctness patterns, performance/allocations, API design, code style.
  • review-native.instructions.md (C/C++/asm globs) -- JIT-specific correctness, C++ style,
    runtime/VM patterns, native performance, platform defines, P/Invoke marshalling.
  • review-all-tests.instructions.md (test globs) -- testing rules.

Copilot agents -- including the built-in Copilot code review agent -- automatically respect
.github/instructions/**/*.instructions.md files whose applyTo glob matches the changed
files, so these rules now apply to native Copilot reviews in addition to the code-review skill.
SKILL.md is slimmed to the review process and points at the new files.

Validation

Exercised end-to-end in a private test repo across native, C#, test, and non-src PRs:
orchestrator pickup, per-PR dispatch, holistic worker comments, native Copilot reviews that
reflect the path-specific instructions, WorkQueue dedup (no re-review when unchanged), and
re-review when new commits are pushed.

Notes

  • On the scheduled trigger the workflows self-skip when the repo is a fork
    (!github.event.repository.fork); workflow_dispatch always runs. Fork PRs themselves are
    still reviewed (see the security note in the orchestrator's poll step).

jeffhandley and others added 5 commits July 8, 2026 03:56
Move the general, language-agnostic review criteria (reviewer mindset, Holistic PR Assessment,
PR hygiene, codebase consistency, and documentation) verbatim out of
.github/skills/code-review/SKILL.md into a path-specific instruction file scoped to src/**,
and point the skill at the new file.

Copilot agents -- including the Copilot code review agent -- automatically respect
.github/instructions/**/*.instructions.md files whose applyTo glob matches the changed files, so
these rules now apply to native Copilot reviews in addition to the code-review skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the C# rules (error handling, thread safety, security, correctness patterns,
performance/allocations, API design, and code style) verbatim out of the skill into a file
scoped to **/*.cs, and add the loading reference.

Copilot agents -- including the Copilot code review agent -- automatically respect
.github/instructions/**/*.instructions.md files whose applyTo glob matches the changed files, so
these C# rules now apply to native Copilot reviews of C# files in addition to the code-review
skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the native rules (JIT-specific correctness, C++ style, runtime/VM patterns, native
performance, platform defines, and P/Invoke marshalling) verbatim out of the skill into a file
scoped to the C/C++/asm globs, and add the loading reference.

Copilot agents -- including the Copilot code review agent -- automatically respect
.github/instructions/**/*.instructions.md files whose applyTo glob matches the changed files, so
these native rules now apply to native Copilot reviews of native files in addition to the
code-review skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the testing rules verbatim out of the skill into a file scoped to the test globs, and add
the loading reference. The skill now contains only the review process and points to the
path-specific instruction files.

Copilot agents -- including the Copilot code review agent -- automatically respect
.github/instructions/**/*.instructions.md files whose applyTo glob matches the changed files, so
these test rules now apply to native Copilot reviews of test files in addition to the
code-review skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…trator

- Add code-review-orchestrator.md: on a 10-minute schedule (and workflow_dispatch) it polls
  open PRs, computes the new/updated set deterministically from a reviewed-SHA actions/cache,
  and dispatches the code-review workflow per PR via the dispatch-workflow safe output.
- Rework code-review.md from a pull_request-triggered workflow into a per-PR worker
  (workflow_dispatch) dispatched by the orchestrator; it reviews one PR using the code-review
  skill and posts a single holistic comment.
- Both import the Copilot PAT pool; update .github/aw/actions-lock.json for the pinned actions
  the new locks use.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

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

This PR restructures the repo’s customized Copilot-based review automation into a scheduled “orchestrator + per-PR worker” model and moves detailed review guidance into path-scoped .github/instructions/*.instructions.md files so both the custom workflow and GitHub’s built-in Copilot code review can share the same rule source.

Changes:

  • Converts code-review into a workflow_dispatch per-PR worker and adds a scheduled orchestrator that deterministically selects PRs needing (re)review and dispatches the worker.
  • Splits language-/area-specific review guidance out of the code-review skill into path-scoped instruction files under .github/instructions/.
  • Updates the Agentic Workflows action pinning to include actions/cache/*@v4 to support the new orchestrator’s state caching.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/code-review.md Reworks the workflow into a per-PR workflow_dispatch worker with updated safe-outputs / concurrency and PAT-pool handling.
.github/workflows/code-review.lock.yml Regenerated lockfile reflecting the worker model and updated tool/container configuration.
.github/workflows/code-review-orchestrator.md New scheduled orchestrator that computes a deterministic dispatch list and fans out worker dispatches.
.github/workflows/code-review-orchestrator.lock.yml New lockfile for the orchestrator workflow.
.github/skills/code-review/SKILL.md Slims the skill to process + points at path-scoped instruction files; updates output header text.
.github/instructions/review-all-src.instructions.md New “general” source review criteria for src/**.
.github/instructions/review-csharp.instructions.md New C#-specific review criteria (**/*.cs).
.github/instructions/review-native.instructions.md New native/interop review criteria (C/C++/asm globs).
.github/instructions/review-all-tests.instructions.md New test review criteria (tests globs).
.github/aw/actions-lock.json Adds pinned SHAs for actions/cache/restore@v4 and actions/cache/save@v4.

Comment thread .github/skills/code-review/SKILL.md Outdated
@jeffhandley jeffhandley added area-skills Agent Skills and removed area-Infrastructure labels Jul 8, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 09:00

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/code-review.md
Comment thread .github/skills/code-review/SKILL.md Outdated
Comment thread .github/instructions/review-native.instructions.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 09:17

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/code-review.md
Comment thread .github/skills/code-review/SKILL.md Outdated
Comment thread .github/workflows/code-review-orchestrator.md
jeffhandley and others added 2 commits July 8, 2026 05:29
# Conflicts:
#	.github/workflows/code-review.lock.yml
#	.github/workflows/code-review.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 09:35
…hestration' into jeffhandley/code-review-orchestration

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment on lines +45 to +49
# The per-PR job-discriminator gives each PR's compiler-generated jobs (agent, safe_outputs,
# conclusion) a distinct concurrency slot, so concurrently dispatched workers for different PRs
# run independently; cancel-in-progress above still cancels a stale review when the same PR is
# pushed again.
job-discriminator: ${{ github.event.inputs.pr_number }}
Comment on lines 14 to 16
github:
mode: remote
# Use the default containerized github-mcp-server, authenticated with the Actions GITHUB_TOKEN.
toolsets: [default, search]
Copilot AI review requested due to automatic review settings July 8, 2026 09:44

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment on lines +73 to +76
gh pr list --repo "$GITHUB_REPOSITORY" --state open --limit 1000 \
--json number,headRefOid,isDraft,updatedAt,isCrossRepository \
--jq '[.[] | select(.isDraft == false)]' > /tmp/open_prs.json
echo "Open non-draft PRs: $(jq 'length' /tmp/open_prs.json) (forks included)"
Comment thread .github/workflows/code-review.md Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 14:02

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

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

Labels

area-skills Agent Skills

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants