Skip to content

Add Claude Code Action-compatible review agents and improve /review-pr#9

Merged
dceoy merged 8 commits into
mainfrom
feature/claude-code-action-compatible-review-agents
Jun 30, 2026
Merged

Add Claude Code Action-compatible review agents and improve /review-pr#9
dceoy merged 8 commits into
mainfrom
feature/claude-code-action-compatible-review-agents

Conversation

@dceoy

@dceoy dceoy commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add three Claude Code Action-compatible core review agents: code-quality-reviewer, test-coverage-reviewer, and documentation-accuracy-reviewer
  • Rewrite /review-pr command and skill to deterministically run 5 core reviewers for all, plus pr-review-toolkit specialty agents triggered by diff content
  • Add new aspect keywords: quality, coverage, docs, documentation
  • Normalize findings across all agents with file/line/severity/source/message structure
  • Validate every finding against the PR diff before posting; move unanchorable findings to summary body
  • Add retry logic and top-level comment fallback when the reviews API call fails
  • Update SKILL.md and README.md to document both reviewer sets, all aspects, and posting policy

Changed files

File Change
.opencode/agents/code-quality-reviewer.md New — quality, edge cases, robustness, type safety
.opencode/agents/test-coverage-reviewer.md New — missing tests, brittle tests, coverage gaps
.opencode/agents/documentation-accuracy-reviewer.md New — docs, README, API docs accuracy
.opencode/commands/review-pr.md Rewritten — 8-step orchestration, dual reviewer sets, normalization, anchoring, fallback
.opencode/skills/review-pr/SKILL.md Rewritten — full documentation of both sets, all aspects, posting policy
README.md Added Review commands section with aspect table and reviewer descriptions
.github/workflows/opencode.yml Updated model name to match README example

Acceptance criteria

  • .opencode/agents/code-quality-reviewer.md exists
  • .opencode/agents/test-coverage-reviewer.md exists
  • .opencode/agents/documentation-accuracy-reviewer.md exists
  • Existing pr-review-toolkit agents remain unchanged
  • /review-pr all deterministically includes 5 Claude Code Action-compatible core reviewers
  • /review-pr still supports pr-review-toolkit specialty aspects
  • Findings are normalized and deduplicated before posting
  • Inline comments posted only when safely anchorable
  • Unanchorable findings moved to summary
  • API failure falls back to top-level PR comment
  • README and skill are updated consistently
  • QA passes (prettier, yamllint, zizmor, actionlint, checkov all clean)

Test plan

  • Trigger /review-pr all on a PR touching code, tests, and docs — verify all 5 core reviewers run
  • Trigger /review-pr security performance — verify only those two agents run
  • Trigger /review-pr tests docs — verify test-coverage-reviewer and documentation-accuracy-reviewer run
  • Trigger /review-pr simplify — verify code-simplifier runs without posting a review
  • Verify inline comments anchor to diff lines and unanchorable findings appear in summary body
  • Simulate reviews API failure — verify fallback to top-level gh pr comment

🤖 Generated with Claude Code

@dceoy dceoy self-assigned this Jun 30, 2026
- Add code-quality-reviewer, test-coverage-reviewer, and
  documentation-accuracy-reviewer agents mirroring Claude Code Action's
  core PR review agent set
- Keep all existing pr-review-toolkit agents unchanged
- Rewrite /review-pr command to deterministically run 5 core reviewers
  for `all`, plus specialty agents triggered by diff content
- Add quality, coverage, docs, documentation as new aspect keywords
- Normalize findings across agents with file/line/severity/source/message
- Validate inline comment anchoring against the PR diff before posting
- Add retry and top-level comment fallback when review API call fails
- Update SKILL.md and README to document both reviewer sets, all aspects,
  deterministic all behavior, finding normalization, and posting policy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dceoy dceoy force-pushed the feature/claude-code-action-compatible-review-agents branch from 4266206 to c08906a Compare June 30, 2026 14:46
@dceoy dceoy marked this pull request as ready for review June 30, 2026 15:00
@dceoy dceoy marked this pull request as draft June 30, 2026 16:29
@dceoy dceoy marked this pull request as ready for review June 30, 2026 16:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf7bd78544

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .opencode/commands/review-pr.md Outdated

@github-actions github-actions Bot 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.

OpenCode PR Review

Reviewed 7 files across 6 areas: code-quality-reviewer, performance-reviewer, test-coverage-reviewer, documentation-accuracy-reviewer, security-code-reviewer, code-reviewer.

General observation

The new orchestration expects every agent to return normalized {file, line, severity, source, message} YAML, but the existing pr-test-analyzer.md and code-reviewer.md agent definitions do not specify that format. Update those agent files to match the normalized contract, or have the orchestrator parse their prose output.

