Skip to content

feat(pr-review): 新增 PR 自動審查閘門 - #120

Merged
monkey1sai merged 11 commits into
mainfrom
codex/openspec/add-pr-review-agent
May 26, 2026
Merged

monkey1sai merged 11 commits into
mainfrom
codex/openspec/add-pr-review-agent

Conversation

@monkey1sai

@monkey1sai monkey1sai commented May 26, 2026

Copy link
Copy Markdown
Owner

變更摘要

新增 PR review agent gate 的 OpenSpec change、GitHub Actions workflow、本機 PowerShell 審查工具、測試與文件,讓每個 PR 可產生自動審查 report。

修改原因

AI coding 產生的 diff 和驗證證據很大,人工審查容易漏掉 OpenSpec、repo 邊界、GitNexus、secrets 與必要驗證。

主要變更

  • 新增 pull-request-review-agent OpenSpec capability。
  • 新增 .github/workflows/pr-review-agent.yml,在 PR opened / synchronize / reopened / ready_for_review 時跑 gate。
  • 新增 scripts/pr-review-agent.ps1scripts/lib/pr-review-agent.ps1,產生 JSON / Markdown report。
  • 新增 scripts/tests/test-pr-review-agent.ps1,覆蓋 OpenSpec、service code、secret path、retired runtime、GitNexus unavailable、path planner fixtures。
  • 新增 docs/PR_REVIEW_AGENT.md 並更新 README / workflow v3。

驗證方式

  • openspec validate add-pr-review-agent 通過。
  • openspec status --change add-pr-review-agent 顯示 artifacts complete,tasks 已完成。
  • PowerShell parse check 通過。
  • powershell -NoProfile -ExecutionPolicy Bypass -File scripts\tests\test-pr-review-agent.ps1 通過。
  • powershell -NoProfile -ExecutionPolicy Bypass -Command "& .\scripts\pr-review-agent.ps1 ..." dry-run 成功,狀態為 warning,原因是 optional AI adapter skipped。
  • git diff --check 通過。
  • gitnexus detect-changes --repo AI-BIM-governance 完成但回報 stale / sibling index;不視為乾淨 current-worktree pass。

風險與影響

  • 新增 workflow 檔案需要 GitHub token / app 具備 workflow 權限;本機 CLI token 因缺 workflow scope 無法直接 git push,已改用 GitHub connector 建立 workflow 後推送完整 commit。
  • GitNexus 在 d67f worktree 的 index 不是 current worktree,需要後續重建或以 repo 內明確 evidence 補強。
  • PR review agent 只產生 gate verdict,不自動 merge,不取代人工審查、CODEOWNERS 或 branch protection。

回滾方式

revert 本 PR;或停用 / 移除 .github/workflows/pr-review-agent.yml,產品 runtime 不受影響。

後續建議

  • PR 合併前確認 GitHub workflow 在遠端 runner 的權限與 GitNexus 行為。
  • 若要把此 gate 設為 required check,先用 report-only 觀察 false positive / false negative。

Summary by CodeRabbit

  • New Features

    • Introduced automated PR review agent that validates changes for security (secrets, forbidden modifications), code requirements, and compliance, generating detailed reports before human review.
  • Documentation

    • Added PR review agent specifications, design guidance, and instructions for local validation.
  • Tests

    • Added test suite for PR review agent validation.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@monkey1sai, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 21 minutes and 36 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8f22c75-c3b9-4c3a-ab91-c521f55d7742

📥 Commits

Reviewing files that changed from the base of the PR and between e1ed8f6 and 0cec310.

📒 Files selected for processing (9)
  • .github/workflows/pr-review-agent.yml
  • docs/PR_REVIEW_AGENT.md
  • openspec/changes/add-pr-review-agent/design.md
  • openspec/changes/add-pr-review-agent/proposal.md
  • openspec/changes/add-pr-review-agent/specs/pull-request-review-agent/spec.md
  • openspec/changes/add-pr-review-agent/tasks.md
  • scripts/lib/pr-review-agent.ps1
  • scripts/pr-review-agent.ps1
  • scripts/tests/test-pr-review-agent.ps1
📝 Walkthrough

Walkthrough

This PR introduces a complete automated PR review agent gate. The agent validates every PR against OpenSpec alignment, secrets, repository boundaries, deterministic checks, and GitNexus impact, producing JSON and Markdown reports with risk classification and blocker/warning verdicts. The feature is implemented as a PowerShell script orchestrated by GitHub Actions and documented for local rerun and rollout guidance.

Changes

PR Review Agent Gate Implementation

