Welcome to PR-Agent Settings
Relevant source files
The following files were used as context for generating this wiki page:
PR-Agent Central Configuration manages the global settings and autonomous repair scripts for Pull Requests (PRs) across repositories owned by @JWEB0689. This system centralizes the configuration for PR-Agent to ensure consistent code review, description generation, and automated code improvements.
Sources: README.md:1-5
Configuration Management
The system uses a hierarchical configuration structure to control PR-Agent behavior across the organization.
Global Settings Inheritance
PR-Agent automatically loads the .pr_agent.toml file from the JWEB0689/pr-agent-settings repository for every PR in any repository owned by @JWEB0689. This central file defines the default behavior for all tools.
Sources: README.md:8-11
Repository Overrides
Individual repositories override global defaults by defining their own .pr_agent.toml file. This allows project-specific customizations while maintaining a global baseline.
Sources: README.md:13-14
Autonomous Fixer (autofix.py)
The autofix.py script acts as an autonomous senior software engineer. It attempts to resolve findings flagged by the AI code-review bot or repair CI build and test failures.
Operational Modes
The script operates in two primary modes determined at runtime:
- review-fix: Triggered when PR-Agent leaves review findings (inline comments or summaries). It sends flagged file contents and comments to Gemini to generate updated code.
- ci-fix: Triggered when no review findings exist but local tests fail. It diagnoses the root cause from error logs and applies repairs.
Sources: scripts/autofix.py:7-15, scripts/autofix.py:326-342
Workflow Logic
The following diagram illustrates the decision logic and execution flow of the autonomous fixer:
The script prioritizes human-like review findings before attempting general CI repair. If a repair fails re-verification, it rolls back changes.
Sources: scripts/autofix.py:326-348, scripts/autofix.py:195-220
Integration and Interactive Commands
The system supports standard PR-Agent interactive commands via GitHub comments.
| Command | Action |
|---|---|
/review | Performs code review with security and test analysis. |
/describe | Generates PR description and changelog. |
/improve | Provides commit-ready inline code suggestions. |
/ask <question> | Responds to specific questions about PR changes. |
Sources: README.md:20-25
Automated Verification
The detect_test_runner function identifies the appropriate test command based on the repository structure.
| Project Type | File Indicator | Command |
|---|---|---|
| Rust (v2) | v2/Cargo.toml | cargo check --workspace --no-default-features |
| Rust (Root) | Cargo.toml | cargo check --workspace |
| Node.js | package.json | npm test or npm run build |
| Python | pyproject.toml | pytest -q |
| Go | go.mod | go test ./... |
Sources: scripts/autofix.py:59-82
Environment Configuration
The autonomous fixer requires specific environment variables to interact with the Google Gemini API and GitHub.
# Required Environment Variables
GEMINI_API_KEY = "Google AI Studio key"
REPO = "owner/repo"
PR_NUMBER = "Pull Request ID"
HEAD_REF = "PR head branch for pushing fixes"
GH_TOKEN = "GitHub token for API access"
Sources: scripts/autofix.py:17-26
AI Model Defaults
The script defaults to using the gemini-3.8-flash model for generating repairs. It enforces a maximum file size of 80,000 bytes and limits context to 12 files to maintain performance and accuracy.
Sources: scripts/autofix.py:28-30
Summary
PR-Agent Settings provides a centralized management layer for AI-driven PR assistance. By combining global configuration inheritance with an autonomous repair script, the system automates both code review and the subsequent fixing of identified issues or build failures.