Comment thread .opencode/commands/review-pr.md Outdated
Comment thread README.md Outdated
Comment thread .opencode/commands/review-pr.md Outdated
Comment thread .opencode/commands/review-pr.md
Comment thread .opencode/commands/review-pr.md Outdated
Comment thread README.md Outdated
Comment thread .github/workflows/opencode.yml
Comment thread .opencode/agents/code-quality-reviewer.md
Comment thread .opencode/commands/review-pr.md Outdated
Comment thread .opencode/skills/review-pr/SKILL.md
@opencode-agent

Copy link
Copy Markdown

Posted a review on PR #9: #9 (review)

Summary:

  • Ran 6 reviewers: code-quality-reviewer, performance-reviewer, test-coverage-reviewer, documentation-accuracy-reviewer, security-code-reviewer, and code-reviewer.
  • Security found no issues.
  • 10 important findings and 4 suggestions posted as inline comments.
  • Key themes:
    • Inconsistencies between README.md, .opencode/commands/review-pr.md, and .opencode/skills/review-pr/SKILL.md on which reviewers run for code, tests, and all.
    • pr-test-analyzer is referenced in the normalized flow but its agent definition still uses a non-normalized output format.
    • code-reviewer is listed as a conditional specialty reviewer without a trigger condition.
    • Filtering rule 3 mixes file-set validation with line anchoring.
    • Suggestions around CI model cost, frontmatter tests, and agent-existence tests.

github run

@dceoy dceoy left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Review + triage

CI is green, but I would not merge this yet. The existing important comments are mostly valid and point to the same underlying consistency issues.

Keep / fix before merge

  1. Normalize the output contract for every agent that can enter the review flow. The command/skill now require {file, line, severity, source, message}, but several existing specialty agents still define prose or incompatible output formats. This applies not only to code-reviewer and pr-test-analyzer, but also to silent-failure-hunter, comment-analyzer, and type-design-analyzer if they remain callable from /review-pr all or explicit aspects. Either update those agent files or make the orchestrator explicitly translate legacy outputs before filtering/posting.

  2. Make aspect-to-agent routing deterministic and document it consistently. Replace and/or with the intended set. If code runs both code-reviewer and code-quality-reviewer, state that in the command file. If tests/coverage runs both test-coverage-reviewer and pr-test-analyzer, make /review-pr all, SKILL.md, and README.md match that behavior.

  3. Fix the changed-file filtering rule. The current wording says to drop findings when the file or line is not in the changed-file set, but the changed-file set contains paths, not line numbers. Restrict that filter to file membership and leave line validation to the anchoring step; otherwise valid findings can be discarded before fallback-to-summary logic runs.

  4. Clarify code-reviewer in /review-pr all. It is listed under conditional specialty reviewers but has no trigger condition. Move it to unconditional reviewers or add a clear condition such as “always run for AGENTS.md/project-guideline compliance.”

Lower-priority / optional

  • The model default change to kimi-k2.7-code is a product trade-off, not a correctness blocker; it is already resolved.
  • Tests that validate agent frontmatter and command/skill references would be useful guardrails, but they are optional unless this repo wants schema validation for .opencode/ assets.

Suggested implementation direction

I would fix this by making a single source of truth for the aspect matrix in the command/skill text, then updating all review-capable agents to emit the same normalized YAML shape. After that, adjust README.md examples so each row names the exact agents that run.

…istency

- Normalize output format in all review-flow agents (pr-test-analyzer,
  code-reviewer, silent-failure-hunter, comment-analyzer, type-design-analyzer)
  to emit {file, line, severity, source, message} YAML matching the orchestrator
  contract
- Replace "and/or" with "and" for code and tests/coverage aspect routing
- Move code-reviewer to unconditional core reviewers in all mode
- Add pr-test-analyzer to conditional specialty reviewers for all (when test
  files change)
- Fix filtering rule 3 to drop by file membership only; leave line validation
  to the diff-anchoring step
- Update README /review-pr tests docs row to mention pr-test-analyzer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dceoy

dceoy commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

Triage complete (commit f1a209f)

All important findings are addressed. Here's what was done:

Fixed:

  • Output contract — updated pr-test-analyzer, code-reviewer, silent-failure-hunter, comment-analyzer, and type-design-analyzer to emit normalized {file, line, severity, source, message} YAML, matching the orchestrator contract.
  • Routing ambiguity — replaced and/or with and for the code aspect (code-reviewer + code-quality-reviewer) and tests/coverage aspect (test-coverage-reviewer + pr-test-analyzer).
  • code-reviewer in all — moved from conditional specialty to unconditional core reviewers (always runs for AGENTS.md/project-guideline compliance).
  • pr-test-analyzer in all — added as a conditional specialty reviewer triggered when test files change.
  • Filtering rule 3 — changed to drop by file membership only; line validation left to the diff-anchoring step. Fixed in both review-pr.md (command) and SKILL.md.
  • README /review-pr tests docs row — updated to name all three agents: test-coverage-reviewer, pr-test-analyzer, and documentation-accuracy-reviewer.