Layer / File(s) Summary
OpenSpec Specification & Design Contract
openspec/changes/add-pr-review-agent/.openspec.yaml, openspec/changes/add-pr-review-agent/proposal.md, openspec/changes/add-pr-review-agent/design.md, openspec/changes/add-pr-review-agent/specs/pull-request-review-agent/spec.md, openspec/changes/add-pr-review-agent/tasks.md
OpenSpec proposal and design define PR review agent capability, boundaries (review gating only, no auto-merge, no runtime API changes), success criteria (deterministic checks + human-readable evidence), and required blocking conditions (secrets, retired runtimes, missing OpenSpec IDs, unresolved HIGH/CRITICAL risks, GitNexus unavailability). Spec requires JSON/Markdown reports, forbids AI overriding deterministic failures, enforces repo boundary guardrails, and classifies results as passed/warning/blocked/failed with risk levels lowcritical.
PowerShell Agent Implementation & Tests
scripts/lib/pr-review-agent.ps1, scripts/pr-review-agent.ps1, scripts/tests/test-pr-review-agent.ps1
Core lib/pr-review-agent.ps1 implements path detection (git merge-base), OpenSpec ID extraction, path guards (secret paths, retired runtimes, generated tooling), validation planning (command selection by changed areas), command execution with status derivation, GitNexus integration (detect-changes with unavailability modes), risk computation, and JSON/Markdown report generation. Entrypoint pr-review-agent.ps1 accepts refs/SHAs/PR metadata, wires parameters to core logic, handles exceptions, and enforces exit codes (1 on blocked/failed unless report-only). Test suite validates OpenSpec-only changes, missing OpenSpec blockers, secret blocking (without value leakage), retired runtime detection, GitNexus fail-closed behavior, guard vs. wiring distinction, validation plan ownership, command robustness, and merge-base path selection.
GitHub Actions Workflow Integration
.github/workflows/pr-review-agent.yml
Workflow triggers on PR opened/synchronize/reopened/ready-for-review, grants minimal permissions (contents read; pull-requests/checks write), checks out repo, sets up Node.js v20 and Python 3.12, installs dependencies, runs pr-review-agent.ps1 with base/head SHAs (report-only for drafts), uploads artifacts unconditionally, posts review summary as PR comment (skip for forks), and enforces agent's exit code (fails workflow if blocked/failed).
User-Facing Documentation & Integration Guides
README.md, docs/PROJECT_DEVELOPMENT_WORKFLOW.md, docs/PR_REVIEW_AGENT.md
README references docs/PR_REVIEW_AGENT.md as PR agent gate entry point and updates OpenSpec workflow to show agent's auto-review role (risk/validation summary, no auto-merge, no bypass of protections). PROJECT_DEVELOPMENT_WORKFLOW integrates agent into step 5 of PR workflow, adds PR checklist item requiring agent report with blocker/failed mitigation, and adds section 11.2.A documenting outputs (JSON/Markdown), statuses (passed/warning/blocked/failed), local rerun command, and rollout guidance (observe before requiring). PR_REVIEW_AGENT.md provides comprehensive reference: status/risk definitions, report schema (JSON fields: schema, PR refs/SHAs, changed paths, checks, blockers/warnings, GitNexus status, risk level), Markdown sections (summary, blockers, warnings, validation, checks, notes), guardrails (secrets/.env blocking, retired runtime examples), local rerun modes (report-only, skip execution/GitNexus, allow unavailable), and rollout sequence (dry-run → observation → protection).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A PR agent hops in place,
Checking paths with careful grace,
Secrets blocked, and specs aligned,
Risk and warnings logged in mind,
No more silent bugs to trace!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(pr-review): 新增 PR 自動審查閘門' clearly and specifically describes the main change—adding an automated PR review gate—which aligns directly with the primary purpose of this changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/openspec/add-pr-review-agent

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@monkey1sai
monkey1sai marked this pull request as ready for review May 26, 2026 03:50
Copilot AI review requested due to automatic review settings May 26, 2026 03:50
@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status failed
Risk high
PR 120
Head codex/openspec/add-pr-review-agent / ac0025d48f4a4e8c8eaa0d83a15a48fc98da0596
Base main / 26124a2b1654024466be029c10ef6faf57b94e1c

Blockers

  • [high] scripts/lib/pr-review-agent.ps1 Workflow/script references retired runtime '_worker'; keep retired services out of current runtime gates.
  • [high] scripts/tests/test-pr-review-agent.ps1 Workflow/script references retired runtime '_worker'; keep retired services out of current runtime gates.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance Required validation failed: openspec validate add-pr-review-agent.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance Required validation failed: openspec validate archive.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance\bim-review-coordinator Required validation failed: bim-review-coordinator verify.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance\bim-streaming-server Required validation failed: bim-streaming-server conversion API tests.
  • [high] GitNexus detect changes is required for code/script changes but status is 'unavailable'.

Warnings

  • [medium] Optional AI adapter is not required for this gate and was skipped.

Validation Commands

  • openspec validate add-pr-review-agent
  • openspec validate archive
  • npm run verify
  • python -m pytest tests/test_conversion_authority_api.py -q
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-stage-loading-contract.ps1
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-pr-review-agent.ps1

Checks

  • failed openspec validate add-pr-review-agent (openspec)
  • failed openspec validate archive (openspec)
  • failed bim-review-coordinator verify (bim-review-coordinator)
  • failed bim-streaming-server conversion API tests (bim-streaming-server)
  • passed bim-streaming-server stage-loading contract (bim-streaming-server)
  • passed script-level PR review agent tests (scripts)

Human Review Notes

  • Report-only mode is enabled; this run should not be treated as merge approval.
  • OpenSpec changes detected: add-pr-review-agent, archive

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status failed
Risk high
PR 120
Head codex/openspec/add-pr-review-agent / ac0025d48f4a4e8c8eaa0d83a15a48fc98da0596
Base main / 26124a2b1654024466be029c10ef6faf57b94e1c

Blockers

  • [high] scripts/lib/pr-review-agent.ps1 Workflow/script references retired runtime '_worker'; keep retired services out of current runtime gates.
  • [high] scripts/tests/test-pr-review-agent.ps1 Workflow/script references retired runtime '_worker'; keep retired services out of current runtime gates.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance Required validation failed: openspec validate add-pr-review-agent.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance Required validation failed: openspec validate archive.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance\bim-review-coordinator Required validation failed: bim-review-coordinator verify.
  • [high] D:\a\AI-BIM-governance\AI-BIM-governance\bim-streaming-server Required validation failed: bim-streaming-server conversion API tests.
  • [high] GitNexus detect changes is required for code/script changes but status is 'unavailable'.

Warnings

  • [medium] Optional AI adapter is not required for this gate and was skipped.

Validation Commands

  • openspec validate add-pr-review-agent
  • openspec validate archive
  • npm run verify
  • python -m pytest tests/test_conversion_authority_api.py -q
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-stage-loading-contract.ps1
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-pr-review-agent.ps1

Checks

  • failed openspec validate add-pr-review-agent (openspec)
  • failed openspec validate archive (openspec)
  • failed bim-review-coordinator verify (bim-review-coordinator)
  • failed bim-streaming-server conversion API tests (bim-streaming-server)
  • passed bim-streaming-server stage-loading contract (bim-streaming-server)
  • passed script-level PR review agent tests (scripts)

Human Review Notes

  • OpenSpec changes detected: add-pr-review-agent, archive

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 introduces a repository-level “PR review agent gate” capability (OpenSpec + docs) and a first implementation (PowerShell + GitHub Actions) that generates a JSON/Markdown review report per pull request, including path-based validation planning, guardrails, and a verdict.

Changes:

  • Added an OpenSpec capability (pull-request-review-agent) with proposal/design/tasks/spec artifacts defining gate status/risk semantics, evidence requirements, and guardrails.
  • Added a Windows GitHub Actions workflow to run the PR review agent on PR events and publish artifacts / comment a summary.
  • Added PowerShell implementation + tests to generate the report, run minimal validations based on changed paths, and enforce guards (secrets paths, repo boundary, GitNexus).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.github/workflows/pr-review-agent.yml Runs the gate on PR events, uploads report artifacts, and posts a PR comment summary.
