Skip to content

ci: reject OpenCode approvals without structural review#348

Merged
seonghobae merged 1 commit into
developfrom
fix/opencode-reject-missing-structure
Jun 18, 2026
Merged

ci: reject OpenCode approvals without structural review#348
seonghobae merged 1 commit into
developfrom
fix/opencode-reject-missing-structure

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

Summary

  • Reject OpenCode APPROVE control payloads that admit structural exploration failed, evidence was truncated, or changed files could not be inspected.
  • Apply the same check in both the Python normalizer and shell approval gate so runtime output and published comments follow the same contract.
  • Tighten OpenCode prompts so approval requires completed structural exploration, not merely absence of blocking findings.

Structural Exploration

  • Mandatory structural exploration completed before opening this PR.
  • CodeGraph is not initialized in this local worktree, so review used focused workflow/script/test call-path inspection.
  • Impact surface is limited to .github/workflows/opencode-review.yml, scripts/ci/opencode_review_normalize_output.py, scripts/ci/opencode_review_approve_gate.sh, and targeted policy tests.
  • The gate still accepts ordinary source-backed REQUEST_CHANGES findings and valid APPROVE payloads with empty findings; it now rejects only approvals whose reason/summary admit missing structural review.

Security Notes

  • OpenCode review output is untrusted CI-generated text; this adds fail-closed validation before it can publish an approval or drive the approval gate.
  • No new tokens, permissions, dependencies, network destinations, or third-party actions are introduced.
  • Safe failure mode is NO_CONCLUSION, which prevents an approval rather than requesting source changes without line-specific evidence.
  • Test points cover Python normalizer rejection, shell gate rejection, valid approval compatibility, workflow syntax, shell/Python syntax, bootstrap policy, and supply-chain policy.

Validation

  • python3 -m py_compile scripts/ci/opencode_review_normalize_output.py && bash -n scripts/ci/opencode_review_approve_gate.sh
  • uv run --project services/analysis-engine pytest services/analysis-engine/tests/test_supply_chain_policy.py::test_opencode_normalizer_rejects_approve_without_structural_review services/analysis-engine/tests/test_supply_chain_policy.py::test_opencode_review_gate_rejects_approve_without_structural_review services/analysis-engine/tests/test_supply_chain_policy.py::test_opencode_normalizer_defaults_missing_approve_findings services/analysis-engine/tests/test_supply_chain_policy.py::test_opencode_review_gate_defaults_missing_approve_findings -q
  • actionlint .github/workflows/opencode-review.yml
  • python3 scripts/checks/verify_github_bootstrap_policy.py
  • python3 scripts/checks/verify_supply_chain.py
  • git diff --check

Copilot AI review requested due to automatic review settings June 18, 2026 04:53
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

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

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

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

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 436dea1d-4144-46ba-a996-63a9d62a23eb

📥 Commits

Reviewing files that changed from the base of the PR and between 1f06099 and 856c3bf.

📒 Files selected for processing (4)
  • .github/workflows/opencode-review.yml
  • scripts/ci/opencode_review_approve_gate.sh
  • scripts/ci/opencode_review_normalize_output.py
  • services/analysis-engine/tests/test_supply_chain_policy.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/opencode-reject-missing-structure
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/opencode-reject-missing-structure

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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.

Copilot AI 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.

Pull request overview

This PR hardens the OpenCode robot-review merge gate by rejecting APPROVE control payloads that admit structural exploration could not be completed (e.g., truncated evidence or inability to inspect changed files), and aligns that contract across the workflow prompt, the Python normalizer, and the shell approval gate.

Changes:

  • Add structural-review failure detection to the Python OpenCode output normalizer and reject invalid APPROVE payloads.
  • Add the same structural-review failure detection to the shell approval gate so runtime gating matches published/normalized output.
  • Update the OpenCode workflow prompt to explicitly forbid approval when structural exploration/evidence inspection was not possible, and add targeted policy tests.

Reviewed changes

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

File Description
services/analysis-engine/tests/test_supply_chain_policy.py Adds regression tests ensuring approvals are rejected when the control payload admits missing structural review.
scripts/ci/opencode_review_normalize_output.py Rejects APPROVE control objects that contain structural-review failure phrases in reason/summary.
scripts/ci/opencode_review_approve_gate.sh Enforces the same structural-review failure rejection at gate time (fail-closed to NO_CONCLUSION).
.github/workflows/opencode-review.yml Tightens the review prompt so approval requires completed structural exploration and untruncated/inspectable evidence.

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

Comment thread scripts/ci/opencode_review_normalize_output.py Outdated
Comment thread scripts/ci/opencode_review_approve_gate.sh Outdated
@opencode-agent

opencode-agent Bot commented Jun 18, 2026

Copy link
Copy Markdown

OpenCode Review Overview

  • Head SHA: 856c3bf0ce92ad8034f1f05cd54003eb6030f7e1
  • Workflow run: 27738826355
  • Workflow attempt: 1
  • Gate result: APPROVE (approval step)

Pull request overview

Reviewed changes in PR #348, including workflow updates and test additions. No critical issues or regressions identified. The changes align with the project's architecture and contracts.

Findings

No blocking findings from OpenCode's independent review.

Verification

  • Review source: independent OpenCode review of the current checkout, focused changed hunks, and current-head GitHub Check evidence.
  • Result: APPROVE
  • Reason: No source-backed blockers found; structural exploration completed without issues.

Gate evidence

  • Head SHA: 856c3bf0ce92ad8034f1f05cd54003eb6030f7e1
  • Workflow run: 27738826355
  • Workflow attempt: 1

opencode-agent[bot]
opencode-agent Bot previously approved these changes Jun 18, 2026

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

Pull request overview

The changes in PR #348 include updates to workflow files and test scripts, with no critical issues identified. The changes are well-contained and do not introduce regressions or security risks. Structural exploration confirmed the changes are safe and do not affect critical paths.

Findings

No blocking findings from OpenCode's independent review.

Verification

  • Review source: independent OpenCode review of the current checkout, focused changed hunks, and current-head GitHub Check evidence.
  • Result: APPROVE
  • Reason: No critical issues found in the changes. Structural exploration completed without identifying blockers.

Gate evidence

  • Head SHA: d0bec83f97f5433b1fced95cbfa4c3da29bd86e0
  • Workflow run: 27737594548
  • Workflow attempt: 1

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 05:15
@seonghobae seonghobae force-pushed the fix/opencode-reject-missing-structure branch from 3aac995 to 472bc95 Compare June 18, 2026 05:15

Copilot AI 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.

Pull request overview

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

Comment thread scripts/ci/opencode_review_normalize_output.py
Comment thread scripts/ci/opencode_review_approve_gate.sh
opencode-agent[bot]
opencode-agent Bot previously approved these changes Jun 18, 2026

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

Pull request overview

PR adds robust test coverage for supply chain policy validation and makes minor workflow improvements. No regressions found in structural exploration.

Findings

No blocking findings from OpenCode's independent review.

Verification

  • Review source: independent OpenCode review of the current checkout, focused changed hunks, and current-head GitHub Check evidence.
  • Result: APPROVE
  • Reason: Changes maintain functionality while adding comprehensive tests

Gate evidence

  • Head SHA: 472bc95de6d3fe8ce2c79f04fd85ab114ba6aac6
  • Workflow run: 27738339120
  • Workflow attempt: 1

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

Pull request overview

Reviewed changes in PR #348, including workflow updates and test additions. No critical issues or regressions identified. The changes align with the project's architecture and contracts.

Findings

No blocking findings from OpenCode's independent review.

Verification

  • Review source: independent OpenCode review of the current checkout, focused changed hunks, and current-head GitHub Check evidence.
  • Result: APPROVE
  • Reason: No source-backed blockers found; structural exploration completed without issues.

Gate evidence

  • Head SHA: 856c3bf0ce92ad8034f1f05cd54003eb6030f7e1
  • Workflow run: 27738826355
  • Workflow attempt: 1

@seonghobae seonghobae merged commit 513776a into develop Jun 18, 2026
26 checks passed
@seonghobae seonghobae deleted the fix/opencode-reject-missing-structure branch June 18, 2026 05:41
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