Skip to content

fix(code-reviewer) council decision gate#4617

Merged
St0rmz1 merged 3 commits into
mainfrom
feat/council-decision-gate
Jul 17, 2026
Merged

fix(code-reviewer) council decision gate#4617
St0rmz1 merged 3 commits into
mainfrom
feat/council-decision-gate

Conversation

@St0rmz1

@St0rmz1 St0rmz1 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

The Code Reviewer Council computes its governance decision in code (the model
reports findings only), but the PR previously showed per-specialist votes with
no decision, and the decision was not wired into the merge gate. This change
makes the council decision drive both the posted PR summary and the merge-gate
check, with the presentation code-owned so a model-authored table or verdict
cannot contradict the computed result.

Changes

  • Render the Council Review section in code (buildCouncilReviewSection in
    code-review-council.ts): a title-cased ## Council Review heading, the
    decision, a per-specialist table (specialist, model, highest severity,
    finding count), and a governance-mode line. The coordinator prompt no longer
    writes its own table or verdict.
  • Inject that section into the posted review comment idempotently via marker
    delimiters (upsertCouncilVerdictInBody), replacing the block in place on
    re-runs. Folded into the existing summary footer/history update, so each
    completed council review does one comment fetch and one update instead of two.
  • Derive the merge gate from the code-owned decision in the status callback. A
    single councilGates flag (a completed council review that is not a manual
    run) drives both the gate result and the section wording, so enforcement and
    the comment stay consistent across GitHub and GitLab. Advisory never gates; a
    block under Unanimous or Majority fails the check. Manual runs report the
    decision but do not block merge.
  • finalizeCouncilResultForReview now returns the persisted
    CodeReviewCouncilResult so the callback can read the decision for the gate
    and the comment.

Verification

Manually verified in local provider mode against test pull requests with
intentional issues:

  • Council review posts the ## Council Review section (decision,
    governance, per-specialist table) to the PR, matching the stored result.
  • Advisory governance shows no merge decision (report only); Unanimous with
    a blocking finding shows a block decision.
  • Multiple models per specialist render in the table.
  • The summary comment updates in place on re-runs (single fetch/update).

Not exercised as a live block: council is manual-only today and manual runs
never create a gate check, so the blocking path is covered by automated tests
rather than a real merge block.

Visual Changes

N/A (no application UI). The change affects the Markdown of the posted PR/MR
review comment.

Reviewer Notes

  • The gate is dormant in practice today: council is manual-only, so
    councilGates is always false and no current review hard-blocks. The wiring
    activates for automated council reviews (which get a check run) if those exist
    later. This matches the intended "post the decision, do not hard-block yet"
    behavior.
  • Focus areas: the councilGates derivation and its use for both
    effectiveGateResult and the section wording (route.ts), and the idempotent
    comment injection folded into the footer/history update on both the GitHub and
    GitLab paths.

St0rmz1 added 2 commits July 17, 2026 08:46
  Wire the code-owned council decision into the merge gate and the PR
  summary.
  The council LLM never reports a gate result, so the status callback
  derives it
  from the computed decision: advisory never gates; a block under
  Unanimous or
  Majority fails the check run. The authoritative Council Review section
  (decision, governance mode, per-specialist table) is rendered by code
  and
  injected into the summary comment, idempotently and provider-mode
  only, so the
  model can no longer author a table or verdict that contradicts the
  result.
  Manual runs report the decision but state they do not block merge.
@kilo-code-bot

kilo-code-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commit fixes the previously flagged CodeQL incomplete-escaping issue in escapeTableCell by escaping backslashes before pipes, with a regression test covering the ordering; no new issues found.

Files Reviewed (2 files)
  • packages/worker-utils/src/code-review-council.ts
  • packages/worker-utils/src/code-review-council.test.ts
Previous Review Summary (commit 5ab3588)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 5ab3588)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the council decision-gate wiring (code-owned merge gate + injected PR summary verdict section) across all 7 changed files; no high-confidence correctness, security, or logic issues found in the changed lines.

Files Reviewed (7 files)
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.ts
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.test.ts
  • apps/web/src/lib/code-reviews/council/finalize-council-result.ts
  • apps/web/src/lib/code-reviews/prompts/council-prompt.ts
  • apps/web/src/lib/code-reviews/prompts/council-prompt.test.ts
  • packages/worker-utils/src/code-review-council.ts
  • packages/worker-utils/src/code-review-council.test.ts

Reviewed by claude-sonnet-5 · Input: 20 · Output: 2.5K · Cached: 359.5K

Review guidance: REVIEW.md from base branch main

Comment thread packages/worker-utils/src/code-review-council.ts Fixed
@St0rmz1
St0rmz1 merged commit 658d4a1 into main Jul 17, 2026
59 checks passed
@St0rmz1
St0rmz1 deleted the feat/council-decision-gate branch July 17, 2026 17:56
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