Consume BCQuality knowledge base for Copilot PR review#8700
Conversation
Replace the local al-code-review skill and instructions with the BCQuality consumption model: the workflow now checks out microsoft/BCQuality at main, and the review script copies that clone into the runner workspace and instructs Copilot CLI to start from BCQuality skills/entry.md. The script's flat JSON output contract is preserved so the comment-posting pipeline is unchanged.
Replace the naive direct-checkout bridge with the config-driven clone+filter pattern from the tested reference implementation: - Add tools/BCQuality integration layer (config YAML, Get-BCQualityConfig, Invoke-BCQualityFilter, README) - Replace orchestrator with the version that consumes BCQuality native structured DO output (agent findings, references, confidence, interrupted-JSON repair, filter report in PR summary) - Runner workflow now clones the configured BCQuality repo/ref, filters it to policy, and passes BCQUALITY_ROOT/SHA + BCQUALITY_* + AGENT_MINIMUM_SEVERITY; uploads the filter report
There was a problem hiding this comment.
Pull request overview
This PR migrates the Copilot PR review orchestration to consume centrally maintained review skills/knowledge from microsoft/BCQuality at runtime, replacing the duplicated in-repo instruction/skill content with a config-driven clone + filter layer.
Changes:
- Added
tools/BCQuality/integration layer (config + config loader + deterministic filter with audit report artifact). - Updated the PR review runner workflow to fetch/filter BCQuality and run the orchestrator with BCQuality as the working directory (pinned ref for reproducibility).
- Removed the legacy in-repo AL review skill and domain instruction markdown files now sourced from BCQuality.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/CopilotPRReviewRunner.yaml |
Adds BCQuality fetch/filter, copilot-requests: write, and switches Copilot CLI auth to built-in token. |
tools/BCQuality/bcquality.config.yaml |
Pins BCQuality ref and defines enabled layers + knowledge allow/deny + task-context defaults. |
tools/BCQuality/scripts/Get-BCQualityConfig.ps1 |
Loads YAML config and applies env overrides for Actions variables. |
tools/BCQuality/scripts/Invoke-BCQualityFilter.ps1 |
Prunes cloned BCQuality content and emits _filter-report.json. |
tools/BCQuality/README.md |
Documents the shared BCQuality integration layer and override schema. |
tools/Code Review/scripts/Invoke-CopilotPRReview.ps1 |
Orchestrator now boots via BCQuality skills/entry.md and parses BCQuality DO-contract output. |
tools/Code Review/README.md |
Documents the updated two-workflow pattern, severity mapping, and BCQuality-backed findings model. |
tools/Code Review/skills/al-code-review/SKILL.md |
Removed (now sourced from BCQuality). |
tools/Code Review/instructions/accessibility.md |
Removed (now sourced from BCQuality). |
tools/Code Review/instructions/performance.md |
Removed (now sourced from BCQuality). |
tools/Code Review/instructions/privacy.md |
Removed (now sourced from BCQuality). |
tools/Code Review/instructions/security.md |
Removed (now sourced from BCQuality). |
tools/Code Review/instructions/style.md |
Removed (now sourced from BCQuality). |
tools/Code Review/instructions/upgrade.md |
Removed (now sourced from BCQuality). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ish jobs Isolate the tool-enabled Copilot CLI (which processes untrusted PR diff content with --allow-all-tools) in a read-only 'review' job and move all comment/issue writes into a separate 'publish' job that never runs the model. Only the raw agent output crosses the job boundary as an artifact. Also: - Fix Test-GlobMatch regex-escape bug (-contains against a single string never matched metacharacters, so globs were not escaped). - Expand the Get-BCQualityConfig defaults block for readability. - Update Code Review README: drop the obsolete COPILOT_GH_TOKEN secret and document GH_TOKEN/GITHUB_TOKEN authentication and the two-job security model.
Full agent output persisted as world-readable artifactThe raw Copilot CLI output ( Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
|
Query string built via string concatenation, not encodingIn Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
- Format-AnnotationMessage: encode '%' to '%25' before replacing newlines so agent output containing literal %0A/%0D cannot be replayed as injected workflow-command terminators. - Assert-Config: validate BASE_BRANCH against a strict git ref-name pattern before it is interpolated into git refspecs. - Skip Build-TaskContext/Save-TaskContext entirely in the post phase; the result is unused there and re-parsing the BCQuality config wastes work and can fail spuriously when the clone is absent. - Invoke-BCQualityFilter: make the path-traversal root-containment check case-insensitive (OrdinalIgnoreCase) so it holds on Windows runners. - publish job: also require needs.review.outputs.head_sha != '' so findings are never posted against an empty/wrong commit SHA.
Summary
Migrates the Copilot PR reviewer from a self-maintained instructions/skill model to consuming the proven, centrally-maintained BCQuality knowledge base through a small, config-driven clone + filter integration layer.
The reviewer now pulls its review knowledge (performance, privacy, security, style, upgrade) from
microsoft/BCQualityat runtime, instead of carrying a duplicated copy of that guidance in this repo.What changed
Added — BCQuality integration layer (
tools/BCQuality/)bcquality.config.yaml— single source of truth for which BCQuality content this repo consumes (repo/ref, enabled layers, disabled skills, knowledge allow/deny, task-context). Every value is overridable at runtime via Actions variables.scripts/Get-BCQualityConfig.ps1— loads the YAML and appliesBCQUALITY_*env overrides.scripts/Invoke-BCQualityFilter.ps1— prunes the BCQuality clone to policy and emits a_filter-report.jsonartifact for auditability.README.md— documents the layer.Updated — orchestrator (
tools/Code Review/scripts/Invoke-CopilotPRReview.ps1)BCQUALITY_ROOT/BCQUALITY_SHA) and reads BCQuality'sentry.mdrather than the in-repo instruction files.Updated — runner workflow (
.github/workflows/CopilotPRReviewRunner.yaml)GITHUB_TOKEN+copilot-requests: writeto bill Copilot inference to the org (no PAT secret required).init + fetch + checkoutso the pinned ref may be a branch, tag, or commit SHA.Config
refis pinned to a specificmaincommit (822cae1b2771ac25f665f73369f69093bd4fd630) for reproducible reviews; bump deliberately as BCQuality advances.Removed — now sourced from BCQuality
tools/Code Review/instructions/*.md(accessibility, performance, privacy, security, style, upgrade)tools/Code Review/skills/al-code-review/SKILL.mdFixes AB#637778