Deferred (suggestions, no test framework currently):

  • Frontmatter validation test for new agent markdown files
  • Agent-reference existence test from command table
  • Agent-reference existence test from SKILL aspect table

QA clean (prettier, yamllint, zizmor, actionlint, checkov all pass).

@dceoy

dceoy commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

On the suggestion threads (no tests for agent frontmatter / agent file references / skill references): deferred. This repo has no test framework for validating .opencode/ assets. All three would be worthwhile additions to qa.sh in a follow-up PR.

- Normalize performance-reviewer and security-code-reviewer outputs to
  the file/line/severity/source/message YAML schema used by /review-pr
- Add permission frontmatter to code-simplifier for uniform agent schema
- Strengthen filtering: check file membership only, aggregate by root
  cause, keep one representative inline comment per root cause
- Add explicit posting policy to command and skill (anchored -> inline,
  unanchorable -> summary, duplicated -> one representative + summary)
- Make README aspect table name the exact agents that run for each
  keyword and document the posting policy
- Add validate-opencode.sh guardrail for agent frontmatter and
  review-pr command/skill references; wire into qa.sh
@dceoy

dceoy commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

Follow-up: orchestration quality and noisy output

Pushed c85a4ed to address the remaining review comments. The earlier commit f1a209f already normalized code-reviewer/pr-test-analyzer, removed and/or from routing, moved code-reviewer to unconditional core reviewers, and fixed the file or line filtering wording. This commit closes out the rest:

Normalized agent outputs

  • performance-reviewer and security-code-reviewer now emit the same file/line/severity/source/message YAML as every other review-capable agent (the impact/vulnerability fields were folded into message). All agents invoked by /review-pr now share one schema.
  • code-simplifier gained the missing permission frontmatter key so all agents pass the required-keys check.

Duplicate/noisy output suppression

  • New filtering rule "Aggregate by root cause" in review-pr.md and SKILL.md: one representative inline comment per root cause; remaining occurrences collapsed into the summary body. Cross-document/cross-file consistency problems are summarized once instead of repeated at each location.
  • Explicit posting policy in both docs: anchored → inline, unanchorable → summary, duplicated → one representative + summary listing affected files.
  • Optional guardrail suggestions (e.g. frontmatter/reference tests) are explicitly downgraded to suggestion severity.

Changed-file filtering vs anchoring

  • Filtering rule 3 now states it checks file membership only and that the changed-file set contains paths, not line numbers. Line validation is left to the anchoring step.
  • Anchoring step clarified that unanchorable findings on a changed file are moved to the summary, not dropped.

Deterministic routing and docs

  • README.md aspect table now names the exact agents that run for each keyword (e.g. /review-pr codecode-reviewer, code-quality-reviewer; /review-pr tests docstest-coverage-reviewer, pr-test-analyzer, documentation-accuracy-reviewer). README, SKILL.md, and review-pr.md now agree on the aspect matrix and /review-pr all.

Guardrails

  • Added .agents/skills/local-qa/scripts/validate-opencode.sh (wired into qa.sh): verifies every .opencode/agents/*.md has valid YAML frontmatter with name, description, mode, permission, and that every agent referenced in review-pr.md and SKILL.md exists under .opencode/agents/.

Validation

QA passes: prettier, yamllint, zizmor, actionlint, checkov, and validate-opencode.sh all clean. The PR stays scoped to .opencode/ review orchestration and docs (the unrelated action.yml/workflow formatting that prettier --write . touched was reverted).

The OpenCode review comments on this PR should now be either addressed or obsolete.

agent and others added 2 commits June 30, 2026 17:11
Build the backtick-delimited reference pattern with printf instead of
literal backticks in single quotes so SC2016 is not triggered.
@dceoy dceoy marked this pull request as draft June 30, 2026 17:17
@dceoy dceoy marked this pull request as ready for review June 30, 2026 17:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1367e629f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .opencode/agents/test-coverage-reviewer.md Outdated
Comment thread .opencode/agents/documentation-accuracy-reviewer.md Outdated

@dceoy dceoy left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

No noteworthy issues found. Previous feedback appears addressed, and the current CI/CD run is green.

@dceoy dceoy merged commit 3f3595d into main Jun 30, 2026
8 checks passed
@dceoy dceoy deleted the feature/claude-code-action-compatible-review-agents branch June 30, 2026 18:20
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.

1 participant