Skip to content

Add Copilot code review for v2 shim PRs#2635

Open
shreyanshjain7174 wants to merge 1 commit intomicrosoft:mainfrom
shreyanshjain7174:copilot/v2-shim-review
Open

Add Copilot code review for v2 shim PRs#2635
shreyanshjain7174 wants to merge 1 commit intomicrosoft:mainfrom
shreyanshjain7174:copilot/v2-shim-review

Conversation

@shreyanshjain7174
Copy link
Contributor

Add Copilot Code Review for V2 Shim PRs

Adds automated GitHub Copilot code review that triggers only on PRs touching v2 shim code paths.

What

Three files:

File Purpose
.github/copilot-instructions.md Global review tone: concise, prefixed ([BLOCKER]/[ISSUE]/[SUGGESTION]/[QUESTION]), no speculation
.github/instructions/v2-shim.instructions.md Go best practices + hcsshim-specific review rules
.github/workflows/copilot-review.yml Auto-request Copilot review when v2 shim paths change

Why

V2 shim code has specific patterns that are easy to get wrong:

  • Resource lifecycle (ResourceCloser registration, Close() ordering, deferred cleanup)
  • Handle/memory leaks (Windows handles, UVM device mounts)
  • Concurrency (hcs.System is not goroutine-safe, UVM device maps are mutex-protected)
  • Package layering violations

Having Copilot flag these before human review saves reviewer time.

Design

  • Copilot = guidance only (non-blocking). CI remains the enforcement gate.
  • Path-scoped: only fires when shim binaries, internal/hcs*, internal/uvm, internal/controller, internal/vm, etc. are touched.
  • Go-first: the instruction file leads with standard Go conventions (Effective Go, naming, error handling, exported-vs-unexported, concurrency) and extends with hcsshim-specific rules.
  • No model preference hardcoded — model selection is done in GitHub UI settings.
  • Skips draft PRs. Idempotent (won't re-request if already requested).

Admin steps required after merge

  1. Enable Copilot Code Review on the repo (Settings > Copilot)
  2. Select preferred model in Settings > Copilot > Code review
  3. Create copilot-review label (or remove label step from workflow)

Add automated GitHub Copilot review that triggers only when v2 shim
code paths are modified. Copilot is guidance-only; CI remains the gate.

- copilot-instructions.md: global review tone and format rules
- v2-shim.instructions.md: Go best practices + hcsshim-specific rules
  (resource lifecycle, handle leaks, concurrency, package layering)
- copilot-review.yml: workflow to auto-request Copilot review on PRs
  touching shim binaries, internal/hcs*, uvm, controller, vm packages

Signed-off-by: Shreyansh Sancheti <shreyanshjain7174@gmail.com>
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
@shreyanshjain7174 shreyanshjain7174 requested a review from a team as a code owner March 18, 2026 12:45
@rawahars rawahars self-assigned this Mar 18, 2026
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.

2 participants