feat(code-reviewer) Add council per repo webhook#4645
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe previously flagged gating gap in Files Reviewed (1 file)
Previous Review Summary (commit 3cc7822)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 3cc7822)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryA save-time gating gap in Overview
Issue Details (click to expand)WARNING
Files Reviewed (15 files)
Reviewed by claude-sonnet-5 · Input: 24 · Output: 4.8K · Cached: 498.1K Review guidance: REVIEW.md from base branch |
eshurakov
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds per-repository opt-in for Council reviews on automated (webhook) pull
requests. A repository listed in the new
council_enabled_repository_idsconfigfield runs the Council review type when its PRs are reviewed via webhook, using
the single org-level
councilconfig. Repositories not listed continue to get astandard review. This is the path that lets a Council review run automatically on
a PR (trigger, execute, post the verdict, and drive the merge gate) rather than
only from a manual run.
Changes
council_enabled_repository_idstoCodeReviewAgentConfigSchema(packages/db/src/schema-types.ts). Absent/emptymeans no repo runs Council automatically. Matched against the platform
repository ID the same way as
selected_repository_ids.pull-request-handler.ts): choose standard vs council perPR with
determineAutomatedReviewType, gated on an active council config, theper-repo opt-in, and entitlement. The entitlement lookup is a DB call, so it
only runs after the two cheap local checks pass; any missing condition falls
back to
standardso a bad or absent council config never blocks a review.worker-utils/code-review-council.ts): adddetermineAutomatedReviewType, returningcouncilonly when entitled, configactive, and the repo opted in.
ReviewConfigForm.tsx,ReviewAgentPageClient.tsx): restructurethe form into a Global Settings section (defaults every repo inherits) and a
master "Advanced Settings" toggle that reveals per-repo overrides: repository
selection, per-repo model, and per-repo Council toggles with a shared specialist
picker. Add
councilSelectionsFromConfigto hydrate the picker from a savedconfig.
organization-code-reviews-router.ts,code-reviews-router.ts):expose and persist
councilandcouncilEnabledRepositoryIdsingetReviewConfig/saveReviewConfig, with an entitlement guard that rejectssaving an active council config for a non-entitled org.
finalize-council-result.ts,code-review-status/[reviewId]/route.ts): let the council result fall back tothe org-level agent config for webhook reviews (which have no per-run manual
config) via
resolveOrgCodeReviewAgentConfigand anorgAgentConfigparam.Automated council reviews drive the merge gate and post the council verdict
section into the PR summary.
blocking finding" on a majority pass that actually had outvoted blocking votes;
it now states the outvoted block count.
(intersected with the live selection) instead of persisting a stale ID that
could keep the specialist picker open, block save on the minimum-specialist
check, or silently re-activate Council if the repo is re-added.
picker hydration, the org-config fallback, and the verdict-section copy.
Verification
pull_requestwebhook at a council-enabled,council-entitled org repo: confirmed it created a
councilreview, executed,posted the verdict section plus inline comments, and set the merge gate check to
failure(blocked). Pushed a fix and fired asynchronizewebhook: confirmed afresh council review ran, returned a pass decision, and flipped the gate check to
success(unblocked).Visual Changes
The code review config screen was restructured (Global Settings section + a master
Advanced Settings toggle exposing per-repo model and Council controls). Screenshots
to be added.
Reviewer Notes
determineAutomatedReviewTypeintentionally fails closed tostandard, so anymissing entitlement/config condition yields a normal review rather than an error.
common (standard) webhook path from adding a query.
council_enabled_repository_idsonlycontrols which repos opt that shared config into automated reviews. There is no
per-repo specialist config in this PR.