feat: Add automatic PR summary generator #19

Closed
Latte wants to merge 0 commits from feature/pr-summary-generator into main
Owner

Implements automatic PR summary generation feature that analyzes pull
request diffs and generates comprehensive summaries.

Features:

  • Auto-generates summaries for PRs with empty descriptions
  • Manual trigger via @codebot summarize command in PR comments
  • Structured output with change type, files affected, and impact assessment
  • Configurable (enable/disable, comment vs description update)

Implementation:

  • Added pr_summary.md prompt template for LLM
  • Extended PRAgent with summary generation methods
  • Added auto_summary configuration in config.yml
  • Comprehensive test suite with 10 new tests
  • Updated documentation in README.md and CLAUDE.md

Usage:

  • Automatic: Opens PR with no description → auto-generates summary
  • Manual: Comment '@codebot summarize' on any PR

Related: Issue #2 - Milestone 2 feature delivery

Implements automatic PR summary generation feature that analyzes pull request diffs and generates comprehensive summaries. Features: - Auto-generates summaries for PRs with empty descriptions - Manual trigger via @codebot summarize command in PR comments - Structured output with change type, files affected, and impact assessment - Configurable (enable/disable, comment vs description update) Implementation: - Added pr_summary.md prompt template for LLM - Extended PRAgent with summary generation methods - Added auto_summary configuration in config.yml - Comprehensive test suite with 10 new tests - Updated documentation in README.md and CLAUDE.md Usage: - Automatic: Opens PR with no description → auto-generates summary - Manual: Comment '@codebot summarize' on any PR Related: Issue #2 - Milestone 2 feature delivery
Latte added this to the Milestone 2: PR Workflow Enhancement milestone 2025-12-29 10:25:12 +00:00
Latte self-assigned this 2025-12-29 10:25:12 +00:00
Latte added 1 commit 2025-12-29 10:25:12 +00:00
feat: Add automatic PR summary generator
All checks were successful
Enterprise AI Code Review / ai-review (pull_request) Successful in 7s
e21ec5f57a
Implements automatic PR summary generation feature that analyzes pull
request diffs and generates comprehensive summaries.

Features:
- Auto-generates summaries for PRs with empty descriptions
- Manual trigger via @codebot summarize command in PR comments
- Structured output with change type, files affected, and impact assessment
- Configurable (enable/disable, comment vs description update)

Implementation:
- Added pr_summary.md prompt template for LLM
- Extended PRAgent with summary generation methods
- Added auto_summary configuration in config.yml
- Comprehensive test suite with 10 new tests
- Updated documentation in README.md and CLAUDE.md

Usage:
- Automatic: Opens PR with no description → auto-generates summary
- Manual: Comment '@codebot summarize' on any PR

Related: Issue #2 - Milestone 2 feature delivery
Latte closed this pull request 2025-12-29 10:25:27 +00:00
Owner

📋 Pull Request Summary

This PR introduces an automated PR summary generation feature that creates comprehensive, structured summaries for pull requests, especially when descriptions are missing. It supports both automatic generation on PR open events and manual triggering via the @codebot summarize command in PR comments.

Type: Feature

Changes

Added:

  • PR summary generation functionality in PRAgent
  • New prompt template pr_summary.md for instructing the LLM on summary generation
  • Configuration options for auto-summary behavior in config.yml
  • Tests covering PR summary generation and related command handling

📝 Modified:

  • PRAgent to handle @codebot summarize command and auto-generate summaries for empty PR descriptions
  • README.md to document the new PR summary feature and command
  • CLAUDE.md to add detailed documentation about the PR summary feature and usage
  • config.yml to include auto_summary settings under the PR agent

Files Affected

  • 📝 tools/ai-review/agents/pr_agent.py - Added PR summary generation methods, command handling for @codebot summarize, and auto-summary on PR open with empty descriptions
  • tools/ai-review/prompts/pr_summary.md - New prompt template defining the structure and requirements for generating PR summaries using the LLM
  • 📝 tools/ai-review/config.yml - Added configuration options to enable/disable auto-summary and control posting behavior
  • 📝 README.md - Updated documentation to include the PR summary feature and the @codebot summarize command
  • 📝 CLAUDE.md - Extended internal documentation with detailed explanation of the PR summary feature, implementation details, and usage scenarios
  • 📝 tests/test_ai_review.py - Added comprehensive tests for PR summary prompt existence, formatting, command handling, and configuration validation

Impact

🟡 Scope: Medium
Introduces a new automated feature that improves PR documentation and review efficiency without altering existing review logic. It enhances developer experience by providing standardized summaries and supports manual and automatic invocation with minimal risk.

