Skip to content

feat(config): add optional agentic /fix feature for automated PR creation - #436

Open
matheusandre1 wants to merge 1 commit into
devops-thiago:mainfrom
matheusandre1:issue-57
Open

feat(config): add optional agentic /fix feature for automated PR creation#436
matheusandre1 wants to merge 1 commit into
devops-thiago:mainfrom
matheusandre1:issue-57

Conversation

@matheusandre1

Copy link
Copy Markdown
Contributor
  • 🐛 Bug fix
  • ✨ Feature
  • 📝 Documentation
  • 🔧 Refactor
  • 🚀 Performance
  • ✅ Test
  • 🔒 Security
  • 📦 Dependency update
  • 🏗️ CI/CD

Description

Related Issues

Closes: #57

How Has This Been Tested?

  • [X} Unit tests
  • Integration tests
  • Manual testing

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • My changes generate no new warnings or errors

@thrillhousebot

Copy link
Copy Markdown

🤖 ThrillhouseBot PR Summary

What this PR does

Adds an opt-in /fix command that drafts a fix across the relevant files, commits it to a bot-owned branch, and opens a clearly attributed PR targeting the reviewed PR's branch.

Control-Flow Diagram

🔀 Show diagram
flowchart TD
  A["Webhook receives review comment"] --> B{"/fix command?"}
  B -->|yes| C["handleFixCommand(): auth, pause, write-access check"]
  C --> D["FixTask dispatched to executor"]
  D --> E["FixService.execute()"]
  E --> F["Load finding body"]
  F --> G["Load PR details & fork check"]
  G --> H["Load file list & context contents"]
  H --> I["Generate fix via AI (prompt)"]
  I --> J{"Edits?"}
  J -->|none| K["Reply decline with notes"]
  J -->|exceed limit| L["Reply too broad"]
  J -->|within limit| M["Apply edits (search/replace)"]
  M -->|mismatch| N["Reply edit mismatch"]
  M -->|success| O["Commit to bot branch via Git Data API"]
  O --> P["Open fix PR targeting original PR's branch"]
  P --> Q["Reply with PR link"]
Loading

Changes Overview

  • Files changed: 25
  • Lines added: +1937
  • Lines removed: -12

Changed Files

File Change Summary
.env.example Modified Adds commented example entries for REVIEW_FIX_ENABLED and REVIEW_FIX_MAX_EDITED_FILES.
CHANGELOG.md Modified Changelog entry for the /fix feature.
README.md Modified Documents the /fix command, configuration, and updated permissions.
docs/ARCHITECTURE.md Modified -
manifest.json Modified Upgrades the App's contents permission from read to write (required by /fix).
src/main/java/dev/thiagogonzaga/thrillhousebot/config/StartupConfigValidator.java Modified Validates that fix max-edited-files >= 1 at startup.
src/main/java/dev/thiagogonzaga/thrillhousebot/config/ThrillhouseConfig.java Modified Adds FixConfig with enabled flag and max-edited-files limit.
src/main/java/dev/thiagogonzaga/thrillhousebot/github/GitHubGitDataClient.java Added New REST client for Git Data API: read commit tree, create tree/commit/ref for fix branch.
src/main/java/dev/thiagogonzaga/thrillhousebot/github/GitHubPullRequestClient.java Modified -
src/main/java/dev/thiagogonzaga/thrillhousebot/review/FixService.java Added Core fix orchestration: loads finding, PR, files, generates edit instructions, applies them, commits to a bot branch, and opens a fix PR.
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ai/FixGenerator.java Added LangChain4j AI service interface for /fix generation, using the prompt templates.
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ai/FixGeneratorPrompts.java Added System and user prompt templates for the /fix AI; contains a critical placeholder syntax error.
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ai/FixResponse.java Added Data model for parsed AI fix response (summary, edits, notes) with applicability checks.
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ai/FixResponseParser.java Added Parses raw JSON (possibly markdown-fenced) into FixResponse.
src/main/java/dev/thiagogonzaga/thrillhousebot/webhook/CommentCommand.java Modified -
src/main/java/dev/thiagogonzaga/thrillhousebot/webhook/CommentCommandService.java Modified Handles PR-level /fix (usage pointer) when not on a finding thread.
src/main/java/dev/thiagogonzaga/thrillhousebot/webhook/TriggerDetector.java Modified -
src/main/java/dev/thiagogonzaga/thrillhousebot/webhook/WebhookController.java Modified Routes /fix on review comment threads to FixService after authorization and pause checks.
src/main/resources/application.properties Modified -
src/test/java/dev/thiagogonzaga/thrillhousebot/config/StartupConfigValidatorTest.java Modified -

…and 5 more file(s).

Risk Assessment

Risk Count
🔴 Critical 0
🟠 High 0
🟡 Medium 1
🔵 Low 0

Things to double-check

1 lower-confidence finding
  • MEDIUM: Fix context may miss files if the underlying file list lacks pagination (src/main/java/dev/thiagogonzaga/thrillhousebot/review/FixService.java:140) (low confidence — verify before acting)

⚠️ Required CI Checks Status

Some required checks are still pending or have failed:

Check Type Status Detail
format missing ⏳ Pending -
test missing ⏳ Pending -
frontend missing ⏳ Pending -
trivy missing ⏳ Pending -
dependency-review missing ⏳ Pending -

Automated review by ThrillhouseBot. Reply with /review to re-run.

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

ThrillhouseBot noted 1 lower-confidence item(s) under Things to double-check in the PR summary (not posted as inline threads):

  • MEDIUM: Fix context may miss files if the underlying file list lacks pagination (src/main/java/dev/thiagogonzaga/thrillhousebot/review/FixService.java:140)
    The /fix flow depends on the complete list of PR files (obtained via SoftLoaders.files). If that method does not implement pagination, only the first page (default 30 files on GitHub REST) will be provided, and files beyond that may be missing from the diff and context, leading to an incomplete fix. The project guidelines require listing calls to paginate. Verify that SoftLoaders.files fetches all files (e.g., walks pages until a short page), or document why one page is enough.

@thrillhousebot thrillhousebot Bot added enhancement New feature or request java Pull requests that update java code labels Jul 27, 2026
@matheusandre1

Copy link
Copy Markdown
Contributor Author

ThrillhouseBot noted 1 lower-confidence item(s) under Things to double-check in the PR summary (not posted as inline threads):

* **MEDIUM:** Fix context may miss files if the underlying file list lacks pagination (`src/main/java/dev/thiagogonzaga/thrillhousebot/review/FixService.java:140`)
  The /fix flow depends on the complete list of PR files (obtained via SoftLoaders.files). If that method does not implement pagination, only the first page (default 30 files on GitHub REST) will be provided, and files beyond that may be missing from the diff and context, leading to an incomplete fix. The project guidelines require listing calls to paginate. Verify that SoftLoaders.files fetches all files (e.g., walks pages until a short page), or document why one page is enough.

False positive ? The Feedback?

Regarding the comments: the Softloaders line 86 calls getPullRequestFiles, not the single-page endpoint.

As noted, the Softloaders line 86 calls getPullRequestFiles rather than the single-page endpoint.

This is by design: there is a Max_Content_Files limit in the FixService. This isn't due to pagination constraints but is instead a safeguard—considering prompt budgets and the risk of incorrect fixes caused by partial context—ensuring the model only edits files for which it has received the full content; edits outside of this scope trigger an EDIT_MISMATCH error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Pull requests that update java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(review): agentic fix that opens a PR with the change

1 participant