DEV Community

Harishbabu R
Harishbabu R

Posted on

I built an autonomous AI agent to fix my PR comments (so I don't have to)

If you work in frontend development, you know the absolute worst part of the job isn't writing the initial feature. It's the code review feedback loop.

You open a PR, and a few hours later, a senior dev leaves a handful of totally valid but tedious comments:

"Can we extract this logic into a custom hook?"

"You missed an aria-label here."

"Let's use the design system instead of a raw ."

Now you have to context-switch, stash your current work, checkout the old branch, make the 5-minute edits, run the linter, push the commit, and wait for CI to pass. It completely nukes your engineering velocity.

I got tired of this, so I built a localized AI agent that acts as a junior developer. When a reviewer leaves a comment on a PR ending with @agent fix, the agent wakes up, reads the comment, edits the code, runs the local linter to verify the syntax, and pushes the fix automatically.

Here is how I built it for free using the Google Antigravity Python SDK and GitHub Actions.

The Architecture: Zero-Cost and Serverless
I didn't want to maintain a backend or pay cloud computing costs for this. Instead, I built it as a Bring-Your-Own-Key (BYOK) GitHub Action.

The Trigger: A GitHub Action workflow listens for issue_comment events on Pull Requests.

The Brain: A Python script utilizing the new Antigravity SDK initializes Gemini 3.5 Flash.

The Execution: The SDK natively handles the file system and bash execution. It navigates to the file, rewrites the code, and tests it.

The Push: Standard git commands commit the patch back to the PR.

Because it runs entirely on GitHub's runners, the hosting cost is exactly $0.

The "Containment Field" (Preventing AI Hallucinations)
The biggest reason engineers don't trust AI with their codebase is "helpful refactoring." You ask an LLM to change a button color, and it decides to rewrite a 500-line file to make it "cleaner," causing a massive merge conflict.

To prevent this, the Antigravity agent must be strictly sandboxed. I engineered a system prompt that forces the AI into a highly restrictive set of behaviors:

Zero Collateral Damage: Make the absolute minimal code changes necessary to satisfy the comment. Do not refactor surrounding code.

Locality Constraint: You are restricted to editing ONLY the file mentioned in the payload.

Verification: After editing, you MUST use the BashExecution tool to run npm run lint or eslint on the file.

Graceful Failure: If validation fails, DO NOT push. Revert the file and output exactly: AUTOMATED_ABORT: I attempted this fix but it broke validation.

The Code: Wiring the Antigravity Agent
The beauty of the Antigravity SDK is that you don't have to write custom tool-calling loops to read files or run bash commands; it handles the agentic state under the hood.

DependaFix - AI PR Comment Resolution Agent πŸš€

DependaFix is an autonomous AI Junior Software Engineer that lives in your GitHub Actions. It reads PR review comments, instantly applies the minimal necessary code fixes to the target files, runs your local linters, and commits the fix. Powered by the hyper-fast gemini-3.5-flash model via the google-antigravity SDK.

⚑ Features

  • Zero Collateral Damage: Makes the minimal changes necessary, matching your existing codebase paradigm.
  • Locality Constraint: Edits ONLY the files specified in the PR comment.
  • Self-Verifying: Uses the Antigravity BashExecution tool to run your local linters and tests before pushing any code.
  • Graceful Failure: If the AI's fix breaks your build or validation fails, it automatically aborts and outputs 'AUTOMATED_ABORT: I attempted this fix but it broke validation.'

πŸ›’ How to Buy

DependaFix is a premium Micro-SaaS tool available for a one-time lifetime payment.

  1. Purchase your Lifetime License from…

Top comments (0)