## 📋 Pull Request Summary This PR introduces an automated PR summary generation feature that creates comprehensive, structured summaries for pull requests, especially when descriptions are missing. It supports both automatic generation on PR open events and manual triggering via the `@codebot summarize` command in PR comments. **Type:** ✨ Feature ## Changes **✅ Added:** - PR summary generation functionality in PRAgent - New prompt template `pr_summary.md` for instructing the LLM on summary generation - Configuration options for auto-summary behavior in `config.yml` - Tests covering PR summary generation and related command handling **📝 Modified:** - PRAgent to handle `@codebot summarize` command and auto-generate summaries for empty PR descriptions - README.md to document the new PR summary feature and command - CLAUDE.md to add detailed documentation about the PR summary feature and usage - config.yml to include auto_summary settings under the PR agent ## Files Affected - 📝 `tools/ai-review/agents/pr_agent.py` - Added PR summary generation methods, command handling for `@codebot summarize`, and auto-summary on PR open with empty descriptions - ➕ `tools/ai-review/prompts/pr_summary.md` - New prompt template defining the structure and requirements for generating PR summaries using the LLM - 📝 `tools/ai-review/config.yml` - Added configuration options to enable/disable auto-summary and control posting behavior - 📝 `README.md` - Updated documentation to include the PR summary feature and the `@codebot summarize` command - 📝 `CLAUDE.md` - Extended internal documentation with detailed explanation of the PR summary feature, implementation details, and usage scenarios - 📝 `tests/test_ai_review.py` - Added comprehensive tests for PR summary prompt existence, formatting, command handling, and configuration validation ## Impact 🟡 **Scope:** Medium Introduces a new automated feature that improves PR documentation and review efficiency without altering existing review logic. It enhances developer experience by providing standardized summaries and supports manual and automatic invocation with minimal risk.
Bartender reviewed 2025-12-29 10:25:51 +00:00
Bartender left a comment
Owner

AI Code Review - Inline Comments

AI Code Review - Inline Comments
Owner

[LOW] Testing

The tests cover prompt existence, formatting, command handling, and configuration, but do not include tests for failure modes such as LLM errors or empty diffs during summary generation.

Recommendation: Add tests simulating LLM failures, empty diffs, and API errors to ensure robust error handling and fallback behavior.

**[LOW] Testing** The tests cover prompt existence, formatting, command handling, and configuration, but do not include tests for failure modes such as LLM errors or empty diffs during summary generation. **Recommendation:** Add tests simulating LLM failures, empty diffs, and API errors to ensure robust error handling and fallback behavior.
Owner

[LOW] Architecture

The method _generate_pr_summary attempts to update the PR description via the Gitea API, but the comment notes that this may not be supported and falls back to posting a comment. This fallback logic is appropriate but could be clarified or improved by explicitly checking API capabilities or documenting limitations.

Recommendation: Consider adding a capability check or configuration option to explicitly control whether to attempt PR description updates, and document the Gitea API limitations regarding PR description updates.

**[LOW] Architecture** The method _generate_pr_summary attempts to update the PR description via the Gitea API, but the comment notes that this may not be supported and falls back to posting a comment. This fallback logic is appropriate but could be clarified or improved by explicitly checking API capabilities or documenting limitations. **Recommendation:** Consider adding a capability check or configuration option to explicitly control whether to attempt PR description updates, and document the Gitea API limitations regarding PR description updates.
Owner

[LOW] Maintainability

The execute() method handles multiple commands (summarize, review-again) in a single conditional block, which could grow as more commands are added.

Recommendation: Refactor command handling into a dispatch method or dictionary mapping commands to handlers to improve scalability and readability.

**[LOW] Maintainability** The execute() method handles multiple commands (summarize, review-again) in a single conditional block, which could grow as more commands are added. **Recommendation:** Refactor command handling into a dispatch method or dictionary mapping commands to handlers to improve scalability and readability.
Owner

[LOW] Readability

The can_handle() method checks for both 'review-again' and 'summarize' commands in a single return statement, which slightly reduces clarity.

Recommendation: Separate the checks for each command into distinct variables or conditions with comments to improve readability.

**[LOW] Readability** The can_handle() method checks for both 'review-again' and 'summarize' commands in a single return statement, which slightly reduces clarity. **Recommendation:** Separate the checks for each command into distinct variables or conditions with comments to improve readability.
Owner

[LOW] Performance

The _generate_pr_summary method loads the entire PR diff and sends it to the LLM in one prompt. For very large diffs, this could lead to performance or token limit issues.

Recommendation: Consider adding diff size checks or truncation strategies before sending to the LLM, or implement incremental summarization for very large PRs.

**[LOW] Performance** The _generate_pr_summary method loads the entire PR diff and sends it to the LLM in one prompt. For very large diffs, this could lead to performance or token limit issues. **Recommendation:** Consider adding diff size checks or truncation strategies before sending to the LLM, or implement incremental summarization for very large PRs.
Owner

[LOW] Maintainability

The prompt template uses double curly braces for JSON placeholders, which requires careful escaping to avoid formatting errors.

Recommendation: Ensure prompt template placeholders are properly escaped and tested to prevent KeyError during formatting, as verified in tests.

**[LOW] Maintainability** The prompt template uses double curly braces for JSON placeholders, which requires careful escaping to avoid formatting errors. **Recommendation:** Ensure prompt template placeholders are properly escaped and tested to prevent KeyError during formatting, as verified in tests.
Owner

AI Code Review

This PR introduces an automated PR summary generation feature integrated into the existing PRAgent. It supports auto-generation of summaries for PRs with empty descriptions and manual triggering via the @codebot summarize command in PR comments. The feature uses a new prompt template to instruct the LLM to produce structured JSON summaries, which are then formatted and posted as comments or optionally update the PR description. Comprehensive tests validate prompt presence, formatting, command handling, and configuration.

Summary

Severity Count
HIGH 0
MEDIUM 0
LOW 6

Review Findings

  • [LOW] tools/ai-review/agents/pr_agent.py:147 - The method _generate_pr_summary attempts to update the PR description via the Gitea API, but the comment notes that this may not be supported and falls back to posting a comment. This fallback logic is appropriate but could be clarified or improved by explicitly checking API capabilities or documenting limitations.
  • [LOW] tools/ai-review/agents/pr_agent.py:123 - The execute() method handles multiple commands (summarize, review-again) in a single conditional block, which could grow as more commands are added.
  • [LOW] tools/ai-review/agents/pr_agent.py:92 - The can_handle() method checks for both 'review-again' and 'summarize' commands in a single return statement, which slightly reduces clarity.
  • [LOW] tools/ai-review/agents/pr_agent.py:150 - The _generate_pr_summary method loads the entire PR diff and sends it to the LLM in one prompt. For very large diffs, this could lead to performance or token limit issues.
  • [LOW] tools/ai-review/prompts/pr_summary.md:1 - The prompt template uses double curly braces for JSON placeholders, which requires careful escaping to avoid formatting errors.
  • [LOW] tests/test_ai_review.py:600 - The tests cover prompt existence, formatting, command handling, and configuration, but do not include tests for failure modes such as LLM errors or empty diffs during summary generation.

Overall Severity: LOW
AI Recommendation: Approve

<!-- AI_PR_REVIEW --> ## AI Code Review This PR introduces an automated PR summary generation feature integrated into the existing PRAgent. It supports auto-generation of summaries for PRs with empty descriptions and manual triggering via the `@codebot summarize` command in PR comments. The feature uses a new prompt template to instruct the LLM to produce structured JSON summaries, which are then formatted and posted as comments or optionally update the PR description. Comprehensive tests validate prompt presence, formatting, command handling, and configuration. ### Summary | Severity | Count | |----------|-------| | HIGH | 0 | | MEDIUM | 0 | | LOW | 6 | ### Review Findings - **[LOW]** `tools/ai-review/agents/pr_agent.py:147` - The method _generate_pr_summary attempts to update the PR description via the Gitea API, but the comment notes that this may not be supported and falls back to posting a comment. This fallback logic is appropriate but could be clarified or improved by explicitly checking API capabilities or documenting limitations. - **[LOW]** `tools/ai-review/agents/pr_agent.py:123` - The execute() method handles multiple commands (summarize, review-again) in a single conditional block, which could grow as more commands are added. - **[LOW]** `tools/ai-review/agents/pr_agent.py:92` - The can_handle() method checks for both 'review-again' and 'summarize' commands in a single return statement, which slightly reduces clarity. - **[LOW]** `tools/ai-review/agents/pr_agent.py:150` - The _generate_pr_summary method loads the entire PR diff and sends it to the LLM in one prompt. For very large diffs, this could lead to performance or token limit issues. - **[LOW]** `tools/ai-review/prompts/pr_summary.md:1` - The prompt template uses double curly braces for JSON placeholders, which requires careful escaping to avoid formatting errors. - **[LOW]** `tests/test_ai_review.py:600` - The tests cover prompt existence, formatting, command handling, and configuration, but do not include tests for failure modes such as LLM errors or empty diffs during summary generation. --- **Overall Severity:** `LOW` **AI Recommendation:** Approve
Owner

@None

Summary:
Please provide the title and body of the issue you would like summarized.

@None **Summary:** Please provide the title and body of the issue you would like summarized.
Owner

@None

Summary:
Please provide the title and body of the issue you would like summarized.

@None **Summary:** Please provide the title and body of the issue you would like summarized.
All checks were successful
Enterprise AI Code Review / ai-review (pull_request) Successful in 7s

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Hiddenden/openrabbit#19