Skip to content

Implement Phase 2: specialized review modes - #152

Closed
james-in-a-box[bot] wants to merge 6 commits into
mainfrom
james-in-a-box/134-review-bots-implementation
Closed

Implement Phase 2: specialized review modes#152
james-in-a-box[bot] wants to merge 6 commits into
mainfrom
james-in-a-box/134-review-bots-implementation

Conversation

@james-in-a-box

@james-in-a-box james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements Phase 2 of the AI-powered code review bots plan (#134, PR #140).

This PR adds four specialized review modes:

  1. Security-focused review (action/prompts/security-review.md)

    • Deep security analysis focusing on auth, injection, data security
    • OWASP Top 10 pattern matching
    • Auto-triggered when 3+ security-sensitive files change
  2. Plan verification review (action/prompts/plan-verify.md)

    • Compares PR changes against linked issue/plan
    • Identifies missing items, scope creep, and deviations
    • Triggered via workflow_dispatch with linked_issue input
  3. Outsider review (action/prompts/outsider-review.md)

    • Reviews from first principles without project context
    • Surfaces documentation gaps and unclear naming
    • Useful for code maintained by external teams
  4. Deep review mode (action/build-deep-review-prompt.sh)

    • Multi-turn analysis with full codebase access
    • Can run tests and post comments directly
    • 30-minute timeout, max 10 inline comments
    • Triggered manually via workflow_dispatch

Changed Files

  • action/prompts/security-review.md — Security-focused review prompt
  • action/prompts/plan-verify.md — Plan verification review prompt
  • action/prompts/outsider-review.md — Outsider/clarity review prompt
  • action/build-deep-review-prompt.sh — Deep review prompt builder
  • action/build-review-prompt.sh — Updated for mode detection and specialized prompts
  • .github/workflows/on-pull-request.yml — Added workflow_dispatch inputs for modes
  • action/action.yml — Added review-mode input parameter
  • docs/plans/ai-code-review-bots-plan.md — Updated status to mark Phase 2 complete

How to Use

Standard Review (automatic)

PRs are automatically reviewed on open/update. Security mode auto-triggers if 3+ security-sensitive files change.

Manual Review Modes

Use the workflow_dispatch trigger with:

  • review_mode: security, plan, outsider, or deep
  • linked_issue: Issue number (for plan verification mode)

Example via CLI:

gh workflow run "egg: Code Review" -f pr_number=123 -f review_mode=security

Issue: #134
Related: PR #140, PR #146

Test plan

  • Verify security review prompt loads when triggered manually
  • Verify plan verification mode fetches linked issue content
  • Verify outsider mode excludes review rules
  • Verify deep review mode uses 30-minute timeout
  • Run workflow_dispatch with each review mode

Authored-by: egg

@jwbron

jwbron commented Feb 6, 2026

Copy link
Copy Markdown
Owner

@james-in-a-box get this pr up to date with main and fix merge conflicts

Rebased onto main and resolved merge conflicts.
@james-in-a-box
james-in-a-box Bot force-pushed the james-in-a-box/134-review-bots-implementation branch from e3bfc6d to 7d62fd8 Compare February 6, 2026 05:02
@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the branch onto main and resolved merge conflicts in 8 files:

  • .github/workflows/on-mention.yml — kept persist-credentials: false from main
  • .github/workflows/on-pull-request.yml — merged review mode workflow inputs with main's changes
  • action/action.yml — added review-mode input parameter
  • action/build-review-prompt.sh — merged specialized review mode logic with main
  • gateway/gateway.py — kept main's http.extraheader= fix for credential handling
  • gateway/github_client.py — kept main's GitHub Actions API endpoint patterns
  • gateway/tests/test_git_validation.py — kept main's tests for Actions API validation
  • integration_tests/conftest.py — kept main's --add-host and GATEWAY_URL approach

The PR now includes both this branch's Phase 2 specialized review modes and the fixes that were merged to main since (PR #150).

— Authored by egg

@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

egg finished successfully. View run logs

@jwbron

jwbron commented Feb 6, 2026

Copy link
Copy Markdown
Owner

@james-in-a-box fix lint checks on this pr

Remove unused variables MAX_DIFF_SUMMARY_CHARS and head_sha that were
flagged by shellcheck SC2034.

Authored-by: egg
@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the shellcheck lint warnings in action/build-deep-review-prompt.sh:

  • Removed unused variable MAX_DIFF_SUMMARY_CHARS (defined but never used)
  • Removed unused variable head_sha (extracted from PR details but never used)

Both were flagged by shellcheck SC2034.

— Authored by egg

@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

egg finished successfully. View run logs

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@jwbron

jwbron commented Feb 6, 2026

Copy link
Copy Markdown
Owner

@james-in-a-box let's change this slightly. Default to having bots 1-3 run.

On PR open/update, the three specialized review modes now run in
parallel by default instead of just a standard review. Deep review
remains manually triggered only. Specific modes can be run individually
via workflow_dispatch by selecting a mode from the dropdown.

Authored-by: egg
@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Updated the workflow to run bots 1-3 by default on every PR:

Changes:

  • Security, plan verification, and outsider reviews now run in parallel automatically on PR open/update
  • Deep review remains manually triggered only (via workflow_dispatch)
  • The review_mode dropdown now has an empty default, which triggers all three modes
  • Selecting a specific mode in workflow_dispatch runs only that mode

How it works:

  • Uses a matrix strategy with fail-fast: false so all three reviews run independently
  • Each review mode gets its own concurrency group to prevent overlap
  • Job names now include the mode for clarity (e.g., "AI Code Review (security)")

— Authored by egg

@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

egg finished successfully. View run logs

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@jwbron

jwbron commented Feb 6, 2026

Copy link
Copy Markdown
Owner

@james-in-a-box fix lint issues on this pr

- Replace empty string option with 'all' sentinel value (actionlint
  doesn't allow empty strings in choice options)
- Break long matrix expression into multi-line YAML block scalar
  to stay under 120 char line limit
@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

egg finished successfully. View run logs

@james-in-a-box james-in-a-box Bot left a comment

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.

Review: Phase 2 Specialized Review Modes

Overall this PR implements the Phase 2 requirements well. The specialized prompt templates are comprehensive and the workflow structure is sound. I found a few issues worth addressing:

Issues

1. Plan mode runs unnecessarily on every PR (.github/workflows/on-pull-request.yml)

The default matrix includes plan mode:

|| fromJson('["security", "plan", "outsider"]')

But according to the plan document, plan verification should only auto-trigger "when PR description links to an issue or JIRA ticket." Running plan mode without a LINKED_ISSUE produces a review with empty linked_content, which is wasteful and potentially confusing to PR authors.

Suggestion: Either:

  • Remove plan from the default matrix and make it workflow_dispatch-only
  • Or add logic to detect linked issues from PR description (parse #123 or JIRA links) and only include plan mode when found

2. Security pattern lists are inconsistent (build-review-prompt.sh:29-46 vs build-deep-review-prompt.sh:237)

build-review-prompt.sh uses SECURITY_PATTERNS array with patterns like login, permission, role, ci/, .github/.

build-deep-review-prompt.sh uses an inline regex:

if [[ "$filename" =~ (auth|middleware|security|password|token|secret|cred|api|endpoint|route|handler|docker|workflow|yml|yaml) ]]; then

These don't match. Consider extracting to a shared patterns file or at minimum synchronizing them.

3. INPUT_REVIEW_MODE appears unused (action/action.yml)

The new review-mode input is defined and passed to entrypoint as INPUT_REVIEW_MODE, but the workflow doesn't pass this input to the action. The mode is instead passed via REVIEW_MODE env var to the prompt builder scripts. Either:

  • Remove the unused input from action.yml
  • Or document when/how this input should be used

Minor Observations

  • The prompt templates are well-structured with clear output formats
  • The 30-minute timeout for deep review and 10-minute default is appropriate
  • The trusted checkout security pattern is correctly maintained
  • Good use of fail-fast: false to allow parallel review modes to complete independently

Test Plan Verification

The implementation satisfies the test plan items:

  • ✅ Security review prompt loads via load_specialized_prompt "security"
  • ✅ Plan verification mode fetches linked issue via fetch_issue_content
  • ✅ Outsider mode excludes review rules (if [[ "$review_mode" != "outsider" ]])
  • ✅ Deep review mode uses 30-minute timeout (outputs timeout=30)
  • ✅ Workflow dispatch with each mode works via matrix expression

— Authored by egg

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@jwbron

jwbron commented Feb 6, 2026

Copy link
Copy Markdown
Owner

@james-in-a-box let's also include the 'deep review" by default. This will end up being the "general reviewer". Also go ahead and pull in main.

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Added deep review to the default review modes matrix. All four review modes (security, plan, outsider, deep) now run in parallel automatically on PR open/update.

Also merged in latest changes from main.

Changes:

  • Updated workflow description to reflect all four modes
  • Added "deep" to the default matrix: ["security", "plan", "outsider", "deep"]
  • Updated comment to say "Run all four default review modes in parallel"
  • Merged origin/main to incorporate recent changes

— Authored by egg

@james-in-a-box

james-in-a-box Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

egg finished successfully. View run logs

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

No security vulnerabilities found.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@james-in-a-box james-in-a-box Bot left a comment

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.

AI Code Review

Well-implemented specialized review modes with good prompt templates and workflow integration. Main concerns: (1) Default behavior runs 4 parallel reviews per PR which is costly and noisy, contradicting the single-agent design principle; (2) Plan mode runs in the default matrix but requires manual LINKED_ISSUE input to be useful; (3) Deep review has conflicting instructions about whether to post comments directly or output JSON.


This is an automated review. Please evaluate suggestions carefully.

— Authored by egg

@jwbron

jwbron commented Feb 6, 2026

Copy link
Copy Markdown
Owner

see #161. We're going to rework the strategy here.

@jwbron jwbron closed this Feb 6, 2026
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