scripts/pr-review-agent.ps1 CLI entrypoint wrapper for running the review agent locally/CI and exiting non-zero on blocked/failed.
scripts/lib/pr-review-agent.ps1 Core implementation: changed-path detection, guards, validation planner/runner, GitNexus integration, report generation.
scripts/tests/test-pr-review-agent.ps1 Script-level tests covering key fixtures (OpenSpec-only, missing OpenSpec, secret paths, retired runtime, GitNexus unavailable, planner).
openspec/changes/add-pr-review-agent/.openspec.yaml Declares the OpenSpec change metadata.
openspec/changes/add-pr-review-agent/proposal.md Motivation/scope for the PR review agent gate.
openspec/changes/add-pr-review-agent/design.md Design decisions and rollout guidance for the gate/workflow/script split.
openspec/changes/add-pr-review-agent/tasks.md Task checklist + validation notes for the change.
openspec/changes/add-pr-review-agent/specs/pull-request-review-agent/spec.md Capability spec defining requirements/scenarios for the gate behavior and evidence.
docs/PR_REVIEW_AGENT.md User-facing documentation for statuses, risk levels, report fields, rerun instructions, rollout.
docs/PROJECT_DEVELOPMENT_WORKFLOW.md Integrates the new gate into the repo’s PR workflow/checklist.
README.md Adds doc link + brief mention and local rerun snippet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +184 to +193
if ($p -match '^(\.github/workflows|scripts)/') {
$fullPath = Join-Path $RepoRoot ($p -replace '/', [System.IO.Path]::DirectorySeparatorChar)
if (Test-Path -LiteralPath $fullPath -PathType Leaf) {
$content = Get-Content -LiteralPath $fullPath -Raw -ErrorAction SilentlyContinue
foreach ($name in $Script:RetiredRuntimeNames) {
if ($content -match [regex]::Escape($name)) {
[void]$blockers.Add((New-PrReviewIssue -Kind 'retired_runtime_reference' -Severity 'high' -Path $p -Message "Workflow/script references retired runtime '$name'; keep retired services out of current runtime gates."))
break
}
}
Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +339 to +343
$record.command = 'gitnexus detect-changes'
try {
$output = & gitnexus detect-changes 2>&1 | Out-String
$exitCode = if ($LASTEXITCODE -is [int]) { $LASTEXITCODE } else { 0 }
$record.status = if ($exitCode -eq 0) { 'passed' } else { 'failed' }
Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +480 to +482
if ([string]::IsNullOrWhiteSpace($env:PR_REVIEW_AGENT_REQUIRE_AI)) {
[void]$warnings.Add((New-PrReviewIssue -Kind 'optional_ai_adapter_skipped' -Severity 'medium' -Message 'Optional AI adapter is not required for this gate and was skipped.'))
} elseif ([string]::IsNullOrWhiteSpace($env:OPENAI_API_KEY)) {
Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +85 to +87
$paths = @(git -c "safe.directory=$safeRoot" status --porcelain=v1 -uall 2>$null | ForEach-Object {
if ($_.Length -gt 3) { $_.Substring(3) }
})
Comment thread scripts/tests/test-pr-review-agent.ps1 Outdated
$loaded3 = Get-Content -LiteralPath $result3.json_path -Raw | ConvertFrom-Json
$secretBlockers = @($loaded3.blockers | Where-Object { $_.kind -eq 'secret_path' })
Assert-True ($secretBlockers.Count -ge 2) 'secret path blockers recorded'
Assert-True (($secretBlockers | ForEach-Object { $_.message }) -notmatch 'PASSWORD=|TOKEN=') 'secret values are not printed'
Comment on lines +22 to +45
- name: Run PR review agent
id: review
shell: pwsh
continue-on-error: true
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_DRAFT: ${{ github.event.pull_request.draft }}
GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }}
GITHUB_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
$args = @(
'-NoProfile',
'-ExecutionPolicy', 'Bypass',
'-File', 'scripts/pr-review-agent.ps1',
'-BaseSha', '${{ github.event.pull_request.base.sha }}',
'-HeadSha', '${{ github.event.pull_request.head.sha }}',
'-PrNumber', '${{ github.event.pull_request.number }}',
'-RunId', '${{ github.run_id }}',
'-OutputDir', 'artifacts/pr-review-agent'
)
if ($env:PR_DRAFT -eq 'true') {
$args += '-ReportOnly'
}
& powershell @args

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.

Implemented in e1ed8f6. I added explicit runner setup/install steps in .github/workflows/pr-review-agent.yml (Node 20, Python 3.12, global @fission-ai/openspec + gitnexus, pip install pytest, and npm ci --prefix bim-review-coordinator) before running the PR review agent.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac0025d48f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +81 to +83
if (-not [string]::IsNullOrWhiteSpace($BaseSha) -and -not [string]::IsNullOrWhiteSpace($HeadSha)) {
$paths = @(git -c "safe.directory=$safeRoot" diff --name-only $BaseSha $HeadSha 2>$null)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Compare PR changes from merge-base, not branch tips

Use a merge-base diff when collecting changed paths for PRs. git diff --name-only $BaseSha $HeadSha compares the two tip trees directly, so when main advances after the feature branch diverges, this includes unrelated base-branch edits and can trigger false blockers/extra validations for files the PR did not touch. This gate should mirror PR semantics (base...head or explicit merge-base) to avoid blocking valid PRs.

Useful? React with 👍 / 👎.

Comment on lines +188 to +191
foreach ($name in $Script:RetiredRuntimeNames) {
if ($content -match [regex]::Escape($name)) {
[void]$blockers.Add((New-PrReviewIssue -Kind 'retired_runtime_reference' -Severity 'high' -Path $p -Message "Workflow/script references retired runtime '$name'; keep retired services out of current runtime gates."))
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Limit retired-runtime scan to dependency wiring signals

The workflow/script content scan flags any textual mention of retired runtime names as a blocker, which creates self-inflicted false positives (for example, guard lists or test fixtures that intentionally mention _worker). In that case the gate reports retired_runtime_reference even when no runtime dependency is being reintroduced, so legitimate maintenance PRs on review scripts/workflows can be blocked.

Useful? React with 👍 / 👎.

Comment on lines +31 to +35
run: |
$args = @(
'-NoProfile',
'-ExecutionPolicy', 'Bypass',
'-File', 'scripts/pr-review-agent.ps1',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Provision GitNexus before enforcing this as a required gate

This workflow invokes the gate without installing gitnexus or relaxing the unavailable check, but the script hard-blocks code/script PRs when gitnexus is missing. On GitHub-hosted runners this can turn most non-doc PRs into permanent blocked failures even when the underlying changes are valid, because the tool dependency is unmet rather than the PR violating policy.

Useful? React with 👍 / 👎.

Comment on lines +23 to +24
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard module load so failures still emit a review artifact

The library is dot-sourced before entering the try block, so load/parse errors bypass the fallback report writer entirely. In that scenario the workflow gets no pr-review-agent.json/md (and upload fails with if-no-files-found: error), which removes the diagnostic output the gate is supposed to provide when report generation fails.

Useful? React with 👍 / 👎.

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +85 to +87
$paths = @(git -c "safe.directory=$safeRoot" status --porcelain=v1 -uall 2>$null | ForEach-Object {
if ($_.Length -gt 3) { $_.Substring(3) }
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Parse porcelain rename entries before path-based gating

When BaseSha/HeadSha are not provided, changed files come from git status --porcelain, but rename lines are returned as old -> new; taking Substring(3) leaves that combined token unchanged. That makes downstream path checks/planners miss the actual new path, so required validations or guardrails can be skipped during local reruns and other non-SHA executions.

Useful? React with 👍 / 👎.

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +339 to +341
$record.command = 'gitnexus detect-changes'
try {
$output = & gitnexus detect-changes 2>&1 | Out-String

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bind GitNexus detect-changes to the current repository

The gate runs gitnexus detect-changes without an explicit repo/worktree target, so environments with multiple indexed repos can return unrelated failures or unavailable even when GitNexus is installed. Because this status is treated as blocking for code/script changes, valid PRs can be rejected due to repo selection ambiguity rather than actual risk.

Useful? React with 👍 / 👎.

@monkey1sai
monkey1sai force-pushed the codex/openspec/add-pr-review-agent branch from b3bbe3d to 980ae59 Compare May 26, 2026 04:09
@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status warning
Risk medium
PR 120
Head codex/openspec/add-pr-review-agent / 980ae5976fe5faee3db5660ab12fffbc848f8d20
Base main / 26124a2b1654024466be029c10ef6faf57b94e1c

Blockers

  • None

Warnings

  • [medium] D:\a\AI-BIM-governance\AI-BIM-governance Validation command unavailable: openspec validate add-pr-review-agent. Command not found on PATH: openspec.
  • [medium] GitNexus detect changes did not pass: warning.
  • [medium] Optional AI adapter is not required for this gate and was skipped.

Validation Commands

  • openspec validate add-pr-review-agent
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-pr-review-agent.ps1

Checks

  • skipped openspec validate add-pr-review-agent (openspec)
  • passed script-level PR review agent tests (scripts)

Human Review Notes

  • OpenSpec changes detected: add-pr-review-agent

Agent-Logs-Url: https://github.com/monkey1sai/AI-BIM-governance/sessions/1693acf7-be4d-4911-a0c1-674ead2bceaf

Co-authored-by: monkey1sai <26239865+monkey1sai@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 980ae5976f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +529 to +530
if ($needsGitNexus -and $AllowGitNexusUnavailable -and $gitnexus.status -in @('unavailable', 'failed')) {
$gitnexus.status = 'warning'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not downgrade GitNexus execution failures to warning

-AllowGitNexusUnavailable is meant to tolerate missing tooling during rollout, but this branch also rewrites a real GitNexus failed result to warning. In that case code/script PRs can pass the gate even when gitnexus detect-changes executed and reported an error, which suppresses a required risk signal instead of only handling tool absence. Restrict the downgrade to unavailable so actual detect-changes failures still block.

Useful? React with 👍 / 👎.

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +83 to +87
$mergeBase = (git -c "safe.directory=$safeRoot" merge-base $BaseSha $HeadSha 2>$null | Select-Object -First 1)
if (-not [string]::IsNullOrWhiteSpace($mergeBase)) {
$paths = @(git -c "safe.directory=$safeRoot" diff --name-only $mergeBase $HeadSha 2>$null)
} else {
$paths = @(git -c "safe.directory=$safeRoot" diff --name-only "$BaseSha...$HeadSha" 2>$null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail gate when base/head diff cannot be resolved

When BaseSha/HeadSha are invalid or unavailable, both merge-base / diff failures are silently swallowed (2>$null) and the function falls back to local git status, which can yield an empty path list on clean checkouts. The agent then only emits a human note and can still return a non-blocking verdict, so required OpenSpec and validation checks may be skipped for the wrong commit range instead of failing fast on bad diff inputs.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/pr-review-agent.yml Outdated
Comment on lines +41 to +42
'-AllowGitNexusUnavailable',
'-AllowUnavailableCommands'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove global unavailable-command exception in CI gate

The workflow always passes -AllowUnavailableCommands, which converts every missing required validator (for example openspec, npm, python, or other planned commands returning unavailable) into a warning instead of a blocker. That makes the gate succeed even when deterministic checks never ran, so CI can report a healthy review verdict under runner/tooling drift rather than enforcing the required evidence.

Useful? React with 👍 / 👎.

Comment on lines +49 to +62
$report = [ordered]@{
schema_version = 'pr-review-agent/v1'
status = 'failed'
risk_level = 'high'
generated_at = (Get-Date).ToUniversalTime().ToString('o')
blockers = @([ordered]@{
kind = 'report_generation_failed'
severity = 'high'
path = ''
message = $message
})
warnings = @()
checks = @()
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep failure fallback report schema-compatible

The exception fallback writes a reduced JSON shape that omits documented core fields like changed_paths, openspec_changes, validation_commands, human_review_notes, and gitnexus. Any consumer that relies on the stable report schema can break exactly when the run fails, which is when diagnostics are most needed; the fallback should keep the same keys with empty/default values.

Useful? React with 👍 / 👎.

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +221 to +224
$content = Get-Content -LiteralPath $fullPath -Raw -ErrorAction SilentlyContinue
foreach ($name in $Script:RetiredRuntimeNames) {
if (Test-PrReviewRetiredRuntimeWiringReference -Content $content -RuntimeName $name) {
[void]$blockers.Add((New-PrReviewIssue -Kind 'retired_runtime_reference' -Severity 'high' -Path $p -Message "Workflow/script references retired runtime '$name'; keep retired services out of current runtime gates."))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid blocking on pre-existing retired-runtime text

Retired-runtime detection scans the full current file content for any matching wiring line whenever a workflow/script file is touched, instead of checking what this PR actually introduced. If a file already contains such a line from earlier history, unrelated edits to that file will still be blocked as a new violation, creating false blockers that are not attributable to the reviewed change.

Useful? React with 👍 / 👎.

Copilot AI commented May 26, 2026

Copy link
Copy Markdown
Contributor

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • edge.urm.nvidia.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --prefix web-viewer-sample 1 lude vendor/node_modules/.bin/as (dns block)
  • scarf.sh
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./report.js (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./report.js -I sh node�� node scripts/postinstall.js -I les/.bin/node rep -v &#39;^$&#39; uname /home/REDACTED/.cache/node-gyp/24./opt/hostedtoolcache/node/24.15.0/x64/lib/node_modul�� -I sh node�� y not exist if the input file didn&#39;t have any #includes. --64 node_modules/.bin/as s,tsx --report-ucc (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
openspec/changes/add-pr-review-agent/design.md (1)

1-122: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

OpenSpec 設計文件仍有大量非例外英文章節標題。

Line 1、Line 9、Line 28、Line 101、Line 110、Line 118 等屬於一般文件敘述,不是 parser required headers,請改為繁體中文以符合規範。

As per coding guidelines, "openspec/**/*.md: All OpenSpec artifacts must use Traditional Chinese (繁體中文); API paths, schema fields, CLI flags, status enums, logs/errors, external product names, and OpenSpec parser required headers must remain in original language".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/add-pr-review-agent/design.md` around lines 1 - 122, The
document contains several non-parser headers in English (e.g., "Context", "Goals
/ Non-Goals", "Decisions", "Risks / Trade-offs", "Migration Plan", "Open
Questions") that must be converted to Traditional Chinese per OpenSpec rules;
update those section titles and any other non-required-English subsection
headings to 繁體中文 while preserving parser-required tokens (API paths, schema
fields, CLI flags, status enums, logs/errors, external product names, and any
OpenSpec parser required headers such as exact keywords) in their original
language so the parser still recognizes them.
openspec/changes/add-pr-review-agent/tasks.md (1)

1-66: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

tasks 文件的非例外英文標題需改為繁體中文。

像 Line 1、Line 8、Line 18、Line 48 的英文標題/標示不屬於保留原文例外,請改成繁體中文。

As per coding guidelines, "openspec/**/*.md: All OpenSpec artifacts must use Traditional Chinese (繁體中文); API paths, schema fields, CLI flags, status enums, logs/errors, external product names, and OpenSpec parser required headers must remain in original language".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/add-pr-review-agent/tasks.md` around lines 1 - 66, Replace
the non-exception English section titles in tasks.md with Traditional Chinese:
change "1. Review Policy And Report Contract", "2. Local Review Agent Script",
"3. Automated Workflow Integration", "4. Tests And Fixtures", "5. Documentation
And Rollout", and "6. Validation" (and any other top-level/inline English
headings like "Review Policy And Report Contract", "Local Review Agent Script",
"Automated Workflow Integration", "Tests And Fixtures") into their 繁體中文
equivalents while preserving API paths, schema fields, CLI flags, status enums,
logs/errors, external product names, and any OpenSpec parser-required headers in
original language; update only the visible title strings (not code/flags) so the
file conforms to the OpenSpec Traditional Chinese requirement.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-review-agent.yml:
- Line 18: The workflow uses mutable action tags (e.g., "uses:
actions/checkout@v4" and other "uses: ...@v5") which weakens supply-chain
security; replace each mutable tag occurrence (the "uses:" entries found in the
diff such as the actions/checkout and the other `@v4/`@v5 references) with the
corresponding pinned commit SHA for that action repository, updating each
"uses:" line to reference the exact full SHA of the released commit instead of
the floating tag so the workflow is immutable and verifiable.
- Around line 19-20: The checkout step currently sets fetch-depth: 0 but leaves
repo credentials persisted; update the actions/checkout configuration by adding
persist-credentials: false to disable storing workflow checkout credentials in
the workspace (keep fetch-depth as needed), i.e., modify the actions/checkout
step properties to include persist-credentials: false so later network calls
don't reuse repository credentials.

In `@openspec/changes/add-pr-review-agent/proposal.md`:
- Around line 1-31: Translate all non-reserved top-level and subsection headings
in this document from English to Traditional Chinese (e.g., "Why" → "為何", "What
Changes" → "變更內容", "Capabilities" → "能力", "New Capabilities" → "新增能力", "Modified
Capabilities" → "修改後的能力", "Impact" → "影響") while preserving any reserved terms
exactly as-is (for example keep `pull-request-review-agent`, file paths like
`.github/`, `openspec/**/*.md`, and other code/API names unchanged); update only
the header text, do not alter body content, bullet lists, code snippets, or any
product/API identifiers referenced in the diff such as "GitNexus", "CODEOWNERS",
or `.env`.

In
`@openspec/changes/add-pr-review-agent/specs/pull-request-review-agent/spec.md`:
- Around line 5-167: The document keeps parser-required headers in English but
the rest of the human-readable requirement and scenario descriptions must be
converted to Traditional Chinese; update every Scenario/Requirement paragraph
(e.g., the blocks beginning with "Scenario: PR is opened or updated",
"Requirement: PR review agent publishes reviewable evidence", "Scenario: Review
report is created", etc.) replacing the English prose with 繁體中文 while preserving
literal API paths, CLI flags, schema field names, enums, logs/errors, product
names, and the parser-required header lines (the "Requirement:" and "Scenario:"
headings and any inline code tokens like `openspec/changes/<change-id>/` or
`openspec validate <change-id>` must remain unchanged). Ensure translations keep
the same meaning and that markers such as `status`, `risk_level`,
`changed_paths`, `openspec_changes`, and other code tokens remain verbatim.

In `@scripts/lib/pr-review-agent.ps1`:
- Around line 362-397: The code currently uses "return ,$record" which forces
$record into a single-element array and causes downstream ConvertTo-Json to emit
an array (gitnexus: [{...}]); change each "return ,$record" to return a single
object instead (for example replace with "return [pscustomobject]$record" or at
minimum "return $record") so the function returns an object rather than an
array; update all occurrences around the early-exit branches that reference the
$record variable (the returns after SkipGitNexus, SimulateUnavailable, gitnexus
CLI missing, and the final return) to use the non-comma return with
[pscustomobject]$record to ensure JSON serializes as an object.

---

Outside diff comments:
In `@openspec/changes/add-pr-review-agent/design.md`:
- Around line 1-122: The document contains several non-parser headers in English
(e.g., "Context", "Goals / Non-Goals", "Decisions", "Risks / Trade-offs",
"Migration Plan", "Open Questions") that must be converted to Traditional
Chinese per OpenSpec rules; update those section titles and any other
non-required-English subsection headings to 繁體中文 while preserving
parser-required tokens (API paths, schema fields, CLI flags, status enums,
logs/errors, external product names, and any OpenSpec parser required headers
such as exact keywords) in their original language so the parser still
recognizes them.

In `@openspec/changes/add-pr-review-agent/tasks.md`:
- Around line 1-66: Replace the non-exception English section titles in tasks.md
with Traditional Chinese: change "1. Review Policy And Report Contract", "2.
Local Review Agent Script", "3. Automated Workflow Integration", "4. Tests And
Fixtures", "5. Documentation And Rollout", and "6. Validation" (and any other
top-level/inline English headings like "Review Policy And Report Contract",
"Local Review Agent Script", "Automated Workflow Integration", "Tests And
Fixtures") into their 繁體中文 equivalents while preserving API paths, schema
fields, CLI flags, status enums, logs/errors, external product names, and any
OpenSpec parser-required headers in original language; update only the visible
title strings (not code/flags) so the file conforms to the OpenSpec Traditional
Chinese requirement.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 20d5ea97-fcd8-4c1d-9c23-528170a24586

📥 Commits

Reviewing files that changed from the base of the PR and between 26124a2 and e1ed8f6.

📒 Files selected for processing (12)
  • .github/workflows/pr-review-agent.yml
  • README.md
  • docs/PROJECT_DEVELOPMENT_WORKFLOW.md
  • docs/PR_REVIEW_AGENT.md
  • openspec/changes/add-pr-review-agent/.openspec.yaml
  • openspec/changes/add-pr-review-agent/design.md
  • openspec/changes/add-pr-review-agent/proposal.md
  • openspec/changes/add-pr-review-agent/specs/pull-request-review-agent/spec.md
  • openspec/changes/add-pr-review-agent/tasks.md
  • scripts/lib/pr-review-agent.ps1
  • scripts/pr-review-agent.ps1
  • scripts/tests/test-pr-review-agent.ps1

Comment thread .github/workflows/pr-review-agent.yml Outdated
Comment thread .github/workflows/pr-review-agent.yml
Comment thread openspec/changes/add-pr-review-agent/proposal.md Outdated
Comment thread openspec/changes/add-pr-review-agent/specs/pull-request-review-agent/spec.md Outdated
Comment thread scripts/lib/pr-review-agent.ps1 Outdated
@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status warning
Risk medium
PR 120
Head codex/openspec/add-pr-review-agent / 66a4c668b260cd850e98090d0696ff3f38f400ec
Base main / 26124a2b1654024466be029c10ef6faf57b94e1c

Blockers

  • None

Warnings

  • [medium] GitNexus detect changes did not pass: warning.

Validation Commands

  • openspec validate add-pr-review-agent
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-pr-review-agent.ps1

Checks

  • passed openspec validate add-pr-review-agent (openspec)
  • passed script-level PR review agent tests (scripts)

Human Review Notes

  • OpenSpec changes detected: add-pr-review-agent
  • Optional AI adapter is not required by policy and was skipped.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66a4c668b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/pr-review-agent.yml Outdated
Comment on lines +35 to +38
npm install -g @fission-ai/openspec gitnexus
python -m pip install --upgrade pip
python -m pip install pytest
npm ci --prefix bim-review-coordinator

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Install all owner dependencies before running planned checks

The workflow only provisions bim-review-coordinator dependencies (npm ci --prefix bim-review-coordinator) plus pytest, but the agent can plan npm run verify for web-viewer-sample and Python tests in bim-streaming-server for matching path changes (scripts/lib/pr-review-agent.ps1, validation plan). On those PRs, commands exist but fail due to missing project dependencies, producing validation_failed blockers unrelated to the actual patch and effectively turning the gate into a false blocker for viewer/streaming changes.

Useful? React with 👍 / 👎.

Comment on lines +212 to +214
if ($isEnvValue) {
[void]$blockers.Add((New-PrReviewIssue -Kind 'secret_path' -Severity 'critical' -Path $p -Message 'PR modifies a real environment file; do not change secret values in repo.'))
} elseif ($isEnvExample) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Allow secret-file deletions to pass path guards

The guard blocks any changed path named like .env/private-key patterns without checking change type, but Get-PrReviewChangedPathsFromGit only returns names (not A/M/D), so deletions are treated the same as additions/edits. This means a PR that removes an accidentally committed .env or key file is still hard-blocked as secret_path, which can prevent urgent remediation of leaked secrets.

Useful? React with 👍 / 👎.

Comment thread scripts/lib/pr-review-agent.ps1 Outdated
Comment on lines +222 to +223
if ($p -match '^(\.codex/skills|\.claude/skills/generated|\.gitnexus)(/|$)') {
[void]$blockers.Add((New-PrReviewIssue -Kind 'generated_tooling_path' -Severity 'high' -Path $p -Message 'Generated local tooling state must not be committed as product source.'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Permit cleanup of generated-tooling paths

Generated-tooling paths (.codex/skills, .claude/skills/generated, .gitnexus) are always emitted as blocking findings based on path name alone, with no status check for deletion. Because changed paths are collected via --name-only, a PR that only removes mistakenly committed generated state is still blocked as generated_tooling_path, which discourages or prevents the intended repository cleanup.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status blocked
Risk high
PR 120
Head codex/openspec/add-pr-review-agent / 0dc3ef9e1fb22d66f2e6b23668f80e52fcd340d8
Base main / 26124a2b1654024466be029c10ef6faf57b94e1c

Blockers

  • [high] GitNexus detect changes executed but failed. node.exe : GitNexus: No indexed repositories found. Run: gitnexus analyze
    At C:\npm\prefix\gitnexus.ps1:24 char:5
  • & "node$exe"  "$basedir/node_modules/gitnexus/dist/cli/index.js"  ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (GitNexus: No in...itnexus analyze:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

Warnings

  • None

Validation Commands

  • openspec validate add-pr-review-agent
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-pr-review-agent.ps1

Checks

  • passed openspec validate add-pr-review-agent (openspec)
  • passed script-level PR review agent tests (scripts)

Human Review Notes

  • OpenSpec changes detected: add-pr-review-agent
  • Optional AI adapter is not required by policy and was skipped.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0dc3ef9e1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

foreach ($path in $ChangedPaths) {
$p = ConvertTo-PrReviewPath $path
if ($p -match '^(scripts|bim-review-coordinator|web-viewer-sample|bim-streaming-server|tests)/') {
if ($p -notmatch '\.(md|txt|json|png|jpg|jpeg|svg|html)$') { return $true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require GitNexus for JSON changes in owned code directories

Remove json from the non-code extension allowlist here, because this currently treats any *.json edit under scripts/, bim-review-coordinator/, web-viewer-sample/, bim-streaming-server/, and tests/ as not requiring GitNexus. That lets behavior-affecting changes (for example package.json, lock/config JSON, or runtime test fixtures) bypass the intended gitnexus detect-changes gate and merge without the required impact evidence.

Useful? React with 👍 / 👎.

Comment on lines +132 to +133
if ([string]::IsNullOrWhiteSpace($BaseSha) -or [string]::IsNullOrWhiteSpace($HeadSha)) {
return $false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Detect deletions in non-SHA runs before applying path guards

Fresh evidence for the earlier deletion-guard concern: Test-PrReviewDeletedPath now returns false whenever BaseSha/HeadSha are omitted, while the agent still supports non-SHA executions via git status --porcelain fallback. In those local/non-CI runs, deleting .env, key-like files, or generated-tooling paths is misclassified as a modification and gets blocked instead of warned, which breaks the documented cleanup/remediation path outside SHA-based CI contexts.

Useful? React with 👍 / 👎.

'-NoProfile',
'-ExecutionPolicy', 'Bypass',
'-File', 'scripts/pr-review-agent.ps1',
'-BaseSha', '${{ github.event.pull_request.base.sha }}',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compute diff from live base branch, not PR base SHA snapshot

Passing github.event.pull_request.base.sha into the gate can miscompute changed paths after the base branch advances, because GitHub keeps the PR base commit snapshot rather than updating it to the latest base-branch tip. In that scenario, merge-base is computed against an old base commit and the gate can include base-only files, causing unrelated blockers/validations on otherwise valid PR updates.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status warning
Risk medium
PR 120
Head codex/openspec/add-pr-review-agent / 0cec310971535779260b319012d8d392b1647054
Base main / 26124a2b1654024466be029c10ef6faf57b94e1c

Blockers

  • None

Warnings

  • [medium] GitNexus detect changes did not pass: warning.

Validation Commands

  • openspec validate add-pr-review-agent
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-pr-review-agent.ps1

Checks

  • passed openspec validate add-pr-review-agent (openspec)
  • passed script-level PR review agent tests (scripts)

Human Review Notes

  • OpenSpec changes detected: add-pr-review-agent
  • Optional AI adapter is not required by policy and was skipped.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cec310971

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

$needsGitNexus = Test-PrReviewNeedsGitNexus -ChangedPaths $ChangedPaths
$gitnexus = Invoke-PrReviewGitNexus -NeedsGitNexus:$needsGitNexus -SkipGitNexus:$SkipGitNexus -AllowUnavailable:$AllowGitNexusUnavailable -SimulateUnavailable:$SimulateGitNexusUnavailable -SimulateFailure:$SimulateGitNexusFailure -RepoName $RepoRoot

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pass indexed repo alias to GitNexus detect-changes

This call passes the filesystem root ($RepoRoot) as --repo, but the workflow indexes GitNexus with the alias AI-BIM-governance (gitnexus analyze --name AI-BIM-governance ...), so detect-changes can report repository-unavailable even when GitNexus is installed. Fresh evidence in this commit is the mismatch between alias creation in .github/workflows/pr-review-agent.yml and this invocation, which makes gate outcomes depend on repo-name mismatch instead of actual PR risk.

Useful? React with 👍 / 👎.

Comment on lines +236 to +238
if ($p -in @('README.md', 'AGENTS.md') -or $p -eq 'docs/PROJECT_DEVELOPMENT_WORKFLOW.md') {
return $true
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exempt docs-only PRs from mandatory OpenSpec gating

These conditions force OpenSpec for README.md, AGENTS.md, and docs/PROJECT_DEVELOPMENT_WORKFLOW.md, so a pure documentation/refactor PR touching those files is blocked as missing_openspec even without behavior changes. That contradicts the documented checklist allowing docs/refactor exceptions, and will create false blockers for governance/doc maintenance PRs.

Useful? React with 👍 / 👎.

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.

3 participants