Skip to content

feat: council-review-action — reusable GitHub Action for CI council reviews #253

Description

@sonupreetam

Context

The complytime/org-infra project is prototyping a CI-based council review workflow
that uses OpenCode to run each Divisor persona, with agent definitions read dynamically
from the repo's .opencode/agents/divisor-*.md files. The pattern is implemented as a
custom three-workflow chain (collect → consumer → reusable) specific to that org.

Design decisions and rationale are documented in:
openspec/changes/council-review-orchestration/design.md (in complytime/org-infra)

org-infra is the prototype (design.md D8). The generic orchestration logic will be
extracted into this action after validation. org-infra then becomes a thin consumer
handling org-specific concerns (WIF auth, fork-safe chain) while calling this action
for the review itself.

What to extract from the prototype

The following logic is generic and belongs in this action, not in org-infra:

  • Agent discovery: Glob .opencode/agents/divisor-*.md, detect repo-local
    or use bundled fallback from the action
  • Prompt composition: Minimal CI instruction referencing review-council.md,
    review-pr.md, severity packs, and convention packs as methodology
  • Pre-fetch pattern: Collect CI checks, existing reviews, linked issues as JSON
    files for the model to read (no Shell access in CI)
  • opencode run invocation: With Vertex AI provider, prompt file, model selection
    (changed from claude -p --agents per ADR-001)
  • Output parsing: JSON with summary + inline_comments (path, line, body
    with severity and persona attribution)
  • Diff size guardrails: Hard limit for massive diffs, adaptive budget based on
    repo PR history, noise file filtering, spec file allowance
  • Fallback: Single-agent mode when no divisor-*.md files exist, comment mode
    when JSON parsing fails, skip mode when diff exceeds hard limit

What stays in the consuming org

  • Auth provider configuration (Vertex AI WIF, Bedrock, direct API key)
  • Fork-safe workflow chain (collect → consumer → reusable)
  • Secret forwarding and concurrency control
  • PR comment posting with bot marker deduplication
  • Old review cleanup (supersede stale bot reviews)

Acceptance criteria

  • Composite action extracts review logic from org-infra prototype
  • Agent discovery works (repo-local and bundled fallback)
  • Pre-fetch pattern covers review-pr.md methodology
  • Structured JSON output (summary + inline_comments) parsed correctly
  • Inline comments filtered to diff-visible lines
  • Fallback modes: single-agent, comment-only, review-skipped
  • Diff size guardrails: hard limit (10K), adaptive budget, noise filtering
  • End-to-end evidence: fix: truncate crapload comment when exceeding GitHub character limit complytime/org-infra#425
  • Pinned to a release SHA (not feature branch) before downstream distribution
  • At least 10 real PR reviews run successfully

Also considered (lower priority)

Activity

  1. self-assigned this
    on Jun 8, 2026
  2. moved this from Backlog to Ready 🚀 in Unbound Force Planningon Jul 14, 2026
  3. added a commit that references this issue on Jul 14, 2026
    4cf0d47
  4. moved this from Ready 🚀 to In Progress 📋 in Unbound Force Planningon Jul 14, 2026
  5. sonupreetam commented on Jul 14, 2026

    @sonupreetam
    ContributorAuthor

    Progress update

    PRs

    What changed from the original design

    • OpenCode over Claude Code CLI (ADR-001): opencode run replaces
      claude -p --agents — better Vertex AI integration, no permission flags
    • Diff size guardrails added beyond original scope:
      • Hard limit (max-raw-diff-lines, default 10K) — skips review for massive diffs
      • Adaptive budget (calibrate-budget.sh) — P75 of recent merged PRs + 2K spec allowance
      • Noise filtering (prepare-diff.sh) — excludes lock files, vendor, generated code
    • Diff line filtering (filter-diff-lines.py) — prevents GitHub API 422 errors
      on inline comments targeting lines outside diff hunks
    • Bot cleanup — supersedes old reviews, deletes stale inline comments
    • BYOK externalization tracked separately in feat: support BYOK provider credentials for external council-review-action usage #330

    Evidence

    complytime/org-infra#425:
    the council review posted an inline [HIGH] (Adversary) finding on the
    feature-branch SHA pin and identified a truncation off-by-one bug in a
    test change. Full chain: collect → consumer → reusable → action → inline review.

    Remaining

    • Pin action to a release SHA (not feature branch)
    • Accumulate 10+ real PR reviews before GA
  6. sonupreetam commented on Jul 15, 2026

    @sonupreetam
    ContributorAuthor

    Proposed: Review trigger strategy

    Currently the collect workflow triggers on every pull_request event
    (opened, synchronize, reopened, ready_for_review), meaning the AI
    review re-runs on every push. This is wasteful and noisy — early
    commits are often WIP, reviews get superseded, and each run costs tokens.

    Proposal: Change to review-once-then-on-demand:

    1. Trigger only on opened and ready_for_review (remove synchronize)
    2. Add a /re-review comment trigger (via issue_comment) for manual re-runs
    3. Optionally trigger on review_requested when re-requesting the bot

    This means the AI sets the baseline when the PR is first opened or
    marked ready, humans build on it, and the author can explicitly
    re-trigger after significant changes.

  7. added a commit that references this issue on Jul 15, 2026
    78c8a65
  8. added
    enhancement
    github_actions
    on Jul 15, 2026
  9. sonupreetam commented on Jul 16, 2026

    @sonupreetam
    ContributorAuthor

    Upstream tracking: complytime/nunya#384 (WIF for Vertex AI council review)

    Implementation PRs:

    Evidence: complytime/org-infra#427 (end-to-end validation, 8/8 inline comments on valid diff lines)

    Follow-up issues (post-merge):

  10. moved this from In Progress 📋 to In Review 👀 in Unbound Force Planningon Jul 23, 2026
  11. added a commit that references this issue on Jul 31, 2026
    84a7574
  12. added a commit that references this issue on Aug 3, 2026
    2febd30
  13. moved this from In Review 🏁 to Done ✔️ in Unbound Force Planningon Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgithub_actions

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions