Repository navigation
feat(ci): add production council review workflow chain - #313
sonupreetam wants to merge 1 commit into
Conversation
hbraswelrh
left a comment
There was a problem hiding this comment.
PR Review: #313 -- feat(ci): add production council review workflow chain
Well-designed two-workflow chain for AI council review. Architecture is sound: fork-safe collect phase, consumer phase, and reusable review phase. Spec, design doc, and task breakdown are thorough. Two issues need addressing before merge.
Findings Summary
| # | Severity | Category | File | Description |
|---|---|---|---|---|
| 1 | HIGH | Alignment | reusable_council_review.yml |
Comment deduplication broken -- creates new comment on every push |
| 2 | HIGH | Constitution | All 3 workflow files | Missing header comment blocks (MUST per constitution) |
| 3 | MEDIUM | Security | reusable_council_review.yml |
PR title/diff content flows unsanitized into AI prompt |
| 4 | MEDIUM | Alignment | tasks.md |
Concurrency group uses workflow_run.id but implementation uses head_sha |
| 5 | LOW | Security | reusable_council_review.yml |
Claude CLI installed unpinned from npm |
See inline comments for details.
This review was generated by /review-pr (AI-assisted).
|
@hbraswelrh this PR won't be merged yet, check the reviewer guidance. The PR is supposed to check the AI council review bot message instead. It has knowingly these findings to suggest how the reviews would look in the future. So it wont follow the regular PR review of getting the findings. The AI review bot already suggests the above. |
4804dc4 to
dc70a82
Compare
marcusburghardt
left a comment
There was a problem hiding this comment.
Nice @sonupreetam . I included some comments more about clarification. Also thinking if ci_council_review.yml and ci_council_review_collect.yml could be merged in a single file.
| TRUNCATION_NOTE="Note: The diff was truncated from ${TOTAL_LINES} to ${MAX_LINES} lines. Review only covers the included portion." | ||
| fi | ||
|
|
||
| cat > review_prompt.txt <<'PROMPT_HEADER' |
There was a problem hiding this comment.
It would be nice if we could use the uf command review-pr or have a separate markdown for it so we don't need to touch the workflow in order to update the prompt. It could also allow users to inform where to find the prompt as a input, for example.
There was a problem hiding this comment.
I think a way this could reference the review-pr command would be referencing the uf repo review-pr command by a separate actions/checkoutstep to cat unbound-force's .opencode/commands/review-pr.md and > review_prompt
There was a problem hiding this comment.
Thank you @hbraswelrh & @marcusburghardt, for your feedbacks. I have used the claude hardcoded one-shot prompt for this initial work. But you are right about adding the uf commands already. Moving this to draft until ready. The final workflow would be basically WIF auth → Vertex AI → Claude → runs uf commands (review-council, Divisor agents).
There was a problem hiding this comment.
Resolved — the composite action's build-prompt.sh instructs Claude to read .opencode/commands/review-council.md, review-pr.md, and the Divisor agent personas. The prompt is now separate from the workflow — updating it requires no workflow changes.
| @@ -0,0 +1,88 @@ | |||
| --- | |||
| name: Council Review - Collect | |||
There was a problem hiding this comment.
Looking to this title alone it was not clear that the goal here is to get a collect and safe a diff to be used later. I was wondering "Collect what?". : ) Maybe we can reword a bit.
There was a problem hiding this comment.
I agree that changing the word "collect" may help clarify intent. I would even say using "cache" may be an option here. If the intent is to save the diff and use it later on the PR, it would probably be fine to say something like "Council Review - Cache Diff for Later Usage" or if keeping "collect" -> the title could be "Council Review - Collect Diff for open, non-dependabot-authored PRs"
Wdyt? @sonupreetam
There was a problem hiding this comment.
@hbraswelrh & @marcusburghardt Thank you for your feedbacks. I think "Council Review - Collect PR Diff" will be less verbose. WDYT?
There was a problem hiding this comment.
Done — renamed to "Council Review - Collect PR Diff" for clarity. The three-file chain follows the org convention: collect (synced) → consumer (synced) → reusable (org-infra only, called cross-repo). The prompt lives in the composite action's build-prompt.sh, which delegates to .opencode/commands/review-council.md and review-pr.md.
| path: | | ||
| pr-diff.patch | ||
| pr-meta.json | ||
| retention-days: 1 |
There was a problem hiding this comment.
Is this enough? It is only used synchronously, right? If so, we could delete right after the review. Or we could also keep it longer. Just trying to understand why 1 day. :)
There was a problem hiding this comment.
@marcusburghardt The workflow_run trigger fires immediately when the collect workflow completes, so the review workflow downloads the artifact within seconds/minutes, so no human-in-the-loop delay between upload and download. We can delete it right after or keep it longer. But I dont see re-use scenario for keeping it longer and also for the 1 day quota was "good enough" to avoid quota pressure, and right after deletion was eliminated as it avoids an extra API call and the actions: write permission that explicit deletion would require (currently we only need actions: read for cross-workflow artifact download).
There was a problem hiding this comment.
Kept at 1 day. The workflow_run trigger fires immediately when the collect workflow completes, so the review workflow downloads the artifact within seconds. 1-day retention is a safety margin — the artifact is consumed long before expiry.
Hi @sonupreetam, I am reviewing the responses from the bot. The level of detail is very nice. It's comprehensive and provides next steps that factor in considerations from the OpenSpec design files. I believe the review serves as a great starting point when a human wants to pick up the fixes using the
|
| @@ -0,0 +1,88 @@ | |||
| --- | |||
| name: Council Review - Collect | |||
There was a problem hiding this comment.
I agree that changing the word "collect" may help clarify intent. I would even say using "cache" may be an option here. If the intent is to save the diff and use it later on the PR, it would probably be fine to say something like "Council Review - Cache Diff for Later Usage" or if keeping "collect" -> the title could be "Council Review - Collect Diff for open, non-dependabot-authored PRs"
Wdyt? @sonupreetam
| TRUNCATION_NOTE="Note: The diff was truncated from ${TOTAL_LINES} to ${MAX_LINES} lines. Review only covers the included portion." | ||
| fi | ||
|
|
||
| cat > review_prompt.txt <<'PROMPT_HEADER' |
There was a problem hiding this comment.
I think a way this could reference the review-pr command would be referencing the uf repo review-pr command by a separate actions/checkoutstep to cat unbound-force's .opencode/commands/review-pr.md and > review_prompt
| council-review: | ||
| name: AI Council Review | ||
| if: github.event.workflow_run.conclusion == 'success' | ||
| uses: complytime/org-infra/.github/workflows/reusable_council_review.yml@main # zizmor: ignore[unpinned-uses] |
There was a problem hiding this comment.
Follow-up will be to pin the reusable_council_review.yml to a sha
There was a problem hiding this comment.
Resolved — the consumer workflow (ci_council_review.yml) calls reusable_council_review.yml which in turn calls the council-review-action composite action (SHA-pinned to fcc172bfea6cc102956fcfd352aabd535a182d84). Follow-up: pin the reusable call to SHA once merged to main.
There was a problem hiding this comment.
Addressed — the consumer now calls reusable_council_review.yml, which calls the council-review-action composite action (SHA-pinned to fcc172bfea6cc102956fcfd352aabd535a182d84). Follow-up: pin the reusable call to SHA once this PR merges to main.
- Add header comment blocks to all three council review workflow files per constitution requirement (HIGH, hbraswelrh) - Add prompt injection defense preamble and truncate PR title to 200 chars in the review prompt (MEDIUM, hbraswelrh) - Pin Claude Code CLI to v2.1.168 instead of unpinned latest (LOW, hbraswelrh + GHAS) - Rename collect workflow to "Council Review - Collect PR Diff" for clarity (marcusburghardt + hbraswelrh) - Sync tasks.md concurrency group to match implementation (head_sha not workflow_run.id) (MEDIUM, hbraswelrh) Assisted-by: Claude (claude-opus-4-6) Signed-off-by: sonupreetam <[email protected]>
|
@hbraswelrh & @marcusburghardt After reviewing the invocation layer, prompt injection risk and other reviewer feedback, this PR is being reworked with a different architecture. |
Scope change: action-based architecture with OpenCodeAfter reviewing the prompt injection risk and reviewer feedback, this PR is being reworked with a different architecture: What changedThe review orchestration logic (agent discovery, prompt construction, invocation, output parsing) has been moved to a composite GitHub Action in Additionally, the invocation layer switches from Claude Code CLI to OpenCode ( This addresses:
What stays in this PR
What moved out
The Branch will be force-pushed with the reworked commits. |
|
@sonupreetam we need to review and clean-up the last comment. It is huge and hard to read. |
|
@marcusburghardt This is testing with opencode CLI (output unable to parse, as it is JSONL), ignore it for now, this will be deleted with the next runs.
|
79cedb4 to
55eb1ad
Compare
There was a problem hiding this comment.
AI Council Review
Well-architected three-file workflow chain for production AI council review. The fork-safe collect → consumer → reusable pattern follows org conventions, all external actions are SHA-pinned, WIF gate degradation is correct, and the concurrency model is sound. Two issues require attention before merge: the council-review-action composite action is pinned to a feature branch SHA rather than a stable release ref (supply-chain risk), and the comment deduplication implementation (delete + create) diverges from the spec requirement (update existing comment), breaking notification thread continuity.
Model: google-vertex-anthropic/claude-sonnet-4-6 | Commit: 8d287aa | Inline comments: 1
| PR_BASE_REF: ${{ github.event.pull_request.base.ref }} | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| jq -n \ |
There was a problem hiding this comment.
[LOW] (Guard) The ready_for_review event type is included in the trigger but is absent from the spec (opened, synchronize, reopened only). This is a useful addition — converting a draft to ready should trigger collection — but it is undocumented scope expansion. Update openspec/changes/build-production-workflow/specs/council-review-workflow/spec.md to add ready_for_review as a triggering event for the collect workflow requirement.
Implement AI-powered code review using OpenCode on Vertex AI via ITPC WIF authentication, following the org's reusable workflow convention: - ci_council_review_collect.yml (synced): fork-safe PR diff collection on pull_request, uploads diff and metadata as artifact - ci_council_review.yml (synced): thin consumer on workflow_run, calls the reusable workflow with secrets and triggering run ID - reusable_council_review.yml (NOT synced): shared review logic — WIF auth, council-review-action composite action call, inline comment posting via GitHub Review API with collapsible fallback Includes gate checks (drafts, dependabot, missing WIF), concurrency control, smart diff filtering, bot comment deduplication, and old review cleanup. Updates sync-config.yml for org-wide distribution. Closes complytime#253 Signed-off-by: sonupreetam <[email protected]>
6524300 to
bbd7ba5
Compare
|
Closing in favor of a clean PR with squashed history. All reviewer feedback has been addressed — see replacement PR. |
Summary
ci_council_review_collect.yml(synced): fork-safe diff collection onpull_request, uploads PR diff and metadata as artifactci_council_review.yml(synced): thin consumer onworkflow_run, callsreusable_council_review.ymlwith secrets and triggering run IDreusable_council_review.yml(NOT synced): shared review logic — WIF auth, composite action call, inline comment posting. Called cross-repo by downstream repossync-config.ymland call the reusable cross-repo (complytime/org-infra/.github/workflows/reusable_council_review.yml@SHA)Architecture
Test plan
pull_requesteventsunbound-forceproject)ci_council_review_test.ymlafter merge