Skip to content

feat(review-core): calibrate blocking rules and add R2 OpenCode cross-review - #44

Merged
cgl-agent-coordinator[bot] merged 1 commit into
mainfrom
feat/blocking-calibration-and-cross-review
Dec 4, 2026
Merged

cgl-agent-coordinator[bot] merged 1 commit into
mainfrom
feat/blocking-calibration-and-cross-review

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

AI assistance

  • Authored by antigravity@macbook (Gemini) under owner direction.

Changes

  • packages/review-core/provider.mjs:
    • Add ## Blocking vs. Advisory Calibration to buildReviewMessages so PR title/description wording scope mismatches, prose polish, and style preferences are reported as low (advisory) rather than blocking merges.
    • Add mergeCrossReviewVerdicts and optional OPENCODE_CROSS_REVIEW_MODEL dual-model cross-review in executeReviewWithFallback when crossReview is enabled (validates the cross-review model differs from OPENCODE_MODEL).
  • adapters/cloudflare-workflow/worker.mjs:
    • Pass crossReview: requiredProviderCountForReview(...) > 1 to executeReviewWithFallback so high-risk paths automatically trigger dual-model cross-review when configured.
  • tests/review-core.test.mjs:
    • Add unit tests for the calibration section and dual-model OpenCode cross-review behavior (enabled, disabled, and duplicate-model rejection).

Verification

  • Ran npm test: all 79 tests passed.

…-review

Add explicit Blocking vs. Advisory calibration so PR title/description
wording mismatches stay advisory instead of blocking merges.

When OPENCODE_CROSS_REVIEW_MODEL is configured and a PR touches high-risk
paths, run both OpenCode models in parallel and merge their verdicts.
@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.3)

The review-core changes are competently implemented and unit-tested (duplicate-model guard, fail-closed OR merge of verdicts, model validation), and no credentials or cloud-specific imports leak into packages/review-core. However, the feature's production trigger in worker.mjs is untested and unverifiable from the diff, the merged unresolved_findings flag is not derived from the merged findings (a fail-closed gap on the high-risk paths this feature is meant to harden), and the new blocking calibration's restrictive 'ONLY' list omits architecture boundary violations and silent error swallowing, conflicting with the repo's own review charter. unresolved_findings=true.

Reviewed commit: cad2a4fb25 · Coverage: complete · Unresolved findings: true

Findings

  • [MEDIUM] adapters/cloudflare-workflow/worker.mjs: The crossReview trigger is the only production wiring for this feature, yet it is untested and unverifiable from the diff. The hunk calls requiredProviderCountForReview({allFiles, diffText}) but the +5/-0 diff adds no import for it — if it is not already imported in worker.mjs this is a runtime ReferenceError that breaks every review and is invisible to npm test (which only covers review-core). Even if imported, using requiredProviderCountForReview(...) > 1 as the 'high-risk' proxy is unconfirmed: if that function counts configured providers rather than risk level, cross-review will fire for all PRs or for none. Add adapter-level test coverage (or at minimum confirm the import and the semantics of the > 1 proxy) before merge.
  • [MEDIUM] packages/review-core/provider.mjs: mergeCrossReviewVerdicts computes unresolved_findings by OR-ing each model's self-reported flag rather than deriving it from the merged findings. If either model returns an inconsistent verdict (e.g., a high finding with unresolved_findings: false), the merged verdict contains a high-severity finding while unresolved_findings=false, weakening the fail-closed gate on exactly the high-risk PRs dual review is supposed to harden. Set unresolved_findings=true whenever any merged finding is high/medium (nothing in the diff shows runOpenCodeReview normalizing this).
  • [MEDIUM] packages/review-core/provider.mjs: The new calibration rule instructs models to emit high/medium ONLY for an enumerated list ('concrete correctness bugs, security/credential/permission issues, breaking contract regressions, syntax/config errors, or missing critical tests') that omits architecture boundary violations and silent error swallowing — both first-class categories in this repo's review charter (AGENTS.md explicitly forbids cloud-specific imports in review-core). Taken literally, the 'ONLY' restriction invites the model to downgrade a review-core node:fs/cloudflare:* import violation to advisory low. Align the enumeration with the base checklist or explicitly add boundary violations and silent error swallowing to the blocking list.
  • [LOW] packages/review-core/provider.mjs: crossReview: true is silently ignored when OPENCODE_CROSS_REVIEW_MODEL is unset or when AI_REVIEW_PROVIDER is 'deepseek' — no log and no marker in the returned verdict. High-risk PRs can silently lose the dual-model safety net with no operator-visible signal. Log (or annotate the verdict) when cross-review is requested but skipped, and add tests for the unset-model and non-opencode-provider cases.
  • [LOW] packages/review-core/provider.mjs: The dual review uses Promise.all, so a secondary-model failure — including non-retryable errors such as an API-rejected cross-model name or a 4xx quota error — discards the already-completed primary verdict and fails the entire review. Failing closed is the right default, but on high-risk paths a secondary-model outage becomes 'no review at all'; consider catching the secondary error and surfacing it alongside the primary verdict, and add a test for secondary-failure behavior.
  • [LOW] packages/review-core/provider.mjs: mergeCrossReviewVerdicts drops any verdict fields beyond summary/unresolved_findings/findings and returns a composite model string ('glm-5.3+kimi-k2.5') that downstream consumers or model validation may not expect; the dedup key also includes severity, so the same issue reported at different severities by the two models is kept as two findings. Confirm downstream consumers read only these three fields and tolerate the composite model, or normalize explicitly.

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

@Pigbibi needs a human: merging this repository deploys; owner approval needed.

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

Autoland: escalated to the owner: merging this repository deploys; owner approval needed

@cgl-agent-coordinator
cgl-agent-coordinator Bot merged commit ffb9db1 into main Dec 4, 2026
14 checks passed
@cgl-agent-coordinator
cgl-agent-coordinator Bot deleted the feat/blocking-calibration-and-cross-review branch December 4, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant