Skip to content

fix(governance): reject rate-limited review status as semantic evidence - #1347

Open
seonghobae wants to merge 24 commits into
developfrom
fix/pr-governance-coderabbit-rate-limit-evidence
Open

fix(governance): reject rate-limited review status as semantic evidence#1347
seonghobae wants to merge 24 commits into
developfrom
fix/pr-governance-coderabbit-rate-limit-evidence

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fail closed when a CodeRabbit legacy commit status says success but authoritative current-head PR evidence says semantic review did not start because the review quota was exhausted. The gate removes only that contradictory successful legacy status before the unchanged structured-review evaluator consumes evidence; branch protection, required checks, and approval policy are not weakened.

Root cause and remediation

scripts/ci/pr_governance_gate.sh accepted current-head CodeRabbit evidence from either check-runs or legacy commit statuses. A quota-limited CodeRabbit attempt can leave a successful legacy status while a current-head CodeRabbit comment explicitly says Review limit reached / we couldn't start this review. That contradictory success suppressed the structured OpenCode fallback and could make readiness evidence look stronger than the semantic review that actually ran.

The branch now:

  • hardens PATH before resolving the real GitHub CLI under GitHub Actions;
  • preserves fail-closed defaults when current-head check-run or commit-status lookups fail and publishes an explicit blocker instead of falling through an ERR trap;
  • normalizes only contradictory successful CodeRabbit legacy status evidence when a current-head provider comment proves semantic review did not start;
  • uses a deterministic fake-CLI JSON fixture and a minimal child-process environment rather than ambient process controls.

All previously actionable CodeRabbit review threads are resolved. The remaining formal CodeRabbit reviews are dismissed predecessor-head evidence and do not constitute current-head approval.

Current-base reconciliation

The prior exact candidate was synchronized only to develop@c14c4912149e65af520843b1321b654d08469e24. Protected develop subsequently advanced by 26 commits to bc98789521d21271e84789888413c182aa111b4d. That protected-base delta changes topic-intelligence/backend-tool documentation and implementation paths but does not touch any of this PR's three paths.

The branch was therefore reconciled by a normal non-forced two-parent merge that preserves protected develop everywhere except the three already-reviewed governance paths. No destructive rebase or force-push was used.

Exact candidate

  • Protected base: develop@bc98789521d21271e84789888413c182aa111b4d.
  • Current head: 85e0711ac0af1f592f0b59ad8942af3b19d8b14c.
  • Behind protected base: 0; merge-base is the exact protected base.
  • Changed files: exactly 3:
    • backend/tests/test_pr_governance_rate_limit.py
    • scripts/ci/pr_governance_gate.sh
    • scripts/ci/pr_governance_gate_impl.sh
  • Predecessor head af89a6536227c13ef56d5bc29c4291d0392e0be2 had Application CI, SAST Semgrep, Security Scan, Dependency Review, Docker, and Bandit terminal-success. Those results are historical after the current-base merge and are not counted for this head.
  • Current exact-head repository workflows are queued and therefore non-passing.
  • No qualifying independent current-head approval is present. Dismissed predecessor-head CodeRabbit evidence is non-passing, and model/bot evidence does not manufacture the organization-required human approval.

Merge boundary

Merge only after the unchanged exact current head satisfies every live required CI/security/coverage/container/review context, all actionable current-head review threads are resolved, and a qualifying independent non-author current-head approval satisfies the live organization ruleset and last-push requirement. Pending, queued, skipped-required, stale, predecessor-head, rate-limited, status-only, author-only, or model-only evidence is non-passing.

Summary by CodeRabbit

  • Bug Fixes

    • Improved pull request governance checks for commit-status lookup failures.
    • Required checks now correctly block merge readiness when skipped or neutral.
    • Prevented ambient environment settings from affecting governance evaluations.
    • Added safeguards against publishing results for stale pull request revisions.
  • Reliability

    • Improved validation, retry handling, failure behavior, and cleanup during governance checks.
    • Preserved the original blocking reason when status lookups fail.
    • Ensured unavailable review signals and failed evaluations are handled conservatively.

Open in Devin Review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 58 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cda1c1c1-99ef-4eb8-8820-5fcff93aeed2

📥 Commits

Reviewing files that changed from the base of the PR and between 3f69320 and 3f2389b.

📒 Files selected for processing (3)
  • backend/tests/test_pr_governance_rate_limit.py
  • scripts/ci/pr_governance_gate.sh
  • scripts/ci/pr_governance_gate_impl.sh
📝 Walkthrough

Walkthrough

The PR separates the governance gate wrapper from its evaluator. It adds trusted CLI and repository validation, current-head governance checks, gate result publication, and deterministic tests for API failures and required-check states.

Changes

PR governance gate

Layer / File(s) Summary
CLI wrapper and evaluator entrypoint
scripts/ci/pr_governance_gate.sh
The wrapper restores the Actions PATH, resolves the real gh executable, validates owner/repo, filters matching review-unavailable statuses, and delegates evaluation.
Evaluation state and publication foundation
scripts/ci/pr_governance_gate_impl.sh
The evaluator initializes state, handles failures, retries unknown merge states, protects against stale heads, and manages check runs and marker comments.
PR governance evidence evaluation
scripts/ci/pr_governance_gate_impl.sh
The evaluator checks PR state, review threads, required checks, current-head review evidence, issue comments, and review comments.
Gate outcomes and regression coverage
scripts/ci/pr_governance_gate_impl.sh, backend/tests/test_pr_governance_rate_limit.py
The gate publishes blocker, waiting, or ready results. Tests use JSON fake-CLI configuration and cover API failures, ambient-variable isolation, and skipped or neutral required checks.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: 🟡 Moderate · up to 3f693

The PR improves rate-limit handling and lookup failures, but a current failure path can still report success after status filtering fails, potentially making required semantic review evidence appear unblocked; this should be fixed before merge. Repository-name validation also needs a minor tightening follow-up.

Sequence Diagram(s)

sequenceDiagram
  participant Test as regression test
  participant Gate as pr_governance_gate.sh
  participant GH as GitHub CLI
  participant Impl as pr_governance_gate_impl.sh
  participant Check as GitHub check run
  Test->>Gate: run governance gate
  Gate->>GH: read PR comments and current-head statuses
  GH-->>Gate: return configured responses
  Gate->>Impl: execute with filtered status data
  Impl->>GH: evaluate PR state and review evidence
  Impl->>Check: publish blocker, waiting, or ready result
  Impl-->>Test: return gate outcome
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main governance change: rejecting rate-limited review status as valid semantic evidence.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pr-governance-coderabbit-rate-limit-evidence

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.

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

PR governance metadata gate is not ready for 3f2389b0e41e080e8d790d7a4a97899ff4cecc48:

  • Review decision is CHANGES_REQUESTED; address requested changes before merge.
  • Required check strix is FAILURE on the current head.

@seonghobae
seonghobae marked this pull request as ready for review August 15, 2026 01:50
coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae dismissed coderabbitai[bot]’s stale review August 15, 2026 04:26

Stale predecessor-head review. It evaluated e9ca94e; both actionable review threads were subsequently marked addressed by CodeRabbit on later commits. Current exact head 166c8e9 has fresh same-head repository CI/security/coverage/opencode success. Dismissing the predecessor review does not count as current independent approval; a fresh qualifying review remains required.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

@seonghobae
seonghobae dismissed coderabbitai[bot]’s stale review August 15, 2026 06:55

The requested fixture-isolation finding was addressed on current head 51ae919, and the corresponding CodeRabbit thread is resolved. Dismissing this predecessor-head CHANGES_REQUESTED state removes only stale blocking evidence; it does not constitute approval or satisfy the independent-review requirement.

Copy link
Copy Markdown
Contributor Author

@opencode-agent review current exact head af89a6536227c13ef56d5bc29c4291d0392e0be2. Review the complete governance evidence-normalization diff and publish a formal GitHub review verdict anchored to this SHA. All repository CI, security, dependency, and container workflows are terminal-success; all actionable inline findings are resolved. Rate-limited or status-only evidence is not a semantic verdict.

@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 6336b9e6439f1e32f2c5719cc60be97446aab93e.

  • Head SHA: 6336b9e6439f1e32f2c5719cc60be97446aab93e

  • Workflow run: 32120046109

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: test_pr_governance_rate_limit.py"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: test_pr_governance_rate_limit.py"]
  R1 --> V1["backend tests"]
  Evidence --> S2["CI script (2 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (2 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
Loading

@opencode-agent

opencode-agent Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: b67ac4c70d83cd952c97c1ff13bb4af7bfc3e5d3
  • Workflow run: 32250930904
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head b67ac4c70d83cd952c97c1ff13bb4af7bfc3e5d3.

  • Head SHA: b67ac4c70d83cd952c97c1ff13bb4af7bfc3e5d3

  • Workflow run: 32250930904

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: test_pr_governance_rate_limit.py"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: test_pr_governance_rate_limit.py"]
  R1 --> V1["backend tests"]
  Evidence --> S2["CI script (2 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (2 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
Loading

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 19, 2026

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head b67ac4c70d83cd952c97c1ff13bb4af7bfc3e5d3.

  • Head SHA: b67ac4c70d83cd952c97c1ff13bb4af7bfc3e5d3

  • Workflow run: 32250930904

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: test_pr_governance_rate_limit.py"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: test_pr_governance_rate_limit.py"]
  R1 --> V1["backend tests"]
  Evidence --> S2["CI script (2 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (2 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
Loading

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 21, 2026 13:41
@seonghobae
seonghobae enabled auto-merge (squash) August 21, 2026 14:32
@opencode-agent
opencode-agent Bot disabled auto-merge August 21, 2026 15:39
@opencode-agent opencode-agent Bot added priority: medium Normal-priority or P2 work status: blocked Blocked by conflict, dependency, or required prerequisite type: bug Defect or incorrect behavior labels Aug 22, 2026
… normalization notes (#1347)

- Cache the entrypoint's issue-comments snapshot to a shared temp file and
  have the evaluator reuse it, cutting one issues/<pr>/comments API call
  per gate run on a rate-sensitive path.
- A transient comments-endpoint failure inside the status interception no
  longer fails the commit-status read; it passes the original payload
  through and the evaluator's own lookup still fails closed.
- Surface wrapper stderr diagnostics (ignored-status note) on the success
  path instead of swallowing them in the error-file capture.
- Document the exported-function constraint next to 'export -f gh'.
- Add three regression tests: comments-outage decoupling, diagnostic
  surfacing, and one-fetch-per-run dedupe.
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Current-head verification

  • Exact head SHA: e97fa1e4deb6b711d61735376709805973829cbb
  • Exact base SHA: e5e99b4e3bb081b92c602358878856536030e2ca
  • Root-cause fix: repository API-scope validation now accepts only GitHub owner/repository identifiers; metacharacter, whitespace, and newline cases are regression-tested.
  • The latest protected base was merged into this branch before push; all predecessor evidence is discarded.
  • Local verification: 12 passed governance tests, 44 passed local HTTP/URL tests, shell syntax checks, and git diff --check.
  • Hosted Checks and independent review are pending for this exact head; no merge claim is made until the protected gates and current-head review are satisfied.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 16:17
@seonghobae
seonghobae enabled auto-merge (squash) August 25, 2026 16:57
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head maintenance evidence

  • Repository: ContextualWisdomLab/naruon
  • Pull request: #1347
  • Exact head SHA: 48cf095768203f2a1a3c98ff447d5293b7176d86
  • Exact base SHA: e5e99b4e3bb081b92c602358878856536030e2ca
  • Source finding fixed: review-unavailable normalization now fails closed when its jq parser fails or produces a non-numeric count; it cannot strip successful semantic-review status evidence on parser error.
  • Verification: bash -n scripts/ci/pr_governance_gate.sh scripts/ci/pr_governance_gate_impl.sh; bash scripts/ci/test_pr_governance_gate.sh (PASS); uv run pytest backend/tests/test_pr_governance_rate_limit.py -q (13 passed); git diff --check.
  • Review disposition: remaining current-head Devin notes are informational and have been checked against the wrapper/evaluator contract; no unresolved substantive source finding remains.
  • Hosted state: required Checks were recreated for this exact head and are queued; normal protected auto-merge remains enabled, but no hosted pass or merge is claimed.
  • Decision: WAIT_AND_REMEDIATE until exact-head required Checks and lawful review evidence complete. No bypass, direct push, or force push.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 17:10
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head validation update

  • Pull request: fix(governance): reject rate-limited review status as semantic evidence #1347
  • Exact head SHA: f9e1751
  • Exact base SHA: e5e99b4
  • Root cause fixed: the wrapper-created comments snapshot now has a cleanup trap before PR-number validation, so no-PR and malformed-PR early exits cannot leak the temp file.
  • Local verification: 14 governance regression tests passed; shell self-test passed; bash syntax, Ruff, compileall, and git diff --check passed.
  • Current hosted state: exact-head Checks were recreated with 0 completed failures, 0 in progress, and 21 queued. Two current review threads remain only for the just-fixed cleanup and an informational status-read behavior.
  • Decision: WAIT_AND_REMEDIATE until exact-head hosted review/check evidence refreshes; no bypass.

@seonghobae
seonghobae enabled auto-merge (squash) August 25, 2026 17:33

@devin-ai-integration devin-ai-integration 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.

Devin Review found 3 new potential issues.

Open in Devin Review

Comment thread scripts/ci/pr_governance_gate.sh
Comment thread scripts/ci/pr_governance_gate.sh
Comment thread scripts/ci/pr_governance_gate_impl.sh
@opencode-agent
opencode-agent Bot disabled auto-merge August 25, 2026 17:47
@seonghobae
seonghobae enabled auto-merge (squash) August 25, 2026 17:49
@seonghobae

Copy link
Copy Markdown
Contributor Author

Maintainer disposition for the current exact head f9e1751: the three Devin observations are informational and do not identify a source defect.

  • scripts/ci/pr_governance_gate.sh: the diagnostic is emitted only when the rate-limit marker is present; an absent CodeRabbit status makes the filter a no-op and does not alter the gate result.
  • scripts/ci/pr_governance_gate.sh: the current wrapper callers pass the API endpoint in the documented positional slot; changing that interface is outside this PR.
  • scripts/ci/pr_governance_gate_impl.sh: the wrapper snapshot is created before its consumer; fetch failure leaves it empty and the implementation fails closed by refetching.

The current diff already includes the required cleanup trap and its regression test. No code change is warranted for these non-blocking observations; the threads can be resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 31, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: medium Normal-priority or P2 work status: blocked Blocked by conflict, dependency, or required prerequisite type: bug Defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant