Skip to content

feat: add council-review-action composite GitHub Action - #336

Merged
jflowers merged 10 commits into
unbound-force:mainfrom
sonupreetam:feat/council-review-action-v2
Jul 31, 2026
Merged

jflowers merged 10 commits into
unbound-force:mainfrom
sonupreetam:feat/council-review-action-v2

Conversation

@sonupreetam

@sonupreetam sonupreetam commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a composite GitHub Action (council-review-action/) for AI-assisted
code review using OpenCode on Vertex AI. Extracted from the
complytime/org-infra prototype (PR complytime/org-infra#428), as specified
in #253.

What the action does:

  • Auto-discovers Divisor persona definitions from .opencode/agents/divisor-*.md
    (repo-local or bundled fallback)
  • Pre-fetches PR context (CI checks, existing reviews, linked issues) as JSON
  • Filters noise files from diff (lock files, vendor, generated code)
  • Annotates diff with [L<N>] source-file line numbers for accurate inline comments
  • Builds a constrained review prompt delegating methodology to
    .opencode/commands/review-council.md and review-pr.md
  • Invokes opencode run with google-vertex-anthropic provider for Claude
    on Vertex AI via WIF
  • Parses structured JSON output (summary + inline comments) from OpenCode
    JSONL streaming format
  • Filters inline comments to diff-visible lines (prevents GitHub API 422)
  • Rescues out-of-diff findings into the summary body
  • Falls back gracefully: single-agent mode when no personas exist, comment
    mode when JSON parsing fails

Supply-chain safety:

  • OpenCode pinned to [email protected] via npm
  • All GitHub Actions in the caller pinned to full SHA

Includes documentation: README (architecture), docs/decisions.md (key design
decisions), docs/testing.md (coverage matrix), and test/test-pipeline.sh
(39 assertions across 15 test scenarios).

Replaces #329 (closed: cluttered timeline from development iterations).

Closes #253

Evidence

End-to-end validation in complytime/org-infra#427:

  • Council review posted 8 inline comments on valid source-file lines (8/8)
  • Line annotation approach eliminated patch-position confusion
  • Full workflow chain: collect → consumer → reusable → action → inline review

Test plan

Post-merge checklist

  • Update action SHA in complytime/org-infra reusable_council_review.yml to merged main commit
  • Switch ci_council_review.yml uses: from @feat/council-review-production to @main
  • Verify full automatic chain fires on a real PR
  • Delete stale branches: feat/council-review-action, feat/council-review-action-v2

sonupreetam added a commit to complytime/org-infra that referenced this pull request Jul 15, 2026
Adds the AI council review workflow chain (collect → consumer → reusable)
with WIF authentication on Vertex AI, plus crapload truncation fix.

Evidence PR for #428 and unbound-force/unbound-force#336.

Signed-off-by: sonupreetam <[email protected]>
@sonupreetam
sonupreetam marked this pull request as ready for review July 23, 2026 12:30
@jflowers
jflowers self-requested a review July 27, 2026 16:08

@jflowers jflowers 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.

Review: PR #336 — feat: add council-review-action composite GitHub Action

Reviewer: /review-pr (5 Divisor agents: Adversary, Architect, Guard, Testing, Scribe)
CI: All checks passing | Existing reviews: None


Walkthrough

This PR introduces council-review-action/, a composite GitHub Action for AI-assisted code review using OpenCode on Vertex AI. The action auto-discovers Divisor personas, pre-fetches PR context (CI checks, reviews, linked issues), filters noise from diffs, annotates lines, builds a structured review prompt, invokes opencode run, and parses JSON output with diff-line validation. Includes 6 scripts, a 39-assertion test suite, comprehensive docs, an ADR, and OpenSpec artifacts.


Consolidated Verdict: REQUEST CHANGES

All five reviewers independently reached REQUEST CHANGES. The implementation quality is strong — the scripts are well-separated, the test suite is thoughtful, the security risk register is exemplary, and the defensive prompt construction shows mature engineering. However, several systemic issues require resolution.


Blocking Findings

# Sev Finding Files
1 CRITICAL Spec artifacts describe Claude CLI (claude -p --agents) despite ADR choosing OpenCode spec.md, proposal.md, tasks.md, design.md
2 HIGH ${{ github.action_path }} expression injection in 5 run: blocks (step "Detect Divisor agents" already uses env: correctly) action.yml
3 HIGH agents-pattern input used in find -path without validation — path traversal risk action.yml
4 HIGH OpenCode process inherits GH_TOKEN/WIF credentials with no enforcement action.yml, run-review.sh
5 HIGH Missing set -e in run-review.sh — errors silently swallowed run-review.sh
6 HIGH File permissions: prepare-diff.sh and filter-diff-lines.py are 100644 (not executable) while all other scripts are 100755 scripts/
7 HIGH AGENTS.md not updated with council-review-action/ and docs/decisions/ directories; no website documentation issue filed AGENTS.md
8 HIGH README directory listing omits security-risks.md README.md
9 HIGH .openspec.yaml status is proposed despite implementation being complete; validation tasks 5.1-5.3 unchecked .openspec.yaml, tasks.md

Non-blocking Findings (recommended)

Sev Finding
MED npm install -g [email protected] without integrity verification
MED Prompt injection surface via PR title/metadata (well-documented accepted risk)
MED extract-review-json.py quadratic parsing on adversarial input — add size/iteration limits
MED ~80-line parse-output logic inline in action.yml — extract to testable script
MED run-review.sh and prefetch.sh have zero tests despite mockable boundaries
MED Test suite not wired into CI — no automated regression protection
MED Missing edge cases: empty diff, multiple JSON objects, assertion depth on filter-diff-lines
MED Prompt structure tests don't verify JSON schema fields
MED ADR in docs/decisions/ creates ambiguity with council-review-action/docs/decisions.md
MED Security risk T2 should lead with "no enforcement" rather than burying it
LOW Silent API fallbacks in prefetch.sh without ::warning::
LOW prepare-diff.sh holds entire diff in shell variable — consider piping to file directly

Positive Observations

  • Security risk register (docs/security-risks.md) is exemplary — honest about residual risks, structured T/A classification
  • Test isolation well-implemented (mktemp -d + trap cleanup + subshells)
  • Script separation of concerns is clean — each script handles one pipeline stage
  • Defensive prompt construction with injection preamble and JSON schema constraint
  • Multi-tier agent fallback chain (repo → bundled → single-agent) is well-designed
  • Supply chain: all GitHub Actions pinned to full SHA

Review generated by /review-pr with 5 Divisor agents (Adversary, Architect, Guard, Testing, Scribe)

Comment thread council-review-action/action.yml Resolved
Comment thread council-review-action/action.yml Resolved
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

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.

SEC-004 [HIGH]: This script inherits the full environment from the composite action, including GH_TOKEN and WIF credentials. The security risk register documents this (A3) with OPENCODE_PERMISSION (#337) as future mitigation — but it's not enforced today.

Recommendation: At minimum, unset sensitive environment variables before the opencode run invocation:

unset GH_TOKEN GOOGLE_APPLICATION_CREDENTIALS 2>/dev/null || true
opencode run ...

Also consider adding --pure if OpenCode supports it to prevent external plugin loading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially applied — unsetting GH_TOKEN is correct (not needed by the review invocation), but unsetting GOOGLE_APPLICATION_CREDENTIALS broke Vertex AI auth.

The google-github-actions/auth WIF step sets GOOGLE_APPLICATION_CREDENTIALS to point to the short-lived credential file. The Vertex AI SDK reads this env var to authenticate API calls. Unsetting it caused OpenCode to fail immediately (~3s instead of 30-120s) with a non-JSON auth error, silently falling back to comment mode.

Evidence: complytime/org-infra run #30445719456 — review step completed in 3182ms with Non-JSON output — comment fallback.

Fixed in 48c9d01: only unset GH_TOKEN, keep GOOGLE_APPLICATION_CREDENTIALS intact. The --pure flag (tracked in #337) remains the proper long-term solution for sandboxing credentials.

Comment thread council-review-action/README.md Resolved
Comment thread council-review-action/action.yml Resolved
Comment thread council-review-action/action.yml Resolved
Comment thread council-review-action/action.yml Resolved
Comment thread council-review-action/action.yml Resolved
Comment thread council-review-action/action.yml Resolved
sonupreetam added a commit to sonupreetam/unbound-force that referenced this pull request Jul 28, 2026
- Fix expression injection: move ${{ github.action_path }} to env:
  ACTION_PATH in all 5 run: blocks (action.yml)
- Add agents-pattern input validation against path traversal and
  invalid characters (action.yml)
- Restore set -euo pipefail in run-review.sh
- Unset GH_TOKEN and GOOGLE_APPLICATION_CREDENTIALS before
  opencode run to limit credential blast radius (run-review.sh)
- Replace heredoc with jq -n --arg for safe JSON construction
  of OPENCODE_CONFIG_CONTENT (run-review.sh)
- Fix file permissions: prepare-diff.sh and filter-diff-lines.py
  644 -> 755
- Anchor exclude regex patterns to prevent substring false
  positives like go.summary or event-vendor/ (prepare-diff.sh)
- Fix JSONL grep to tolerate whitespace in type field (action.yml)
- Update spec artifacts (spec.md, proposal.md, tasks.md, design.md)
  to reference opencode run instead of claude -p --agents
- Fix stale filename pr-diff-truncated.patch -> pr-diff-filtered.patch
  and pr-diff-annotated.patch in design.md
- Update AGENTS.md with council-review-action/ directory
- Add security-risks.md to README directory listing
- Update .openspec.yaml status proposed -> in-review
- Mark validation tasks 5.1-5.3 complete in tasks.md
@sonupreetam

Copy link
Copy Markdown
Contributor Author

Thank you for your review comments and feedbacks, it seems I didn't run review council on this old PR. I have taken care of all the review feedbacks. However, I will be thoroughly testing the outcome of the changes in the review outputs and moving this to draft until its ready.

@sonupreetam
sonupreetam marked this pull request as draft July 28, 2026 10:06
sonupreetam added a commit to sonupreetam/unbound-force that referenced this pull request Jul 28, 2026
- Extract ~80-line parse-output logic from action.yml into
  testable parse-output.sh script (action.yml now 3 lines)
- Add size limit (2 MB) and iteration limit (500) to
  extract-review-json.py to prevent quadratic parsing
- Add ::warning:: annotations to silent API fallbacks in
  prefetch.sh (CI checks, reviews, inline comments)
- Pipe filtered diff directly to file instead of holding
  in shell variable in prepare-diff.sh
- Reword security risk T2 to lead with 'no enforcement'
- Add docs/decisions/ to AGENTS.md project structure
- Add parse-output.sh to README directory listing
- Wire pipeline tests into CI (ci_local.yml)
- Add 16 new test assertions (55 total, up from 39):
  - parse-output.sh: no input, direct JSON, plain text fallback
  - Empty diff handling
  - Multiple JSON objects (picks last valid)
  - Size limit enforcement
  - Deeper filter-diff-lines assertions (rescued comments)
  - JSON schema field verification in prompt

Documentation issue filed: unbound-force#345
sonupreetam added a commit to sonupreetam/unbound-force that referenced this pull request Jul 28, 2026
Council review (9 Divisor agents) returned REQUEST CHANGES
with 10 consolidated findings. All addressed:

HIGH:
- Update testing.md and README assertion counts to match
  actual test file (26 scenarios, 60 assertions)
- Add CHANGELOG.md entry for council-review-action
- Mark spec.md max-diff-lines scenario as deferred; update
  tasks.md input list to reflect actual implementation with
  descoped inputs documented
- Add model input validation (character allowlist) in
  run-review.sh to prevent injection

MEDIUM:
- Fix PR title heredoc command substitution risk: replace
  unquoted heredoc with printf + quoted heredoc in
  build-prompt.sh
- Add 3 parse-output.sh tests: JSONL streaming (Case 2,
  the primary production path), filter-failure fallback,
  and all-comments-filtered edge case
- Add 300s timeout wrapper on opencode run invocation
- Replace SHALL with MUST throughout spec.md (RFC 2119
  project convention)
- Fix ITPC typo to OIDC in design.md
- Annotate task 5.4 as deferred to org-infra integration
sonupreetam added a commit to complytime/org-infra that referenced this pull request Jul 29, 2026
Points to 26db3b7 (feat/council-review-action-v2) which includes all
review feedback fixes from jflowers and yvonnedevlinrh:
- Expression injection fix (github.action_path via env:)
- Path traversal validation on agents-pattern
- set -euo pipefail restored in run-review.sh
- Credential unset before opencode run (GH_TOKEN + GOOGLE_APPLICATION_CREDENTIALS)
- File permissions fix (prepare-diff.sh, filter-diff-lines.py)
- Spec artifacts updated to reference opencode run
- parse-output.sh extracted from action.yml
- Size/iteration limits on extract-review-json.py
- Pipeline tests wired into CI (26 scenarios, 60 assertions)
- Model input validation, timeout wrapper, CHANGELOG

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to complytime/org-infra that referenced this pull request Jul 29, 2026
Picks up the GOOGLE_APPLICATION_CREDENTIALS fix (48c9d01):
only unset GH_TOKEN before opencode run, keep WIF credential
path so Vertex AI authentication works.

Also includes security risk A3 trade-off documentation (28b8b43).

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to complytime/org-infra that referenced this pull request Jul 29, 2026
Picks up the GOOGLE_APPLICATION_CREDENTIALS fix (48c9d01):
only unset GH_TOKEN before opencode run, keep WIF credential
path so Vertex AI authentication works.

Also includes security risk A3 trade-off documentation (28b8b43).

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to sonupreetam/unbound-force that referenced this pull request Jul 29, 2026
- Fix expression injection: move ${{ github.action_path }} to env:
  ACTION_PATH in all 5 run: blocks (action.yml)
- Add agents-pattern input validation against path traversal and
  invalid characters (action.yml)
- Restore set -euo pipefail in run-review.sh
- Unset GH_TOKEN and GOOGLE_APPLICATION_CREDENTIALS before
  opencode run to limit credential blast radius (run-review.sh)
- Replace heredoc with jq -n --arg for safe JSON construction
  of OPENCODE_CONFIG_CONTENT (run-review.sh)
- Fix file permissions: prepare-diff.sh and filter-diff-lines.py
  644 -> 755
- Anchor exclude regex patterns to prevent substring false
  positives like go.summary or event-vendor/ (prepare-diff.sh)
- Fix JSONL grep to tolerate whitespace in type field (action.yml)
- Update spec artifacts (spec.md, proposal.md, tasks.md, design.md)
  to reference opencode run instead of claude -p --agents
- Fix stale filename pr-diff-truncated.patch -> pr-diff-filtered.patch
  and pr-diff-annotated.patch in design.md
- Update AGENTS.md with council-review-action/ directory
- Add security-risks.md to README directory listing
- Update .openspec.yaml status proposed -> in-review
- Mark validation tasks 5.1-5.3 complete in tasks.md

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to sonupreetam/unbound-force that referenced this pull request Jul 29, 2026
- Extract ~80-line parse-output logic from action.yml into
  testable parse-output.sh script (action.yml now 3 lines)
- Add size limit (2 MB) and iteration limit (500) to
  extract-review-json.py to prevent quadratic parsing
- Add ::warning:: annotations to silent API fallbacks in
  prefetch.sh (CI checks, reviews, inline comments)
- Pipe filtered diff directly to file instead of holding
  in shell variable in prepare-diff.sh
- Reword security risk T2 to lead with 'no enforcement'
- Add docs/decisions/ to AGENTS.md project structure
- Add parse-output.sh to README directory listing
- Wire pipeline tests into CI (ci_local.yml)
- Add 16 new test assertions (55 total, up from 39):
  - parse-output.sh: no input, direct JSON, plain text fallback
  - Empty diff handling
  - Multiple JSON objects (picks last valid)
  - Size limit enforcement
  - Deeper filter-diff-lines assertions (rescued comments)
  - JSON schema field verification in prompt

Documentation issue filed: unbound-force#345

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to sonupreetam/unbound-force that referenced this pull request Jul 29, 2026
Council review (9 Divisor agents) returned REQUEST CHANGES
with 10 consolidated findings. All addressed:

HIGH:
- Update testing.md and README assertion counts to match
  actual test file (26 scenarios, 60 assertions)
- Add CHANGELOG.md entry for council-review-action
- Mark spec.md max-diff-lines scenario as deferred; update
  tasks.md input list to reflect actual implementation with
  descoped inputs documented
- Add model input validation (character allowlist) in
  run-review.sh to prevent injection

MEDIUM:
- Fix PR title heredoc command substitution risk: replace
  unquoted heredoc with printf + quoted heredoc in
  build-prompt.sh
- Add 3 parse-output.sh tests: JSONL streaming (Case 2,
  the primary production path), filter-failure fallback,
  and all-comments-filtered edge case
- Add 300s timeout wrapper on opencode run invocation
- Replace SHALL with MUST throughout spec.md (RFC 2119
  project convention)
- Fix ITPC typo to OIDC in design.md
- Annotate task 5.4 as deferred to org-infra integration

Signed-off-by: sonupreetam <[email protected]>
@sonupreetam
sonupreetam force-pushed the feat/council-review-action-v2 branch from 28b8b43 to 6383aa4 Compare July 29, 2026 11:20
@sonupreetam
sonupreetam marked this pull request as ready for review July 30, 2026 10:22
@sonupreetam

Copy link
Copy Markdown
Contributor Author

@jflowers & @yvonnedevlinrh The PR is ready for review again, the complytime/org-infra#427 is the evidence of the AI review on the PR.

Composite action for AI code review using OpenCode on Vertex AI
with Divisor persona discovery:

- Auto-discovers Divisor personas from .opencode/agents/divisor-*.md
  (repo-local or bundled fallback, single-agent if none found)
- Filters noise from diff (lock files, vendor, generated code)
- Annotates diff with [L<N>] source-file line numbers for accurate
  inline comment placement
- Pre-fetches PR context (CI checks, existing reviews, linked issues)
- Builds constrained review prompt with prompt injection defense
- Invokes opencode run on Vertex AI, parses structured JSON output
- Validates inline comments against diff hunks, rescues out-of-range
  findings into the summary body

Includes README (architecture), docs/decisions.md (9 key design
decisions), docs/testing.md (coverage matrix), and test/test-pipeline.sh
(15 scenarios, 39 assertions).

Closes unbound-force#253

Signed-off-by: sonupreetam <[email protected]>
Documents 3 tracked risks (with issue references) and 6 accepted
risks with mitigations and residual risk assessments. Covers output
injection, review comment injection, secrets exposure, artifact
integrity, issue body injection, and log exposure.

Signed-off-by: sonupreetam <[email protected]>
Add line break between bold severity header and comment body so
inline reviews render as:

  **[SEVERITY] (Persona)**

  Explanation text here.

Instead of a wall of text on one line.

Signed-off-by: sonupreetam <[email protected]>
- Fix expression injection: move ${{ github.action_path }} to env:
  ACTION_PATH in all 5 run: blocks (action.yml)
- Add agents-pattern input validation against path traversal and
  invalid characters (action.yml)
- Restore set -euo pipefail in run-review.sh
- Unset GH_TOKEN and GOOGLE_APPLICATION_CREDENTIALS before
  opencode run to limit credential blast radius (run-review.sh)
- Replace heredoc with jq -n --arg for safe JSON construction
  of OPENCODE_CONFIG_CONTENT (run-review.sh)
- Fix file permissions: prepare-diff.sh and filter-diff-lines.py
  644 -> 755
- Anchor exclude regex patterns to prevent substring false
  positives like go.summary or event-vendor/ (prepare-diff.sh)
- Fix JSONL grep to tolerate whitespace in type field (action.yml)
- Update spec artifacts (spec.md, proposal.md, tasks.md, design.md)
  to reference opencode run instead of claude -p --agents
- Fix stale filename pr-diff-truncated.patch -> pr-diff-filtered.patch
  and pr-diff-annotated.patch in design.md
- Update AGENTS.md with council-review-action/ directory
- Add security-risks.md to README directory listing
- Update .openspec.yaml status proposed -> in-review
- Mark validation tasks 5.1-5.3 complete in tasks.md

Signed-off-by: sonupreetam <[email protected]>
- Extract ~80-line parse-output logic from action.yml into
  testable parse-output.sh script (action.yml now 3 lines)
- Add size limit (2 MB) and iteration limit (500) to
  extract-review-json.py to prevent quadratic parsing
- Add ::warning:: annotations to silent API fallbacks in
  prefetch.sh (CI checks, reviews, inline comments)
- Pipe filtered diff directly to file instead of holding
  in shell variable in prepare-diff.sh
- Reword security risk T2 to lead with 'no enforcement'
- Add docs/decisions/ to AGENTS.md project structure
- Add parse-output.sh to README directory listing
- Wire pipeline tests into CI (ci_local.yml)
- Add 16 new test assertions (55 total, up from 39):
  - parse-output.sh: no input, direct JSON, plain text fallback
  - Empty diff handling
  - Multiple JSON objects (picks last valid)
  - Size limit enforcement
  - Deeper filter-diff-lines assertions (rescued comments)
  - JSON schema field verification in prompt

Documentation issue filed: unbound-force#345

Signed-off-by: sonupreetam <[email protected]>
Council review (9 Divisor agents) returned REQUEST CHANGES
with 10 consolidated findings. All addressed:

HIGH:
- Update testing.md and README assertion counts to match
  actual test file (26 scenarios, 60 assertions)
- Add CHANGELOG.md entry for council-review-action
- Mark spec.md max-diff-lines scenario as deferred; update
  tasks.md input list to reflect actual implementation with
  descoped inputs documented
- Add model input validation (character allowlist) in
  run-review.sh to prevent injection

MEDIUM:
- Fix PR title heredoc command substitution risk: replace
  unquoted heredoc with printf + quoted heredoc in
  build-prompt.sh
- Add 3 parse-output.sh tests: JSONL streaming (Case 2,
  the primary production path), filter-failure fallback,
  and all-comments-filtered edge case
- Add 300s timeout wrapper on opencode run invocation
- Replace SHALL with MUST throughout spec.md (RFC 2119
  project convention)
- Fix ITPC typo to OIDC in design.md
- Annotate task 5.4 as deferred to org-infra integration

Signed-off-by: sonupreetam <[email protected]>
- SC2129: group sequential redirects in build-prompt.sh using
  { cmd1; cmd2; } >> file pattern instead of individual >> redirects
- SC2097/SC2098: export SCRIPT_DIR once at top of test-pipeline.sh
  instead of inline env assignment on each parse-output.sh
  invocation; shellcheck warns the inline assignment is not
  visible to the expansion in the same command

Signed-off-by: sonupreetam <[email protected]>
- AGENTS.md: 39 -> 60 assertions in project structure tree
- testing.md: fix per-script breakdown to sum correctly
  (prepare-diff.sh: 20->23, build-prompt.sh: 3 tests/12->4 tests/13)

Signed-off-by: sonupreetam <[email protected]>
The google-github-actions/auth action sets
GOOGLE_APPLICATION_CREDENTIALS to point to the WIF
credential file. The Vertex AI SDK reads this env var
to authenticate API calls. Unsetting it broke auth,
causing OpenCode to fail silently and fall back to
comment mode with non-JSON output.

Evidence: complytime/org-infra run #30445719456 shows
the review step completing in ~3s (should be 30-120s)
with 'Non-JSON output — comment fallback'.

Keep unsetting GH_TOKEN (not needed for review) but
preserve GOOGLE_APPLICATION_CREDENTIALS (required for
Vertex AI auth).

Signed-off-by: sonupreetam <[email protected]>
Document why GOOGLE_APPLICATION_CREDENTIALS cannot be unset
(breaks Vertex AI auth) and the defense-in-depth options
evaluated: OPENCODE_PERMISSION sandbox (unbound-force#337), authenticated
reverse proxy (deferred), credential file relocation (not
viable). Include evidence reference from org-infra run
#30445719456.

Signed-off-by: sonupreetam <[email protected]>
@sonupreetam
sonupreetam force-pushed the feat/council-review-action-v2 branch from 6383aa4 to c53681e Compare July 30, 2026 11:06

@yvonnedevlinrh yvonnedevlinrh 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.

LGTM, any findings are low or not an issue with this functionality

@jflowers
jflowers self-requested a review July 31, 2026 16:13

@jflowers jflowers 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.

All 10 blocking findings from the prior CHANGES_REQUESTED review (commit eece8d4) have been addressed: expression injection fixed, agents-pattern validation added, set -euo pipefail restored, credential scoping implemented, spec artifacts updated, file permissions fixed, AGENTS.md updated, README directory listing completed, OpenSpec status set to in-review, parse-output logic extracted to testable script.

Remaining LOW findings (non-blocking): npm install without content hash verification (npm's built-in integrity check covers this), GOOGLE_APPLICATION_CREDENTIALS in environment (documented trade-off, tracked in #337).

Implementation quality is strong — the security risk register is exemplary, the test suite (60 assertions) provides meaningful coverage, and the separation of concerns across scripts is clean.

This review was generated by /review-pr (AI-assisted).

@jflowers
jflowers merged commit 7836c07 into unbound-force:main Jul 31, 2026
15 checks passed
jflowers pushed a commit that referenced this pull request Jul 31, 2026
- Fix expression injection: move ${{ github.action_path }} to env:
  ACTION_PATH in all 5 run: blocks (action.yml)
- Add agents-pattern input validation against path traversal and
  invalid characters (action.yml)
- Restore set -euo pipefail in run-review.sh
- Unset GH_TOKEN and GOOGLE_APPLICATION_CREDENTIALS before
  opencode run to limit credential blast radius (run-review.sh)
- Replace heredoc with jq -n --arg for safe JSON construction
  of OPENCODE_CONFIG_CONTENT (run-review.sh)
- Fix file permissions: prepare-diff.sh and filter-diff-lines.py
  644 -> 755
- Anchor exclude regex patterns to prevent substring false
  positives like go.summary or event-vendor/ (prepare-diff.sh)
- Fix JSONL grep to tolerate whitespace in type field (action.yml)
- Update spec artifacts (spec.md, proposal.md, tasks.md, design.md)
  to reference opencode run instead of claude -p --agents
- Fix stale filename pr-diff-truncated.patch -> pr-diff-filtered.patch
  and pr-diff-annotated.patch in design.md
- Update AGENTS.md with council-review-action/ directory
- Add security-risks.md to README directory listing
- Update .openspec.yaml status proposed -> in-review
- Mark validation tasks 5.1-5.3 complete in tasks.md

Signed-off-by: sonupreetam <[email protected]>
jflowers pushed a commit that referenced this pull request Jul 31, 2026
- Extract ~80-line parse-output logic from action.yml into
  testable parse-output.sh script (action.yml now 3 lines)
- Add size limit (2 MB) and iteration limit (500) to
  extract-review-json.py to prevent quadratic parsing
- Add ::warning:: annotations to silent API fallbacks in
  prefetch.sh (CI checks, reviews, inline comments)
- Pipe filtered diff directly to file instead of holding
  in shell variable in prepare-diff.sh
- Reword security risk T2 to lead with 'no enforcement'
- Add docs/decisions/ to AGENTS.md project structure
- Add parse-output.sh to README directory listing
- Wire pipeline tests into CI (ci_local.yml)
- Add 16 new test assertions (55 total, up from 39):
  - parse-output.sh: no input, direct JSON, plain text fallback
  - Empty diff handling
  - Multiple JSON objects (picks last valid)
  - Size limit enforcement
  - Deeper filter-diff-lines assertions (rescued comments)
  - JSON schema field verification in prompt

Documentation issue filed: #345

Signed-off-by: sonupreetam <[email protected]>
jflowers pushed a commit that referenced this pull request Jul 31, 2026
Council review (9 Divisor agents) returned REQUEST CHANGES
with 10 consolidated findings. All addressed:

HIGH:
- Update testing.md and README assertion counts to match
  actual test file (26 scenarios, 60 assertions)
- Add CHANGELOG.md entry for council-review-action
- Mark spec.md max-diff-lines scenario as deferred; update
  tasks.md input list to reflect actual implementation with
  descoped inputs documented
- Add model input validation (character allowlist) in
  run-review.sh to prevent injection

MEDIUM:
- Fix PR title heredoc command substitution risk: replace
  unquoted heredoc with printf + quoted heredoc in
  build-prompt.sh
- Add 3 parse-output.sh tests: JSONL streaming (Case 2,
  the primary production path), filter-failure fallback,
  and all-comments-filtered edge case
- Add 300s timeout wrapper on opencode run invocation
- Replace SHALL with MUST throughout spec.md (RFC 2119
  project convention)
- Fix ITPC typo to OIDC in design.md
- Annotate task 5.4 as deferred to org-infra integration

Signed-off-by: sonupreetam <[email protected]>
@sonupreetam
sonupreetam deleted the feat/council-review-action-v2 branch August 3, 2026 07:17
@sonupreetam
sonupreetam restored the feat/council-review-action-v2 branch August 3, 2026 08:37
sonupreetam added a commit to complytime/org-infra that referenced this pull request Aug 3, 2026
Points to 7836c07 — the merged main commit from
unbound-force/unbound-force#336 (feat: add council-review-action
composite GitHub Action). Fulfills the first post-merge checklist
item: pin to a stable main SHA now that #336 has landed.

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to complytime/org-infra that referenced this pull request Aug 3, 2026
* feat(ci): add production council review workflow chain

Three-file workflow chain for AI council review using OpenCode on
Vertex AI via ITPC WIF authentication:

- ci_council_review_collect.yml (synced): fork-safe diff collection
  on pull_request, uploads PR diff + metadata as artifact
- ci_council_review.yml (synced): thin consumer on workflow_run,
  calls reusable_council_review.yml with secrets
- reusable_council_review.yml (NOT synced): shared review logic —
  WIF auth, council-review-action composite action, cleanup of
  previous bot comments, inline comment posting via GitHub API

Also fixes the off-by-one truncation bug in generate-crapload-comment.sh
where the trailer was appended after the byte limit.

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA after squash

Points to 78c8a65 (single squashed commit on
feat/council-review-action).

Signed-off-by: sonupreetam <[email protected]>

* feat(ci): gate council review on org membership

Only run AI review for PRs from org members (MEMBER, OWNER, or
COLLABORATOR). External contributors skip at the collect stage,
so no WIF tokens are consumed. Uses author_association from the
pull_request event — no extra PAT needed.

Requested by Trevor and Jason.

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA for formatting fix

Points to eece8d4 (feat/council-review-action-v2) which includes
improved inline comment formatting with line breaks between severity
header and comment body.

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): use ORG_CHECK_TOKEN for private org membership checks

GITHUB_TOKEN can only check public org membership. Private members
(the GitHub default) return 404. Falls back to GITHUB_TOKEN when
ORG_CHECK_TOKEN is not configured.

Matches the pattern from reusable_publish_ghcr.yml.

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): add newline after bot marker in inline comments

The HTML comment <!-- council-review-bot --> was glued directly to the
bold severity header, preventing GitHub's markdown renderer from
applying bold formatting in some cases.

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): address PR #428 review feedback

- Gate cleanup step on review success to prevent deleting previous bot
  comments without replacement on transient failures (HIGH, yvonnedevlinrh)
- Use GraphQL variables instead of string interpolation for
  minimizeComment mutation to eliminate injection risk (HIGH, gxmiranda +
  yvonnedevlinrh)
- Create tracking issue #440 for continue-on-error removal and add
  issue reference to TODO comment (MEDIUM, gxmiranda)
- Add regression tests for crapload comment truncation per TC-006
  (MEDIUM, gxmiranda + yvonnedevlinrh)
- Surface stderr on inline comment posting failures for diagnostics
  (LOW, yvonnedevlinrh)

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* fix(ci): suppress SC2016 for intentional GraphQL variable in single quotes

The GraphQL query uses $id as a GraphQL variable, not a shell variable.
Single quotes are correct here — shellcheck SC2016 is a false positive.

Refs #428

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): move SC2016 disable to offending line for actionlint

The shellcheck disable directive at the top of the run block was not
picked up by actionlint's embedded shellcheck. Moving it directly
before the line with the single-quoted GraphQL variable fixes the
CI failure.

Refs #428

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* fix(ci): defer downstream sync and add provenance headers

Address staged rollout concern from review (marcusburghardt):

- Add provenance headers to consumer workflows indicating they are
  managed by org-infra and should not be edited locally (#415)
- Exclude all downstream repos from council review sync entries
  until prerequisites are met:
  - Composite action SHA on merged main (unbound-force#336)
  - Security hardening (#429) and cost controls (#430) in place
  - End-to-end chain validated on org-infra

Refs #415, #428, #429, #430

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* fix: isolate test output via configurable COMMENT_FILE

Make COMMENT_FILE configurable via environment variable (defaulting
to /tmp/crapload-comment-body.md for backward compatibility). Tests
now use isolated temp files per invocation, preventing cross-test
interference through the shared /tmp path.

Refs #428

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to latest #336

Points to 26db3b7 (feat/council-review-action-v2) which includes all
review feedback fixes from jflowers and yvonnedevlinrh:
- Expression injection fix (github.action_path via env:)
- Path traversal validation on agents-pattern
- set -euo pipefail restored in run-review.sh
- Credential unset before opencode run (GH_TOKEN + GOOGLE_APPLICATION_CREDENTIALS)
- File permissions fix (prepare-diff.sh, filter-diff-lines.py)
- Spec artifacts updated to reference opencode run
- parse-output.sh extracted from action.yml
- Size/iteration limits on extract-review-json.py
- Pipeline tests wired into CI (26 scenarios, 60 assertions)
- Model input validation, timeout wrapper, CHANGELOG

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>

* docs: add council review documentation to AGENTS.md and ops guide

- Add Council Review section to AGENTS.md with workflow chain diagram,
  required secrets table, sync/rollout status, and related issues
- Add docs/COUNCIL_REVIEW.md with full operational guide: architecture
  diagram, workflow files table, gate conditions, composite action
  pipeline, rollout plan, manual trigger instructions, bot comment
  lifecycle, and troubleshooting guide

Refs #428

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to 28b8b43

Picks up the GOOGLE_APPLICATION_CREDENTIALS fix (48c9d01):
only unset GH_TOKEN before opencode run, keep WIF credential
path so Vertex AI authentication works.

Also includes security risk A3 trade-off documentation (28b8b43).

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to test PR #425

Points to dc82f77 (opsx/council-review-sandbox) which adds:
- Runtime permission enforcement via OPENCODE_CONFIG_CONTENT
  (denies bash, edit, webfetch, websearch, skill)
- Plugin isolation via --pure flag
- Divisor agent migration from tools: to permission: frontmatter
- 13 new test assertions (73 total)
- Expanded docs (quickstart, architecture, security risk A7)

Refs #428, unbound-force/unbound-force#425

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to merged main

Points to 7836c07 — the merged main commit from
unbound-force/unbound-force#336 (feat: add council-review-action
composite GitHub Action). Fulfills the first post-merge checklist
item: pin to a stable main SHA now that #336 has landed.

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>

---------

Signed-off-by: sonupreetam <[email protected]>
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.

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

3 participants