{"owner":"The-PR-Agent","repo":"pr-agent","hasSkills":true,"totalSkillsCount":11,"totalTokensCount":27180,"categories":["root-instruction","command-prompt"],"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md","docs/docs/commands/add_docs.md","docs/docs/commands/ask.md","docs/docs/commands/describe.md","docs/docs/commands/generate_labels.md","docs/docs/commands/help.md","docs/docs/commands/help_docs.md","docs/docs/commands/index.md","docs/docs/commands/review.md","docs/docs/commands/similar_issues.md","docs/docs/commands/update_changelog.md"],"skills":{"AGENTS.md":"# Repository Guidelines\n\nThis file is the shared source of repository guidance for coding agents. Tool-specific instruction files should import it instead of repeating repository-wide rules.\n\n## Dos and Don’ts\n\n- **Do** match the interpreter requirement declared in `pyproject.toml` (Python ≥ 3.12) and install dependencies with `uv sync` (runtime + dev, from `uv.lock`) before running tools.\n- **Do** run tests with `PYTHONPATH=.` set to keep imports functional (for example `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`).\n- **Do** adjust configuration through `.pr_agent.toml` or files under `pr_agent/settings/` instead of hard-coding values.\n- **Don’t** commit secrets or access tokens; rely on environment variables as shown in the health and e2e tests.\n- **Don’t** reformat or reorder files globally; match existing 120-character lines, import ordering, and docstring style.\n- **Don’t** delete or rename configuration, prompt, or workflow files without maintainer approval.\n\n## Project Structure and Module Organization\n\nPR-Agent automates AI-assisted reviews for pull requests across multiple git providers.\n\n- `pr_agent/agent/` orchestrates commands (`review`, `describe`, `improve`, etc.) via `pr_agent/agent/pr_agent.py`.\n- `pr_agent/commands/` implements individual capabilities such as reviewers, code suggestions, docs updates, and label generation.\n- `pr_agent/algo/` contains shared algorithms, model handlers, prompt/token handling, types, and utilities.\n- `pr_agent/git_providers/` handles integrations with GitHub, GitLab, Bitbucket (cloud and server), Azure DevOps, Gitea, Gerrit, CodeCommit, local checkouts, and plain diffs; `pr_agent/identity_providers/` handles identity and `pr_agent/secret_providers/` handles secrets.\n- `pr_agent/settings/` stores Dynaconf defaults (prompts, configuration templates, ignore lists) respected at runtime; `.pr_agent.toml` overrides repository-level behavior.\n- `pr_agent/servers/` contains webhook and service entrypoints.\n- `tests/unittest/`, `tests/e2e_tests/`, and `tests/health_test/` contain pytest-based unit, end-to-end, and smoke checks.\n- `docs/` holds the Docusaurus site (`docs/docusaurus.config.js` and `docs/sidebars.js` plus content under `docs/docs/`); theme overrides live in `docs/src/` and static assets in `docs/static/`.\n- `.github/workflows/` defines CI pipelines for unit tests, coverage, docs deployment, pre-commit, and PR-agent self-review.\n- `docker/` provides build targets for services (`github_app`, `gitlab_webhook`, etc.) and the `test` stage used in CI; the root `Dockerfile.github_action_dockerhub` only wraps the published `github_action` image for `action.yaml`.\n\n## Architecture and Request Flow\n\nPR-Agent is a CLI/server that runs AI-powered commands (`/review`, `/describe`, `/improve`, `/ask`, etc.) against pull requests on supported git providers or local input. The main dispatch flow is `pr_agent/agent/pr_agent.py` → `command2class` → a command class under `pr_agent/commands/`.\n\nA command generally obtains the appropriate git provider, gathers pull-request context, prepares prompt variables and templates, calls the configured model handler, and publishes or stores the result through the provider.\n\n### Prompt Building\n\nPrompt-driven commands generally construct a `self.vars` dictionary and pass it with the system/user prompt strings to `TokenHandler`. Prompt rendering uses Jinja2 with `StrictUndefined`, so variables referenced by a template should be present in the corresponding vars dictionary; define optional values explicitly and guard optional sections with Jinja conditionals.\n\nSystem/user prompt strings live as TOML files under `pr_agent/settings/` and are loaded into `global_settings` by `pr_agent/config_loader.py`. Command and prompt names normally correspond, for example:\n\n- `pr_reviewer.py` ↔ `pr_reviewer_prompts.toml`\n- `pr_description.py` ↔ `pr_description_prompts.toml`\n- `pr_questions.py` ↔ `pr_questions_prompts.toml`\n\nNew prompt files must also be registered in the `settings_files=[...]` list in `pr_agent/config_loader.py` or they will not be loaded into `global_settings`.\n\n### Settings and Runtime Configuration\n\nUse `get_settings()` from `pr_agent/config_loader.py` as the shared settings accessor. It returns the request-scoped Dynaconf object from `starlette_context` when one is present, otherwise the module-level `global_settings` object.\n\nDefaults live in `pr_agent/settings/configuration.toml`. Per-repository overrides come from the repository's `.pr_agent.toml` and are applied by `pr_agent/git_providers/utils.py::apply_repo_settings` before command dispatch. When introducing a configuration section, add its defaults and comments to `configuration.toml` and keep related prompt/config changes synchronized.\n\nWhen a key's detail belongs in a docs page, keep its `configuration.toml` comment to one line under 160 characters that states what the key does and its allowed values, then point to that page.\n\n`docs/docs/usage-guide/configuration_reference.md` is generated from `configuration.toml` by `python scripts/generate_config_reference.py [output_path]` (run from the repository root), and its header says not to edit it by hand. Write the output to a temporary path and diff it against the page before replacing anything. `tests/unittest/test_config_reference.py` checks that the page matches the generator output, lists exactly the active keys, and asserts a hard-coded active-key count, so update that count when adding or removing keys.\n\nRepository overrides are filtered by `pr_agent/config_security.py`; host-only keys must be supplied through host configuration. Configuration file merges preserve other fields in a section but replace overlapping list/dict values rather than appending or deep-merging; environment variables take precedence.\n\nSensitive values should stay in environment variables or the gitignored `.secrets.toml` files under `pr_agent/settings/` and `pr_agent/settings_prod/`. `apply_secrets_manager_config()` optionally loads values from AWS Secrets Manager.\n\n### Git Providers\n\n`pr_agent/git_providers/` contains provider implementations that share the `GitProvider` interface in `pr_agent/git_providers/git_provider.py`. Provider-dependent behavior should be selected through capability checks such as `provider.is_supported(\"feature\")` rather than concrete provider-type checks, because individual providers can stub or override capabilities. Some output is gated this way too: semantic file types and several other `/describe` sections are only emitted where `gfm_markdown` is supported.\n\n### Servers and Entrypoints\n\n`pr_agent/servers/` hosts webhook and service entrypoints that translate provider events into `PRAgent.handle_request(...)` calls. The CLI entrypoint is `pr_agent/cli.py`, registered as the `pr-agent` console script.\n\n## Build, Test, and Development Commands\n\n- Install dependencies (runtime + dev) into a project virtualenv from the lockfile with `uv sync` using a uv version that satisfies `tool.uv.required-version` in `pyproject.toml`; `uv run` auto-syncs before each command.\n- Run a single unit test (verified): `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`.\n- Run the full unit suite: `PYTHONPATH=. uv run pytest tests/unittest -v`.\n- CI also runs `uv run pytest -q tests/packaging/test_help_docs_package.py`; it is outside `testpaths`, so the unit suite does not cover it. The distribution-contract test checks that the installed uv version satisfies `tool.uv.required-version` in `pyproject.toml`.\n- Execute the CLI locally once dependencies and API keys are available: `uv run pr-agent --pr_url <https://host/org/repo/pull/123> review`.\n- Build the test Docker target mirror of CI when containerizing: `docker build -f docker/Dockerfile --target test .` (loads dev dependencies and copies `tests/`).\n- Build the documentation the same way CI does (Node.js 22): `npm ci` then `npm run build` from `docs/`; `npm start` serves a live preview. After building, run `python3 scripts/check_docs_urls.py` from the repository root to check `docs/build` as CI does. The `docs-ci` workflow publishes `docs/build` to GitHub Pages.\n\n## Coding Style and Existing Tooling\n\nRuff is the single linting tool: `pyproject.toml` configures it and the pre-commit Ruff hook enforces it (Flake8 and the standalone isort hook have been removed).\n\n- Keep Python lines within the 120-character limit declared in `pyproject.toml`.\n- `pyproject.toml` configures Ruff rules `E`, `F`, `B`, `I`, `UP`, `FURB`,  `PERF` and `PLE`. Within the files touched by the task, fix lint violations rather than adding ignore entries. Remove corresponding ignore entries only when they are no longer needed, and preserve intentional exceptions.\n- Before committing, run `uv run ruff check --fix <paths>` on the Python files you touched and fix every issue it reports. Keep fixes mechanical (rename, remove unused imports, sort imports); do not alter program logic while cleaning up — if a lint fix would change behavior, surface it instead of applying it silently.\n- `.pre-commit-config.yaml` is the source of truth for enabled pre-commit hooks. Run them on the files you touched with `uvx pre-commit run --files <paths>` and review the automatic edits so unrelated changes are not included. The pre-commit GitHub Actions workflow runs on pull requests, so the hooks are enforced in CI.\n- No general-purpose Python formatter is currently enforced (`ruff format` is deliberately not adopted yet). Preserve the surrounding file's formatting and avoid unrelated rewrites or repository-wide formatting.\n- Prefer double quotes for Python strings where consistent with the surrounding file.\n- Match existing docstring and comment style—concise English comments using imperative phrasing only where necessary.\n- Configuration files in `pr_agent/settings/` are TOML; preserve formatting, section order, and comments when editing prompts or defaults.\n- Markdown in `docs/` uses Docusaurus conventions: every page starts with YAML front matter (`title`, `sidebar_position`), admonitions use `:::note` fences, collapsible sections use `<details>`, and images live in `docs/static/img/` referenced as `/img/<file>`. Pages stay `.md` (CommonMark) unless they need a JSX component, in which case they are `.mdx`. Register every new page in `docs/sidebars.js`.\n\n## Testing Guidelines\n\n- Pytest is the standard framework; keep new tests under the closest matching directory (`tests/unittest/` for unit logic, `tests/e2e_tests/` for integration flows, `tests/health_test/` for smoke coverage).\n- Pytest configuration lives in `pyproject.toml`, including `asyncio_mode = \"auto\"` and `testpaths = [\"tests/unittest\"]`. The Docker test image keeps `pyproject.toml` at `/app` (uv installs from it), so CI inherits these settings as well. Plain `PYTHONPATH=. uv run pytest` therefore defaults to the unit suite; invoke end-to-end tests explicitly.\n- Prefer focused unit tests that isolate helpers in `pr_agent/algo/`, `pr_agent/commands/`, or provider adapters; use parameterized tests where existing files already do so.\n- Set `PYTHONPATH=.` when invoking pytest from the repository root to avoid import errors.\n- End-to-end suites require provider credentials and may take several minutes; `TOKEN_GITHUB`, `TOKEN_GITLAB`, `BITBUCKET_USERNAME`, and `BITBUCKET_PASSWORD` are CI secret names, not runtime environment variables (see the mappings in `.github/workflows/e2e_tests.yaml`). These tests create remote branches and pull/merge requests and expect deployed apps/webhooks to process them; run them only when credentials and sandboxes are configured.\n- `tests/health_test/main.py` is a manual script for `/describe`, `/review`, and `/improve`; it asserts artifact headers inline, not checked-in artifact files. Update those inline assertions if prompts change meaningfully. CI provider smoke runs `tests/health_test/test_github_smoke.py` instead (`/describe` only, model stubbed, `GITHUB.USER_TOKEN`).\n\n## Review Checklist\n\n- A setting can arrive as a TOML list, a plain string, or an environment value that Dynaconf parses as TOML (`SECTION__KEY=123` arrives as an int). Code that reads it handles each form.\n- A fix in one git provider, AI handler or server usually applies to its siblings. Check the same logic in the others and fix them or name them in the PR.\n- New or changed regexes run in linear time: no nested or adjacent unbounded quantifiers that can match the same characters, and no unbounded leading quantifier in an unanchored search. User-supplied patterns and globs get a length cap before they are compiled or translated.\n- Docs and config comments describe what the branch does. A PR that changes a default or a setting's behavior updates the `configuration.toml` comment and the docs page that state it, and none documents behavior from another PR.\n\n## Commit and Pull Request Guidelines\n\n- Follow `CONTRIBUTING.md`: keep changes focused, add or update tests, and use Conventional Commit-style messages (e.g., `fix: handle missing repo settings gracefully`).\n- Target branch names follow `feature/<name>` or `fix/<issue>` patterns for substantial work.\n- Reference related issues and update README or docs when user-facing behavior shifts.\n- Before requesting review, run the relevant local checks above and make sure the corresponding CI workflows (`build-and-test`, `pre-commit`) pass; coverage is collected and uploaded by `build-and-test` except on docs-page-only PRs, which run packaging and documentation checks instead; `docs-ci` builds the documentation on every pull request that touches `docs/**` (publishing only on pushes to `main` and `add-docs-portal`). That build fails on broken links and anchors, and also runs `scripts/check_docs_urls.py` to confirm the documentation URLs hardcoded in `pr_agent/` and the README still resolve.\n- Include screenshots or terminal captures when modifying user-visible output or documentation previews.\n\n## Safety and Permissions\n\n- Ask for confirmation before adding dependencies, renaming files, or changing workflow definitions; many consumers embed these paths and prompts.\n- Stay within existing formatting and directory conventions—avoid mass refactors, re-sorting of prompts, or reformatting Markdown beyond the touched sections.\n- You may read files, list directories, and run targeted lint/test/doc commands without prior approval; coordinate before launching full Docker builds or e2e suites that rely on external credentials.\n- Never commit cached credentials, API keys, or coverage artifacts; CI already handles secrets through GitHub Actions.\n- Treat prompt and configuration files as single sources of truth—keep related defaults and prompts under `pr_agent/settings/` synchronized when behavior changes. The root `.pr_agent.toml` is intended for this repository's hosted Qodo reviews, not as a mirror of the packaged defaults; some entries have no open-source implementation.\n\n## Security and Configuration Tips\n\n- Secrets should be supplied through environment variables (see usages in `tests/e2e_tests/test_github_app.py` and `tests/health_test/main.py`); do not persist them in code or configuration files.\n- Adjust runtime behavior by overriding keys in `.pr_agent.toml` or by supplying repository-specific Dynaconf files; keep overrides minimal and documented inside the PR description.\n- Review `SECURITY.md` before disclosing vulnerabilities and follow its contact instructions for responsible reporting.\n","docs/docs/commands/add_docs.md":"---\ntitle: \"Add Docs\"\nsidebar_position: 6\n---\n\n## Overview\n\nThe `add_docs` command scans the PR code changes and suggests documentation for any code components that are missing documentation, such as functions, classes, and methods.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/add_docs\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/add_docs` on any PR:\n\n<img src=\"/img/add_docs_comment.png\" alt=\"Add Docs\" width=\"512\" />\n\nThe command will generate documentation suggestions as inline code suggestions.\n\n### Language-specific documentation styles\n\nThe command automatically detects the programming language and generates documentation in the appropriate format:\n\n| Language | Documentation Format |\n|----------|---------------------|\n| Python | Docstrings (Sphinx, Google, Numpy styles) |\n| Java | Javadocs |\n| JavaScript/TypeScript | JSdocs |\n| C++ | Doxygen |\n| Other | Generic documentation |\n\n## Configuration options\n\nUnder the section `[pr_add_docs]`, the following options are available:\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `extra_instructions` | string | `\"\"` | Additional instructions for the AI model |\n| `docs_style` | string | `\"Sphinx\"` | Documentation style for Python. Options: `\"Sphinx\"`, `\"Google Style with Args, Returns, Attributes...etc\"`, `\"Numpy Style\"`, `\"PEP257\"`, `\"reStructuredText\"` |\n| `use_repo_context` | boolean | `true` | Apply conventions from configured repository instruction files (for example `AGENTS.md`); set to `false` to opt out |\n\n### Example configuration\n\nTo customize the documentation style, add the following to your configuration file:\n\n```toml\n[pr_add_docs]\ndocs_style = \"Google Style with Args, Returns, Attributes...etc\"\nextra_instructions = \"Focus on documenting public methods and include usage examples\"\n```\n\nBy default, `/add_docs` follows the shared `config.repo_context_files` selection (`[\"AGENTS.md\"]` by default,\nread from the repository default branch). To disable repository instructions for `/add_docs` only:\n\n```toml\n[pr_add_docs]\nuse_repo_context = false\n```\n\nStructured sibling-repository entries in `config.repo_context_files` are excluded from `/add_docs` to avoid publishing private sibling guidance in PR suggestions. Local repository entries remain in effect.\n\nSetting `config.repo_context_files = []` disables repository instructions across commands. Repository instructions\nare optional prompt context: if they do not fit the selected model's input budget, they are omitted without shortening\nthe PR diff. Explicit `extra_instructions` and `docs_style` take precedence. Repository instructions may add file\nreads and prompt tokens, but do not introduce another model call.\nRepository instructions are appended to the rendered system prompt, including with custom `[pr_add_docs_prompt]`\ntemplates. Existing template variables and diff rendering are left unchanged.\n\n### Command line options\n\nYou can pass configuration options directly in the command:\n\n```\n/add_docs --pr_add_docs.docs_style=\"Numpy Style\"\n```\n\n## How it works\n\n1. The command analyzes the PR diff to identify code components (functions, classes, methods) that lack documentation\n2. It uses AI to generate appropriate documentation based on the code context and language\n3. Documentation suggestions are published as inline code suggestions that can be applied with a single click\n\n### Model response failures\n\nEach model response is validated before it is accepted. Missing content or an\ninvalid documentation structure triggers the next model in `CONFIG.FALLBACK_MODELS`,\nif configured. An explicit empty list or `Code Documentation: null` is a valid\nempty result and does not trigger another model call.\n\nIf all model attempts fail, PR-Agent records the command as failed and removes\nthe temporary progress comment. With `CONFIG.PUBLISH_OUTPUT` enabled, it also\nattempts to post **Failed to generate code documentation for this PR.**\n\n### Publication failures\n\nSuggestions are skipped if their original source line cannot be reliably retained,\nincluding when file content is unavailable or incomplete. Valid suggestions in the\nsame response can still be published.\n\nWith `CONFIG.PUBLISH_OUTPUT` enabled, PR-Agent retries unsuccessful batch\npublication one suggestion at a time. If the batch and every individual retry\nexplicitly report failure, it attempts to post **Failed to publish code\ndocumentation for this PR.** and records the command as failed. Partial success\nor an unconfirmed provider result does not trigger this all-failed outcome.\n","docs/docs/commands/ask.md":"---\ntitle: \"Ask\"\nsidebar_position: 5\n---\n\n## Overview\n\nThe `ask` command answers questions about the PR, based on the PR code changes. Make sure to be specific and clear in your questions.\nIt can be invoked manually by commenting on any PR:\n\n```\n/ask \"...\"\n```\n\n## CLI JSON output\n\nThe CLI can write a single JSON file containing the question, answer, and available token usage:\n\n```bash\npython -m pr_agent.cli --pr_url https://github.com/org/repo/pull/123 \\\n    --json-output answer.json ask \"What changed?\"\n```\n\nThis also works with `ask_question` and in [Plain Diff mode](../usage-guide/plain_diff_mode.md):\n\n```bash\ngit diff | python -m pr_agent.cli --stdin --json-output answer.json ask \"What changed?\"\n```\n\nPlace `--json-output` before the command. The file is overwritten for each invocation and has\n`question`, `answer`, and `usage` fields. `usage` is an empty object when token counts are unavailable,\nincluding when the command explains that no changed files could be analyzed without calling a model.\n\nFor PR URLs, setting `config.publish_output = false` in the host configuration suppresses PR\ncomments without suppressing the requested JSON file. The existing\n[push outputs](../usage-guide/push_outputs.md) feature serves a different purpose: it delivers\nopt-in Ask records to operator-configured sinks and requires publishing to be enabled.\n\n## Example usage\n\n<img src=\"/img/ask_comment.png\" alt=\"Ask Comment\" width=\"512\" />\n\n<img src=\"/img/ask.png\" alt=\"Ask\" width=\"512\" />\n\n## Repository instructions\n\nBoth top-level `/ask` and inline `/ask_line` can use the same repository instruction files as `/review`, `/describe`, and `/improve`.\nFor example, ask whether a migration follows the rollback rules in an existing architecture decision record:\n\n```toml\n[config]\nrepo_context_files = [\"AGENTS.md\", \"docs/adr/database-migrations.md\"]\n```\n\n```text\n/ask \"Does this migration follow our rollback and compatibility rules?\"\n```\n\nLike `/review`, `/describe`, and `/improve`, both Ask modes read `AGENTS.md` from the repository root by default.\nSet `config.repo_context_files = []` in the root repository settings to disable repository instructions for all commands.\nComment arguments cannot change the configured file list.\n\nThe existing [repository context settings](../usage-guide/additional_configurations.md#bringing-per-repo-context-files-to-pr-agent)\ncontrol file selection, source branches, imports, and line limits. Files come from the repository's default branch unless\nconfigured otherwise. Providers without repository file access skip this context; missing or empty files are also skipped.\n\nThe question, selected discussion history, and packed diff keep their existing token budget. The instruction block,\nalready bounded by `repo_context_max_lines`, is included only if it fits in the remaining model context in full.\nOtherwise, the corresponding Ask mode keeps its original prompt and adds a short omission notice to the answer. It does not retry another model\njust to fit instructions. Normal model retries reconsider the original instruction block without reading the files again.\nFor `/ask_line`, the selected lines, complete diff hunk, and fitted thread history likewise take precedence over\nrepository instructions. No instruction files are read when the requested diff hunk is unavailable.\nIncluding repository instructions can add repository API reads and input tokens, but does not add a separate model request.\n\n## Ask lines\n\nYou can run `/ask` on specific lines of code in the PR from the PR's diff view. The command will answer questions based on the code changes in the selected lines.\n\nFor line comments handled by the GitHub App, GitHub Actions, or GitLab webhook, `/ask_question` is an alias of `/ask`.\nStart the comment with `/ask`, `/ask_question`, or `/ask_line` after any leading whitespace;\nthese command names are case-insensitive. Other tokens such as `/asking` are not Ask commands.\nAzure DevOps accepts lowercase `/ask_question` for the same thread and line handling as `/ask`;\nits webhook command names remain case-sensitive.\n\n- Click on the '+' sign next to the line number to select the line.\n- To select multiple lines, click on the '+' sign of the first line and then hold and drag to select the rest of the lines.\n- write `/ask \"...\"` in the comment box and press `Add single comment` button.\n\n<img src=\"/img/Ask_line.png\" alt=\"Ask Line\" width=\"512\" />\n\nIf no matching diff hunk is found for the selected lines, the command explains this without calling a model.\n\nIn the GitHub App, GitHub Actions, and GitLab webhook, a file comment whose first non-whitespace token is `/ask` or\n`/ask_question` uses that file's complete diff as context. These two command names are case-insensitive.\nThe existing file filters and input budgets still apply. If the file has no analyzable diff, or the question cannot\nbe prepared within the configured input budget, the command explains this without calling a model.\nThe answer is posted in the original file-comment thread with a link to the question.\nEarlier replies are included when `pr_questions.use_conversation_history` is enabled and the input budget allows.\nText resembling command options is treated as part of the question.\n\nIn the Azure DevOps webhook, `/ask`, `/ask_question`, or a mention of PR-Agent in a thread on a whole file also uses\nthat file's complete diff, with the same filters, input budgets, and notes. The answer is posted in that thread with a\nlink to the question, and earlier comments in the thread are included as described above.\n\nWith `pr_questions.use_conversation_history=true` (the default), line questions on GitHub, GitLab, and Azure DevOps\ncan include earlier comments from the same thread. Azure DevOps also supports history for threaded top-level questions.\nOther questions are answered independently.\n\nOn GitLab, this reads the selected discussion before answering, adding an API request and potentially more model input\ntokens, but no separate model request. Set `pr_questions.use_conversation_history=false` to answer without earlier\ncomments. Line questions still require a matching hunk in the current diff.\n\n## Ask on images\n\nYou can also ask questions about images that appear in the comment, where the entire PR code will be used as context.\n<br>\nThe basic syntax is:\n\n```\n/ask \"...\"\n\n[Image](https://real_link_to_image)\n```\n\nwhere `https://real_link_to_image` is the direct link to the image.\n\nNote that GitHub has a built-in mechanism of pasting images in comments. However, pasted image does not provide a direct link.\nTo get a direct link to an image, we recommend using the following scheme:\n\n1. First, post a comment that contains **only** the image:\n\n   <img src=\"/img/ask_images1.png\" alt=\"Ask image1\" width=\"512\" />\n\n2. Quote reply to that comment:\n\n   <img src=\"/img/ask_images2.png\" alt=\"Ask image2\" width=\"512\" />\n\n3. In the screen opened, type the question below the image:\n\n   <img src=\"/img/ask_images3.png\" alt=\"Ask image3\" width=\"512\" />\n   <img src=\"/img/ask_images4.png\" alt=\"Ask image4\" width=\"512\" />\n\n4. Post the comment, and receive the answer:\n\n   <img src=\"/img/ask_images5.png\" alt=\"Ask image5\" width=\"512\" />\n\nSee a full video tutorial [here](https://www.qodo.ai/images/pr_agent/ask_image_video.mov)\n\n## Linked ticket context\n\nEnable linked ticket context when asking how a PR satisfies an issue's requirements or acceptance criteria:\n\n```toml\n[pr_questions]\nuse_ticket_context = true\n```\n\nSet this in host or root repository configuration. PR comment/CLI arguments and per-directory files\ncannot enable it because ticket integrations use the operator's credentials.\n\nThis is disabled by default and applies to top-level `/ask` and `ask_question`, not inline `/ask_line` questions.\nIt uses the same [ticket integrations](../core-abilities/fetching_ticket_context.md), credentials, reference formats,\naccess checks and fetch limits as `/review` and `/describe`. Tickets are discovered from the PR/MR metadata;\nlinks written only in the question are not additional ticket sources. This option is independent of\n`pr_reviewer.require_ticket_analysis_review`.\n\nTicket integrations use the operator's configured access policy, not the asker's personal ticket credentials.\nFor Jira, the host-controlled `jira.project_keys` allowlist still applies (`[]` disables lookups);\nconfigure only projects whose ticket content may appear in PR answers.\n\nTicket content is fetched once per command, after an analyzable diff fits. It adds API reads and input tokens\nwhen enabled and uses the existing model request. Unavailable tickets are skipped. Each model attempt includes only\nwhole ticket records that fit after the existing question, conversation history and selected diff, so ticket\ncontext does not displace code already selected for the answer. Large tickets may be omitted, including all\ntickets when there is no room. The usual diff-based answer remains available in that case.\n\n## Configuration options\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>ask_heading</b></td>\n    <td>\n      Plain-text heading for top-level <code>/ask</code> answers. The default is <code>Ask</code>.\n      Markdown renderers escape punctuation to keep the surrounding formatting and ❓ emoji fixed,\n      while plain-text converters publish the configured text without escape characters.\n      This does not affect <code>/ask_line</code> replies or the <code>Answer</code> section heading.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10. Instead, tell the user this type of question is not allowed.\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>use_conversation_history</b></td>\n    <td>If set to true, the command will use the conversation history from the same thread when answering questions on specific code lines (GitHub, GitLab, and Azure DevOps) or threaded top-level questions (Azure DevOps only). Default is true.</td>\n  </tr>\n  <tr>\n    <td><b>use_ticket_context</b></td>\n    <td>Include linked ticket content in top-level questions using the remaining prompt budget. Default is false. See <a href=\"#linked-ticket-context\">Linked ticket context</a>.</td>\n  </tr>\n</table>\n\n</details>\n\nExample usage in a configuration file:\n\n```toml\n[pr_questions]\nask_heading = \"Architecture Question\"\nextra_instructions = \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10.\"\n```\n\nThe heading above renders as `### **Architecture Question** ❓`.\n\nExample usage in a PR comment:\n\n```\n/ask \"What does this change do?\" --pr_questions.extra_instructions=\"Answer in one short paragraph.\"\n```\n","docs/docs/commands/describe.md":"---\ntitle: \"Describe\"\nsidebar_position: 2\n---\n\n## Overview\n\nGenerate a PR title, type, summary, code walkthrough and labels.\n\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or it can be invoked manually by commenting on any PR:\n\n```\n/describe\n```\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/describe` on any PR:\n\n<img src=\"/img/describe_comment.png\" alt=\"Describe comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a description for the PR:\n\n<img src=\"/img/describe_new.webp\" alt=\"Describe New\" width=\"512\" />\n\nWhile a large PR's chunks run, the temporary `Preparing PR description...` comment is rewritten in place, for example `Preparing PR description... analyzed 2 of 3 chunks`; once every chunk has settled, `, 1 chunk failed` is added if a chunk gave up. This needs `config.publish_output_progress` and a provider that can edit and remove comments; single-chunk runs keep the plain placeholder.\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/describe --pr_description.some_config1=... --pr_description.some_config2=...\n```\n\nFrom the CLI, save the generated description and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output describe.json describe\n```\n\nThe JSON file is written after the description is assembled. Place `--json-output` before `describe` or `describe_pr`; it works with `--pr_url` or with plain-diff input (`--stdin` or `--diff-file`).\n\n### Automatic triggering\n\nTo run the `describe` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/describe\",\n    ...\n]\n\n[pr_description]\npublish_labels = true\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_description]` section contains the configurations for the `describe` command you want to edit (if any).\n\n## File walkthrough summaries\n\nOn providers that support the HTML walkthrough, short file summaries appear on a new line after the filename.\nWhen detailed changes are available, expanding the file entry reveals them while the short summary stays visible when collapsed.\nGitLab descriptions no longer use description-list indentation for these summaries.\n\nThe description reader can extract file summaries from both the current and legacy walkthrough formats.\nIf separate PR-Agent installations generate walkthroughs and reuse their file summaries (for example, `/describe` and `/review`), upgrade them together; older readers cannot extract file summaries from the new format.\n\n## Preserving the original user description\n\nBy default, PR-Agent tries to preserve your original PR description by placing it above the generated content.\nThis requires including your description during the initial PR creation.\n\n\"PR-Agent removed the original description from the PR. Why\"?\n\nFrom our experience, there are two possible reasons:\n\n- If you edit the description _while_ the automated command is running, a race condition may occur, potentially causing your original description to be lost. Hence, create a description before launching the PR.\n\n- When _updating_ a description previously generated by PR-Agent, `/describe` preserves text after the first recognized `### **User description**` heading until the next recognized boundary heading, trimming surrounding whitespace and a trailing `___`. If no boundary heading follows, it stops at the first `___` substring, or at the end if none is present, and trims surrounding whitespace. If the generated description has no recognized `### **User description**` heading, add that heading before your manual text; otherwise that text can be lost on the next body update.\n\n  Boundary headings are lines starting with `### **PR type**`, `### **PR description**`, `### **PR labels**`, `### **Type**`, `### **Description**`, `### **Labels**`, or `### 🤖 Generated by PR Agent`, matched case-insensitively outside fenced code blocks. Manual headings with these prefixes also end preservation, even if more text follows the prefix. Keep manual edits inside these boundaries; edits to generated sections are replaced.\n\n<img src=\"/img/pr_description_user_description.png\" alt=\"Describe comment\" width=\"512\" />\n\n## Flowchart Support {#sequence-diagram-support}\nThe `/describe` command includes a Mermaid flowchart summarizing the main PR changes on providers that support `gfm_markdown`.\n\nThis option is enabled by default via the `pr_description.enable_pr_diagram` param.\n\nThe direction of the diagram adapts to its shape. A diagram whose longest chain of nodes exceeds `pr_description.pr_diagram_direction_threshold` is drawn top-down rather than left-to-right, so that wide diagrams are not scaled down until they become unreadable. Set `pr_description.pr_diagram_direction` to `LR` or `TD` to pin the direction instead.\n\n\n[//]: # (### How to enable\\disable)\n\n[//]: # ()\n[//]: # (In your configuration:)\n\n[//]: # ()\n[//]: # (```)\n\n[//]: # (toml)\n\n[//]: # ([pr_description])\n\n[//]: # (enable_pr_diagram = true)\n\n[//]: # (```)\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>Possible configurations</summary>\n\n<table>\n  <tr>\n    <td><b>publish_labels</b></td>\n    <td>If set to true, the command will publish labels to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment</b></td>\n    <td>If set to true, the command will publish the description as a comment to the PR. If false, it will overwrite the original description.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment_persistent</b></td>\n    <td>If set to true and `publish_description_as_comment` is true, the command will publish the description as a persistent comment to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>add_original_user_description</b></td>\n    <td>If set to true, the command will add the original user description to the generated description.</td>\n  </tr>\n  <tr>\n    <td><b>generate_ai_title</b></td>\n    <td>If set to true, the command will also generate an AI title for the PR.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_type</b></td>\n    <td>If set to false, it will not show the `PR type` as a text value in the description content.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_description</b></td>\n    <td>If set to false, the AI-generated summary section will not be requested from the model, nor shown in the description content. The other sections (diagram, changes walkthrough) are unaffected.</td>\n  </tr>\n  <tr>\n    <td><b>final_update_message</b></td>\n    <td>If set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/the-pr-agent/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`.</td>\n  </tr>\n  <tr>\n    <td><b>enable_semantic_files_types</b></td>\n    <td>If set to true, \"Changes walkthrough\" section will be generated.</td>\n  </tr>\n  <tr>\n        <td><b>file_table_collapsible_open_by_default</b></td>\n        <td>Controls whether the file list in the \"Changes walkthrough\" section is initially open or closed.</td>\n  </tr>\n  <tr>\n    <td><b>collapsible_file_list</b></td>\n    <td>If set to true, the file list in the \"Changes walkthrough\" section will be collapsible. If set to \"adaptive\", the file list will be collapsible only when the number of files exceeds <code>collapsible_file_list_threshold</code>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_handling</b></td>\n    <td>If set to true, in case of a large PR the command will make several calls to the AI and combine them to be able to cover more files.</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_diagram</b></td>\n    <td>If set to true, the command will generate a Mermaid flowchart summarizing the main pull request changes. This field remains empty if not applicable.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction</b></td>\n    <td>Direction of the generated Mermaid flowchart: <b>adaptive</b>, <b>LR</b> or <b>TD</b>. With adaptive, the direction is chosen from the shape of the diagram.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction_threshold</b></td>\n    <td>With <b>adaptive</b> direction, a diagram whose longest chain exceeds this many nodes is drawn top-down instead of left-to-right.</td>\n  </tr>\n</table>\n\n</details>\n\n## Markers template\n\nTo enable markers, set `pr_description.use_description_markers=true`.\nMarkers enable to easily integrate user's content and auto-generated content, with a template-like mechanism.\n\nFor example, if the PR original description was:\n\n```\nUser content...\n\n## PR Type:\npr_agent:type\n\n## PR Description:\npr_agent:summary\n\n## PR Walkthrough:\npr_agent:walkthrough\n\n## PR Diagram:\npr_agent:diagram\n```\n\nThe marker `pr_agent:type` will be replaced with the PR type, `pr_agent:summary` will be replaced with the PR summary, `pr_agent:walkthrough` will be replaced with the PR walkthrough, and `pr_agent:diagram` will be replaced with the flowchart (if enabled).\n\n<img src=\"/img/describe_markers_before.png\" alt=\"Describe markers before\" width=\"512\" />\n\nbecomes\n\n<img src=\"/img/describe_markers_after.webp\" alt=\"Describe markers after\" width=\"512\" />\n\n**Configuration params**:\n\n- `use_description_markers`: if set to true, the command will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false.\n- `include_generated_by_header`: only applies when `use_description_markers` is true. If true (default), the command adds a 'Generated by PR Agent at ...' header to automatic content when the provider supplies a head commit SHA, otherwise the header is 'Generated by PR Agent' (or uses `config.bot_display_name` when configured). If false, no header is added.\n- `diagram`: if present as a marker, will be replaced by the PR flowchart (if enabled).\n\n## Custom labels\n\nThe default labels of the describe command are quite generic, since they are meant to be used in any repo: [`Bug fix`, `Tests`, `Enhancement`, `Documentation`, `Other`].\n\nYou can define custom labels that are relevant for your repo and use cases.\nCustom labels can be defined in the PR-Agent host configuration, or directly in the repo's\n[labels page](#handle-custom-labels-from-the-repos-labels-page). The host configuration options cannot be set from\nthe repository's `.pr_agent.toml` or comment arguments.\n\nMake sure to provide proper title, and a detailed and well-phrased description for each label, so the command will know when to suggest it.\nEach label description should be a **conditional statement**, that indicates if to add the label to the PR or not, according to the PR content.\n\n<details open>\n<summary>Auto-remove custom label when no longer relevant</summary>\n\nIf the custom label is no longer relevant, it will be automatically removed from the PR by running the `generate_labels` command or the `describe` command.\n\n</details>\n\n\n### Handle custom labels from a configuration file\n\nExample for a custom labels configuration setup in the PR-Agent host configuration:\n\n```\n[config]\nenable_custom_labels=true\n\n\n[custom_labels.\"sql_changes\"]\ndescription = \"Use when a PR contains changes to SQL queries\"\n\n[custom_labels.\"test\"]\ndescription = \"use when a PR primarily contains new tests\"\n\n...\n```\n\n### Handle custom labels from the Repo's labels page\n\nYou can also control the custom labels that will be suggested by the `describe` command from the repo's labels page:\n\n- GitHub : go to `https://github.com/{owner}/{repo}/labels` (or click on the \"Labels\" tab in the issues or PRs page)\n- GitLab : go to `https://gitlab.com/{owner}/{repo}/-/labels` (or click on \"Manage\" -> \"Labels\" on the left menu)\n\nNow add/edit the custom labels. they should be formatted as follows:\n\n- Label name: The name of the custom label.\n- Description: Start the description of with prefix `pr_agent:`, for example: `pr_agent: Description of when AI should suggest this label`.<br>\n\nExamples for custom labels:\n\n- `Main topic:performance` -  pr_agent:The main topic of this PR is performance\n- `New endpoint` -  pr_agent:A new endpoint was added in this PR\n- `SQL query` -  pr_agent:A new SQL query was added in this PR\n- `Dockerfile changes` - pr_agent:The PR contains changes in the Dockerfile\n- ...\n\nThe description should be comprehensive and detailed, indicating when to add the desired label. For example:\n<img src=\"/img/add_native_custom_labels.webp\" alt=\"Add native custom labels\" width=\"768\" />\n\n## Usage Tips\n\n:::tip[Automation]\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app) for the describe command is:\n```\npr_commands = [\"/describe\", ...]\n```\nmeaning the `describe` command will run automatically on every PR, with the default configurations.\n:::\n\n- Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:\n\n   ```\n   pr_commands = [\"/describe --pr_description.use_description_markers=true\", ...]\n   ```\n\n   the command will replace every marker of the form `pr_agent:marker_name` in the PR description with the relevant content, where `marker_name` is one of the following:\n\n   - `type`: the PR type.\n   - `summary`: the PR summary.\n   - `walkthrough`: the PR walkthrough.\n\n- Note that when markers are enabled, if the original PR description does not contain any markers, the command will not alter the description at all.\n","docs/docs/commands/generate_labels.md":"---\ntitle: \"Generate Labels\"\nsidebar_position: 7\n---\n\n## Overview\n\nThe `generate_labels` command scans the PR code changes and generates custom labels for the PR based on the content and context of the changes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/generate_labels\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/generate_labels` on any PR.\n\nThe command will analyze the PR and add appropriate labels.\n\nFor local or CI workflows that need label suggestions without a hosting-provider token,\npass a unified diff and write the filtered labels to a JSON artifact:\n\n```bash\npython -m pr_agent.cli --diff-file changes.diff --json-output labels.json generate_labels\n```\n\nThe JSON result contains a `labels` list and a `usage` object (empty when token usage\nis unavailable). Only model-generated labels that pass the existing allowlist are included;\nlabels already on a hosted PR are not included. A PR without analyzable changes produces\nan empty list. This option does not change the normal label publication behavior.\nCheck the command's exit status before consuming the artifact: a failed run does not delete a previous JSON file.\n\n## Configuration options\n\nThe `generate_labels` command uses configurations from the `[pr_description]` section for custom labels.\n\n### Enabling custom labels\n\nTo use custom labels, you need to enable them in the configuration:\n\nSet these options in the PR-Agent host configuration. Repository `.pr_agent.toml` files and comment arguments cannot\nchange them.\n\n```toml\n[config]\nenable_custom_labels = true\n```\n\n### Defining custom labels\n\nYou can define your own custom labels in the `[custom_labels]` section. See the [custom_labels.toml](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/custom_labels.toml) file for examples.\n\nExample configuration:\n\n```toml\n[custom_labels.\"Bug fix\"]\ndescription = \"A fix for a bug in the codebase\"\n\n[custom_labels.\"Feature\"]\ndescription = \"A new feature or enhancement\"\n\n[custom_labels.\"Documentation\"]\ndescription = \"Documentation changes only\"\n\n[custom_labels.\"Tests\"]\ndescription = \"Adding or modifying tests\"\n\n[custom_labels.\"Refactoring\"]\ndescription = \"Code refactoring without functional changes\"\n```\n\n### How labels are applied\n\n1. The command analyzes the PR diff and commit messages\n2. It uses AI to determine which labels best match the PR content\n3. Labels are automatically applied to the PR (if the git provider supports it)\n4. If labels cannot be applied directly, they are published as a comment\n\nBoth `/generate_labels` and `/describe` filter model-generated labels before publishing.\nThe allowed set contains the built-in PR types (`Bug fix`, `Tests`, `Enhancement`,\n`Documentation`, `Other`) plus the configured custom label names when custom labels\nare enabled. With custom labels enabled but no custom set configured, the default\nset also includes `Bug fix with tests`. Matching ignores case, and unknown generated\nlabels are dropped with a warning. Existing human-added labels are preserved and\nare not restricted by this filter.\n\nPrompt enum keys such as `bug_fix` and `RELEASE_READY` are resolved to their\nallowed display names, ignoring case. If a nonempty model response contains only\nrejected labels, `/generate_labels` leaves the current labels unchanged. An\nexplicit `labels: []` response retains the existing behavior of clearing old\nbot-owned labels while preserving human-added labels.\n\nIf the current labels cannot be read, `/generate_labels` skips publication and\nrecords the command as failed. A known provider failure while publishing labels\nalso marks the command as failed. With `config.propagate_command_errors = true`, these\nfailures raise an error after temporary-comment cleanup.\n\nA successful provider acknowledgement means its label operation completed normally;\nit does not verify the final remote label set. Providers apply labels differently,\nand a failure can leave some changes applied. The command does not retry or roll\nback those changes. Labels generated by `/describe` and `/review` remain auxiliary\nto their primary output.\n\n## Comparison with `/describe` labels\n\nThe `/describe` command also generates labels as part of its output. The key differences are:\n\n| Feature | `/generate_labels` | `/describe` |\n|---------|-------------------|-------------|\n| Purpose | Dedicated label generation | Full PR description with labels |\n| Output | Labels only | Title, summary, walkthrough, and labels |\n| Custom labels | ✅ Supported | ✅ Supported |\n| Use case | When you only need labels | When you want a complete PR description |\n\n## Tips\n\n- Use custom labels that match your team's workflow and labeling conventions\n- Combine with automation to automatically label PRs when they are opened\n- Review the generated labels and adjust custom label descriptions if the AI consistently misclassifies PRs\n","docs/docs/commands/help.md":"---\ntitle: \"Help\"\nsidebar_position: 9\n---\n\n## Overview\n\nThe `help` command provides a list of all the available commands and their descriptions.\nInvoke commands by posting their slash commands. The checkboxes shown on GitHub do not execute commands when checked.\n\nOn Bitbucket Cloud, Gerrit and CodeCommit, `/help` without a question displays an unsupported-format notice instead of the command list. `/help <question>` can still answer questions from the documentation.\n\nLocal mode only displays the unsupported-format notice for `/help`. Plain-diff mode supports the command list, but `/help <question>` is currently unavailable in both local and plain-diff modes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/help\n```\n\nCalling `/help` without a question displays the command list, where supported, without initializing an AI handler,\nso errors during that initialization do not block the list.\n`/help <question>` still uses the configured AI model.\n\nWhen answering a question, the command tries the configured fallback models if a model returns an invalid response format\nor an empty answer. If all attempts fail, no answer is published and the command records a failure.\nA response that reports no relevant information is still shown normally.\n\n## Example usage\n\nInvoke the `help` command by commenting on a PR with:\n\n<img src=\"/img/help1.png\" alt=\"Help command input\" width=\"750\" />\n\n\nResponse will include a list of available commands:\n\n<img src=\"/img/help2.webp\" alt=\"Help command output\" width=\"750\" />\n","docs/docs/commands/help_docs.md":"---\ntitle: \"Help Docs\"\nsidebar_position: 10\n---\n\n:::warning[`/help_docs` is currently disabled]\nAs of **v0.36.1**, the `/help_docs` command is temporarily disabled as a mitigation for a\ncredential-exposure vulnerability ([#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)):\nthe command accepted an untrusted runtime override of its git clone target, and the clone-URL\nhost validation only checked substring containment, so a host that merely *contained* the\nallowed host could receive the git provider token.\n\nThe command is not registered in `PRAgent`, so invoking it has no effect on any provider. The\npage below documents the command as it behaves once it is re-enabled.\n:::\n\n## Overview\n\nThe `help_docs` command can answer a free-text question based on a git documentation folder.\n\nIt can be invoked manually by commenting on any PR or Issue:\n\n```\n/help_docs \"...\"\n```\n\nOr configured to be triggered automatically when a [new issue is opened](../installation/github.md#run-as-a-github-action).\n\nThe command assumes by default that the documentation is located in the root of the repository, at `/docs` folder.\nHowever, this can be customized by setting the `docs_path` configuration option:\n\n```toml\n[pr_help_docs]\nrepo_url = \"\"                 # The repository to use as context\ndocs_path = \"docs\"            # The documentation folder\nrepo_default_branch = \"main\"  # The branch to use in case repo_url overwritten\n\n```\n\nSee more configuration options in the [Configuration options](#configuration-options) section.\n\n## Example usage\n\n[//]: # (#### Asking a question about this repository:)\n\n[//]: # (<img src=\"/img/help_docs_comment.png\" alt=\"help_docs on the documentation of this repository\" width=\"512\" />)\n\n**Asking a question about another repository**\n\n<img src=\"/img/help_docs_comment_explicit_git.png\" alt=\"help_docs on the documentation of another repository\" width=\"512\" />\n\n**Response**:\n\n<img src=\"/img/help_docs_response.png\" alt=\"help_docs response\" width=\"512\" />\n\n## Run automatically when a new issue is opened\n\nYou can configure PR-Agent to run `help_docs` automatically on any newly created issue.\nThis can be useful, for example, for providing immediate feedback to users who open issues with questions on open-source projects with extensive documentation.\n\nHere's how:\n\n1. Follow the steps depicted under [Run as a GitHub Action](../installation/github.md#run-as-a-github-action) to create a new workflow, such as:`.github/workflows/help_docs.yml`:\n\n2. Edit your yaml file to the following:\n\n   ```yaml\n   name: Run pr agent on every opened issue, respond to user comments on an issue\n\n   #When the action is triggered\n   on:\n     issues:\n       types: [opened] #New issue\n\n   # Read env. variables\n   env:\n     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n     GITHUB_API_URL: ${{ github.api_url }}\n     GIT_REPO_URL: ${{ github.event.repository.clone_url }}\n     ISSUE_URL: ${{ github.event.issue.html_url || github.event.comment.html_url }}\n     ISSUE_BODY: ${{ github.event.issue.body || github.event.comment.body }}\n     OPENAI_KEY: ${{ secrets.OPENAI_KEY }}\n\n   # The actual set of actions\n   jobs:\n     issue_agent:\n       runs-on: ubuntu-latest\n       if: ${{ github.event.sender.type != 'Bot' }} #Do not respond to bots\n\n       # Set required permissions\n       permissions:\n         contents: read    # For reading repository contents\n         issues: write     # For commenting on issues\n\n       steps:\n         - name: Run PR Agent on Issues\n           if: ${{ env.ISSUE_URL != '' }}\n           uses: docker://pragent/pr-agent:latest\n           with:\n             entrypoint: /bin/bash #Replace invoking cli.py directly with a shell\n             args: |\n               -c \"cd /app && \\\n               echo 'Running Issue Agent action step on ISSUE_URL=$ISSUE_URL' && \\\n               export config__git_provider='github' && \\\n                           export github__user_token=$GITHUB_TOKEN && \\\n               export github__base_url=$GITHUB_API_URL && \\\n               export openai__key=$OPENAI_KEY && \\\n               python -m pr_agent.cli --issue_url=$ISSUE_URL --pr_help_docs.repo_url=\"...\" --pr_help_docs.docs_path=\"...\" --pr_help_docs.openai_key=$OPENAI_KEY && \\\n               help_docs \"$ISSUE_BODY\"\n   ```\n\n3. Following completion of the remaining steps (such as adding secrets and relevant configurations, such as `repo_url` and `docs_path`) merge this change to your main branch.\n   When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is related to the documentation of the repository.\n\n---\n\n## Configuration options\n\nUnder the section `pr_help_docs`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'help docs' command:\n\n- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context.\n- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect.\n- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url).\n- `exclude_root_readme`:  Whether or not to exclude the root README file for querying the model.\n- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model.\n\n---\n","docs/docs/commands/index.md":"---\ntitle: \"Commands\"\nsidebar_position: 1\n---\n\nEach PR-Agent command has a dedicated page that explains its behavior and usage:\n\n| Command | Description |\n|------|-------------|\n| **[PR Description (`/describe`)](./describe.md)** | Generate a PR title, type, summary, code walkthrough and labels. |\n| **[PR Review (`/review`)](./review.md)** | Generate a PR review with feedback on possible issues, security concerns, tests and review effort. |\n| **[Code Suggestions (`/improve`)](./improve.mdx)** | Runs /review, whose findings can carry committable code fixes. |\n| **[Question Answering (`/ask ...`)](./ask.md)** | Answering free-text questions about the PR, or on specific code lines |\n| **[Add Documentation (`/add_docs`)](./add_docs.md)** | Generate documentation for code components that are missing it |\n| **[Generate Labels (`/generate_labels`)](./generate_labels.md)** | Generate custom labels for the PR based on the code changes |\n| **[Similar Issues (`/similar_issue`)](./similar_issues.md)** | Find similar issues in the repository based on the current issue |\n| **[Help (`/help`)](./help.md)** | Provides a list of all the available commands |\n| **[Help Docs (`/help_docs`)](./help_docs.md)** | **Temporarily disabled.** Answers questions about a Git repository’s documentation. |\n| **[Update Changelog (`/update_changelog`)](./update_changelog.md)** | Automatically updating the CHANGELOG.md file with the PR changes |\n\n## Usage examples\n\nEach command can be triggered in two ways:\n\n- **As a comment** — write the command (e.g. `/review`) as a comment, and PR-Agent replies. Most commands are commented on a PR; issue-scoped commands such as `similar_issue` are commented on an issue.\n- **From the [CLI](../usage-guide/automations_and_usage.md#local-repo-cli)** — run `python -m pr_agent.cli --pr_url=<PR_URL> <command>`. Issue-scoped commands take `--issue_url=<ISSUE_URL>` instead of `--pr_url`. The module form works only from an environment where the `pr_agent` package is importable (for example, the venv created by `uv sync`). If `pr-agent` is on your `PATH`, run it directly.\n\nBoth accept the same command arguments and [configuration overrides](../usage-guide/configuration_options.md).\n\n| Command                                     | Comment                          | CLI                                                             |\n|------------------------------------------|----------------------------------|----------------------------------------------------------------|\n| [Describe](./describe.md)                | `/describe`                      | `python -m pr_agent.cli --pr_url=<PR_URL> describe`             |\n| [Review](./review.md)                    | `/review`                        | `python -m pr_agent.cli --pr_url=<PR_URL> review`              |\n| [Improve](./improve.mdx)                  | `/improve`                       | `python -m pr_agent.cli --pr_url=<PR_URL> improve`             |\n| [Ask](./ask.md)                          | `/ask \"How does X work?\"`        | `python -m pr_agent.cli --pr_url=<PR_URL> ask \"How does X work?\"` |\n| [Add Docs](./add_docs.md)                | `/add_docs`                      | `python -m pr_agent.cli --pr_url=<PR_URL> add_docs`           |\n| [Generate Labels](./generate_labels.md)  | `/generate_labels`               | `python -m pr_agent.cli --pr_url=<PR_URL> generate_labels`     |\n| [Similar Issues](./similar_issues.md)    | `/similar_issue`                 | `python -m pr_agent.cli --issue_url=<ISSUE_URL> similar_issue` |\n| [Help](./help.md)                        | `/help`                          | `python -m pr_agent.cli --pr_url=<PR_URL> help`                |\n| [Update Changelog](./update_changelog.md)| `/update_changelog`              | `python -m pr_agent.cli --pr_url=<PR_URL> update_changelog`    |\n\n`/help_docs` is temporarily disabled (see [#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)) and is therefore omitted from the table above.\n\nFor screenshots, arguments, and a walkthrough of a typical use case, see the **Example usage** section on each command's page linked above.\n","docs/docs/commands/review.md":"---\ntitle: \"Review\"\nsidebar_position: 3\n---\n\n## Overview\n\nGenerate a PR review with feedback on possible issues, security concerns, tests and review effort.\n<br>\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or can be invoked manually by commenting on any PR:\n\n```\n/review\n```\n\nNote that the main purpose of the `review` command is to provide the **PR reviewer** with useful feedback and insights. Findings can also carry a fix, which GitHub and the other supported providers offer as a [committable suggestion](#fixes-and-committable-suggestions).\n\n(Read more about the different personas in the PR process and how PR-Agent aims to assist them in our [blog](https://www.qodo.ai/blog/understanding-the-challenges-and-pain-points-of-the-pull-request-cycle/))\n\n:::note\n`/improve` runs `/review` as of 0.51. See [Improve](./improve.mdx).\n:::\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/review` on any PR:\n\n<img src=\"/img/review_comment.png\" alt=\"review comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a review for the PR:\n\n<img src=\"/img/review3.png\" alt=\"review\" width=\"512\" />\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...\n```\n\nFrom the CLI, save the parsed review and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output review.json review\n```\n\nThe JSON file is written after the review completes. Place `--json-output` before `review` or `review_pr`.\nIts `coverage` object lists files omitted by the token budget or chunk-call limit, as well as\ndeletions represented only by filename notices (`files_not_reviewed`), and those whose patches\nwere clipped to fit the token budget (`files_partially_reviewed`).\nFiles excluded by file-type filtering are not included in these coverage lists.\nFilename notices are optional context, not reviewed source; filtered-file notices take priority\nwhen both kinds compete for the remaining request budget.\nFilename notices supplement source changes and do not trigger a model call on their own.\nA deletion-only PR without source changes to analyze is skipped, even when deletion patches are available.\nThe JSON includes the full lists even when the Markdown footer summarizes them.\nIt also includes `total_chunks` and `failed_chunks` for the final analysis plan, after fallback recovery.\nThese count analysis chunks, not model requests or retry attempts. A nonzero `failed_chunks` means that the\nreview is partial even if both file lists are empty; findings from successful chunks are retained.\n\n### Automatic triggering\n\nTo run the `review` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/review\",\n    ...\n]\n\n[pr_reviewer]\nextra_instructions = \"...\"\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_reviewer]` section contains the configurations for the `review` command you want to edit (if any).\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>persistent_comment</b></td>\n    <td>If set to true, the review comment will be persistent, meaning that every new review request will edit the previous one.</td>\n  </tr>\n  <tr>\n    <td><b>per_commit_review</b></td>\n    <td>If set to true, each commit of the PR is reviewed on its own diff and commit message, and one review comment is published per commit. See <a href=\"#reviewing-each-commit-separately\">Reviewing each commit separately</a>. It can't be turned on from a command argument, only from a configuration file or environment variable. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_commits_per_review</b></td>\n    <td>Maximum number of commits <code>per_commit_review</code> reviews one by one. When more commits than that are not reviewed yet, the whole PR is reviewed in one review instead, with a notice. It can't be set from a command argument or a per directory configuration file. Default is 0, no limit.</td>\n  </tr>\n  <tr>\n    <td><b>publish_review_failure_comment</b></td>\n    <td>\n      Set to false to suppress the \"Failed to review PR\" comment, including when a persistent review comment\n      cannot be updated. Successful review output and the command's failure status are unchanged. Default is true.\n      On GitHub, GitLab, and Azure DevOps, when the comment author can be verified, repeated failures update one\n      comment instead of adding another, and the next review that completes removes it. If the provider rejects\n      that edit or removal, the earlier comment stays and no other is added. A review in which some chunks failed\n      keeps it; files left out for the token budget do not. With\n      <code>gitlab.reply_to_trigger_comment</code>, each failure still replies to its own command, and a persistent\n      review comment that cannot be updated gets a comment of its own each time. Those are removed the same way,\n      and so are the failure comments of earlier versions.\n    </td>\n  </tr>\n  <tr>\n    <td><b>publish_error_details</b></td>\n    <td>\n      If set to true, a failed manual review comment includes a deterministic, sanitized failure reason for known\n      provider and runtime errors. The failure formatter does not call an AI model, never publishes raw exception\n      text, and falls back to a generic internal-error message. Default is false.\n    </td>\n  </tr>\n  <tr>\n    <td><b>review_heading</b></td>\n    <td>\n      Visible base heading for review comments, without the Markdown prefix or incremental label.\n      For example, <code>review_heading = \"Guideline Compliance Check\"</code> renders\n      <code>## Guideline Compliance Check 🔍</code> for a full review and\n      <code>## Incremental Guideline Compliance Check 🔍</code> for an incremental review.\n      On GitHub, GitLab, Azure DevOps, and Bitbucket Cloud, changing this value updates the same\n      persistent review comment; it does not create a separate review channel.\n    </td>\n  </tr>\n  <tr>\n    <td><b>persistent_finding_state</b></td>\n    <td>If set to true, PR-Agent persists structured review finding state across complete review runs, so findings can be resolved and reopened. Resolved findings retain the original Markdown formatting of their description. Incremental and partial reviews do not resolve absent findings. Default is true.</td>\n\n  </tr>\n  <tr>\n    <td><b>max_previous_findings_chars</b></td>\n        <td>Character budget for the findings stored by earlier reviews (requires <code>persistent_finding_state</code>). They are given to the model so it repeats a still-valid finding with its earlier wording instead of re-raising it reworded, and does not re-raise a resolved one unless the code reintroduces it. On GitHub and GitLab, an inline key-issue thread that someone other than PR-Agent resolved is given as dismissed, with its last reply, so the model does not re-raise it unless the code makes it worse. Set to 0 to disable. Default is 8000.\n      On Azure DevOps, verified PR-Agent inline key issues with <code>wontFix</code> or <code>byDesign</code>\n      are also passed as dismissed when the status differs from <code>azure_devops.default_comment_status</code>.\n      A matching default stays an ordinary prior finding. This infers a human decision; Azure does not identify\n      the status-changing actor here, and the current default may differ from the default used at creation.\n      PR-Agent resolves its posting identity through Azure DevOps. Set\n      <code>azure_devops_server.agent_identity</code> to override it or when automatic lookup is unavailable.\n    </td>\n  </tr>\n  <tr>\n  <td><b>final_update_message</b></td>\n  <td>When set to true, updating a persistent review comment during online commenting will automatically add a short comment with a link to the updated review in the pull request.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\".</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_coverage_footer</b></td>\n    <td>If set to true, the command will display a review coverage footer when source changes were not reviewed or were only partially reviewed, including deleted files represented by filename notices.\n    A review with this footer is published even when <code>publish_output_no_suggestions</code> is false.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_chunking</b></td>\n    <td>If set to true, and the token budget leaves files out of the review, the diff is split into chunks, each chunk is reviewed separately, and the per-chunk results are merged into one review. See <a href=\"#reviewing-a-pr-that-does-not-fit-in-one-call\">Reviewing a PR that does not fit in one call</a>. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_number_of_calls</b></td>\n    <td>Maximum number of chunk review calls, used only when <code>enable_large_pr_chunking</code> is true. Default is 3.</td>\n  </tr>\n  <tr>\n    <td><b>num_max_findings</b></td>\n    <td>Maximum number of returned findings. Default is 6.</td>\n  </tr>\n  <tr>\n    <td><b>inline_key_issues</b></td>\n    <td>If set to true (the default), each key issue is published as an inline comment where the provider supports verified inline-comment publication (GitHub, Bitbucket Cloud, Azure DevOps, GitLab, Gitea). A finding leaves the review summary when a matching comment exists or the provider accepts the new comment. Findings that cannot be anchored or published stay in the summary. A finding that carries a fix is published as a committable suggestion when `pr_code_suggestions.committable_code_suggestions` is true, the fix is at most ten lines and its `existing_code` matches the file at the finding's lines; otherwise the fix appears as a code block in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>min_finding_confidence</b></td>\n    <td>When above 0, the model reports an integer confidence from 0 to 10 for each finding, shown in its header in the review summary (inline comments do not show it). Findings below this value are dropped before publishing, and in a chunked review they are dropped before the <code>num_max_findings</code> cut, so they cannot displace a more confident finding. A run that dropped findings does not mark earlier findings as resolved. A missing or out-of-range confidence is treated as absent: the finding is kept. A threshold outside 0-10 is treated as 0 (disabled). Default is 0: keep all findings, and the model is not asked for a confidence.</td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Enable\\disable specific sub-sections</summary>\n\n<table>\n  <tr>\n    <td><b>require_score_review</b></td>\n    <td>If set to true, the command will add a section that scores the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_tests_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains tests.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_effort_to_review</b></td>\n    <td>If set to true, the command will add a section that estimates the effort needed to review the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_contribution_time_cost</b></td>\n    <td>If set to true, the command will add a section that estimates the time required for a senior developer to create and submit such changes.</td>\n  </tr>\n  <tr>\n    <td><b>require_can_be_split_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains several themes, and can be split into smaller PRs.</td>\n  </tr>\n  <tr>\n    <td><b>require_security_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains a possible security or vulnerability issue.</td>\n  </tr>\n    <tr>\n    <td><b>require_todo_scan</b></td>\n    <td>If set to true, the command will add a section that lists TODO comments found in the PR code changes.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_ticket_analysis_review</b></td>\n    <td>\n      If set to true and ticket context is available, the command adds a ticket-compliance section to the review comment\n      that checks whether the PR fulfills the ticket requirements. Supported sources include GitHub and GitLab issues,\n      linked Azure DevOps work items, Jira Cloud tickets, and Asana tasks.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_risk_assessment</b></td>\n    <td>If set to true, the command will add a section that rates the overall risk of the PR as low, medium or high.</td>\n  </tr>\n  <tr>\n    <td><b>require_merge_recommendation</b></td>\n    <td>If set to true, the command publishes a recommendation computed from deterministic checks. Only passing checks\n    allow no_concerns_found; needs_review means a check did not pass or could not be evaluated, and changes_required\n    reflects a model veto. The value reports the review's findings, not a guarantee about the code. See\n    <a href=\"#merge-recommendation\">Merge recommendation</a>.</td>\n  </tr>\n  <tr>\n    <td><b>publish_merge_recommendation_status</b></td>\n    <td>If set to true with <code>require_merge_recommendation</code>, publishes the verdict on the reviewed commit.\n    GitHub uses the <code>PR Agent - Review</code> check; GitLab uses a commit status. <code>needs_review</code>\n    publishes as neutral on GitHub and skipped on GitLab, so it does not block a merge; <code>changes_required</code>\n    publishes as a failure.</td>\n  </tr>\n  <tr>\n    <td><b>max_changed_lines</b></td>\n    <td>Host-only changed-line cap for <code>no_concerns_found</code>. A larger diff makes the recommendation\n    <code>needs_review</code> at best. The cap counts added and removed lines.</td>\n  </tr>\n  <tr>\n    <td><b>require_failure_modes</b></td>\n    <td>Off by default. If enabled, adds up to three concrete failure scenarios, each with what could break,\n    where, its trigger, how it could be detected, and whether a test or check in this PR covers it.\n    These scenarios guide human review; they do not gate merging or prove that the PR is safe.</td>\n  </tr>\n  <tr>\n    <td><b>require_artifact_findings</b></td>\n    <td>Off by default, and only active when a <a href=\"../../installation/github/#ci-artifact-context\">CI artifact</a> reaches /review.\n    If enabled, adds a \"CI artifact findings\" section with up to five neutral facts from the artifact: destroyed or replaced\n    resources, failed jobs (including allowed-to-fail ones), failed tests, vulnerabilities and notable warnings. Each fact\n    carries a short quote from the artifact; a quote that cannot be found in the artifact is marked, and credentials in\n    facts and quotes are redacted. The section reports what the artifact shows and leaves the decision to the reviewer.\n    Host configuration only: a repository settings file or comment cannot set it.</td>\n  </tr>\n  <tr>\n    <td><b>require_priority_files</b></td>\n    <td>If set to true, the command will add a section listing the files a human reviewer should inspect first.</td>\n  </tr>\n  <tr>\n    <td><b>structural_reach_input_file</b></td>\n    <td>Path to a JSON file with structural reach facts, written by a build-graph tool earlier in CI. When the file\n    exists, adds a deterministic change-risk row (Low, Moderate, High or Critical) with no model call. Relative to\n    <code>GITHUB_WORKSPACE</code> when that is set, otherwise to the working directory. Host configuration only: a\n    repository settings file or a comment cannot set it, because the file is read from the host. See\n    <a href=\"#structural-reach\">Structural reach</a>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_risk_checks</b></td>\n    <td>\n      If set to true, deterministically scans diff files and unfiltered PR files for sensitive paths, destructive SQL,\n      cache flushes, and authentication/secrets patterns without making model calls. Findings are rendered as a risk-checks\n      row in the review summary table. When no findings are detected, nothing is added. Default is true. See\n      <a href=\"#deterministic-risk-checks\">Deterministic risk checks</a>.\n    </td>\n  </tr>\n  <tr>\n    <td><b>sensitive_paths</b></td>\n    <td>\n      List of glob patterns identifying files considered sensitive (such as CI workflows, package manifests, lockfiles,\n      migrations, and infrastructure configurations). Changes to matching files flag a deterministic review risk finding.\n      Default includes common CI/CD, package manager, container, infrastructure, and migration paths.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_risky_shapes</b></td>\n    <td>\n      List of custom regular expression patterns to scan within added and removed lines in diff hunks. Patterns matching a\n      line flag a deterministic risk finding. Patterns longer than 200 characters, or with a quantified group that holds a\n      nested quantifier or an alternation (such as `(a+)+` or `(a|b)+`), are skipped with a logged warning. Host\n      configuration only: a repository settings file or comment cannot set it. Default is empty.\n    </td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Adding PR labels</summary>\n\nYou can enable\\disable the `review` command to add specific labels to the PR:\n\n<table>\n  <tr>\n    <td><b>enable_review_labels_security</b></td>\n    <td>If set to true, the command will publish a 'Possible security concern' label if it detects a security issue.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_labels_effort</b></td>\n    <td>If set to true, the command will publish a 'Review effort x/5' label (1–5 scale). Existing effort labels are kept when this option or effort estimation is disabled, or when the review has no valid replacement estimate. Security labels follow their own settings.</td>\n  </tr>\n</table>\n\n</details>\n\n## Usage Tips\n\n### General guidelines\n\n:::tip\n\nThe `review` command provides a collection of configurable feedbacks about a PR.\nIt is recommended to review the [Configuration options](#configuration-options) section, and choose the relevant options for your use case.\n\nSome of the features that are disabled by default are quite useful, and should be considered for enabling. For example:\n`require_score_review`, and more.\n\nOn the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases.\n:::\n\n### Automation\n\n:::tip\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened) for the `review` command is:\n```\npr_commands = [\"/review\", ...]\n```\nMeaning the `review` command will run automatically on every PR, without any additional configurations.\nEdit this field to enable/disable the command, or to change the configurations used.\n:::\n\n### Auto-generated PR labels by the Review Command\n\n:::tip\n\nThe `review` command can automatically add labels to your Pull Requests:\n\n- **`Possible security concern`**: This label is applied if the command detects a potential [security vulnerability](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L147) in the PR's code. This feedback is controlled by the 'enable_review_labels_security' flag (default is true).\n- **`Review effort 3/5`**: This label estimates the [effort](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L119) required to review the PR on a scale of 1 to 5. This feedback is controlled by the 'enable_review_labels_effort' flag (default is true).\n\nThe command matches these label names and earlier 1–5 effort formats case-insensitively.\nOther labels, such as `Review effort::high`, are left unchanged.\n\nTicket compliance is reported in the review comment, not as a PR label. It is controlled by\n`pr_reviewer.require_ticket_analysis_review` and requires available ticket context. The command does not add\nticket-compliance labels or a \"No ticket found\" label. See\n[Fetching ticket context](../core-abilities/fetching_ticket_context.md) for linking and authentication details.\n\n\n:::\n\n### Auto-blocking PRs from being merged based on the generated labels\n\n:::tip\n\nYou can configure a CI/CD Action to prevent merging PRs with specific labels. For example, implement a dedicated [GitHub Action](https://medium.com/sequra-tech/quick-tip-block-pull-request-merge-using-labels-6cc326936221).\n\nThis approach helps ensure PRs with potential security issues will not be merged without further review.\n\nSince AI may make mistakes or lack complete context, use this feature judiciously. For flexibility, users with appropriate permissions can remove generated labels when necessary. When a label is removed, this action will be automatically documented in the PR discussion, clearly indicating it was a deliberate override by an authorized user to allow the merge.\n:::\n\n### Extra instructions\n\n:::tip\n\nExtra instructions are important.\nThe `review` command can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.\n\nBe specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-command, and the relevant aspects of the PR that you want to emphasize.\n\nExamples of extra instructions:\n```\n[pr_reviewer]\nextra_instructions=\"\"\"\\\nIn the code feedback section, emphasize the following:\n- Does the code logic cover relevant edge cases?\n- Is the code logic clear and easy to understand?\n- Is the code logic efficient?\n...\n\"\"\"\n```\nUse triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.\n:::\n\n### Fixes and committable suggestions\n\nA finding can carry a fix: the model adds `existing_code` (the lines it wants to change, copied from the file) and\n`improved_code` (their replacement) when a concrete change resolves the issue. A finding without a clear fix has neither field.\n\nWhen `inline_key_issues` is on (the default) and the provider can verify inline comments (GitHub, Bitbucket Cloud, Azure DevOps,\nGitLab, Gitea), each finding is posted as an inline comment. If `pr_code_suggestions.committable_code_suggestions` is true and\n`existing_code` matches the file at the finding's lines, the fix is posted as a committable suggestion that you can apply from the\nPR page. Otherwise the fix is shown as a text block in the comment. A finding that is not posted inline (the provider cannot verify\ninline comments, `inline_key_issues` is off, or publishing failed) stays in the review summary, and its fix appears there as a text\nblock. Findings are capped by `pr_reviewer.num_max_findings` (6 by default), and chunked reviews keep the same cap.\n\nThree `pr_code_suggestions` settings are honoured: `committable_code_suggestions`, `extra_instructions`\n(added to the review's extra instructions when it differs from `pr_reviewer.extra_instructions`) and\n`suggestions_heading` (the base heading for code-suggestion comments). Other `pr_code_suggestions` keys have no effect.\n\n```\n/review --pr_code_suggestions.committable_code_suggestions=true\n```\n\n### Reviewing each commit separately\n\n:::tip\n\nProjects that keep one logical change per commit can ask for a review of every commit instead of the combined PR diff,\nin a configuration file:\n\n```\n[pr_reviewer]\nper_commit_review = true\n```\n\nEach commit is reviewed against its own parent, with its commit message in the prompt, and gets its own\nincremental review comment that names and links the commit. These comments are never the persistent\nreview comment, and they do not change the review labels.\n\nEach run reviews only the commits of the PR that were not reviewed yet, so `-i` is not needed in `pr_commands` or\n`push_commands`, and the first run reviews every commit. A commit is identified by a fingerprint of its own changes\n(file names and patch lines, without line numbers), and counts as reviewed once its review succeeds: the fingerprint\nis kept in a hidden marker in the commit's review comment or, when no comment is published for it, in one record\ncomment that is edited in place. A commit whose review failed is reviewed again on the next run; automatic runs stop\nretrying it after 3 failed attempts, while a manual `/review` always retries.\n`minimal_commits_for_incremental_review` and `minimal_minutes_for_incremental_review` do not apply to per commit\nreview, since each run picks the commits to review from these markers instead of the `-i` thresholds.\nThe commit list is read from the git provider on every run, so after a force push the review follows the rewritten\nhistory: a commit that was rebased without changing its own patch is not reviewed again, a commit that was amended or\nhad fixups folded into it (for example with `git rebase --autosquash`) is reviewed again, and fixup commits that no\nlonger exist are not reviewed. Markers count only in comments PR-Agent wrote; when the git provider cannot confirm\nthat, the whole PR is reviewed in one review with a notice instead.\nOn GitLab, a commit with a collapsed, too large or rename only file is reviewed again after a rebase, since its\nfingerprint includes its SHA.\n\nSet `publish_output_no_suggestions = false` in the `[pr_reviewer]` section\n(`--pr_reviewer.publish_output_no_suggestions=false` on the command line) to skip the comment of a commit with\nno findings and no coverage warning.\nWith `inline_key_issues = true`, each finding is published as an inline comment on the commit it was found in,\nanchored to that commit's own diff, so GitHub and GitLab show it as outdated once a later commit changes those lines.\nA finding that cannot be anchored there, for example because its line is outside that commit's diff or the provider\nrejects it, stays in that commit's review comment instead of being moved to a nearby line.\n\nMerge commits, empty commits and the root commit of a history have no diff of their own and are skipped. A commit that\nfails to review is reported like a failed review and does not stop the remaining commits. Every reviewed commit is a\nseparate model call, so the first review of a PR with many commits costs accordingly; later runs review only the new\ncommits.\nHosts that want to bound that cost can set `max_commits_per_review` (default 0, no limit): when more commits than that\nare not reviewed yet, the whole PR is reviewed in one review with a notice, and its commits count as reviewed.\nThe markers live only in PR-Agent's own comments, so if those comments are removed, the next run reviews every commit\nof the PR again, unless `max_commits_per_review` is set and the PR has more commits than that, in which case the whole\nPR gets one review.\nBoth settings belong to the operator, so a command argument such as `--pr_reviewer.per_commit_review=true` is\nrejected.\nEach commit's comment shows its own run details, while the `--json-output` file and the GitHub Action `review` output\ndescribe the last reviewed commit only.\n\nPer commit review is available on GitHub and GitLab. Other git providers fall back to a regular review of the whole PR.\nGitHub lists at most 250 commits of a PR, so a PR with more commits than that is also reviewed as a whole, with a\nnotice explaining why.\n:::\n\n### Reviewing a PR that does not fit in one call\n\n:::tip\n\nWhen a PR diff is larger than the model's token budget, the `review` command drops whole files\nuntil the diff fits, and lists the dropped files in the review coverage footer.\n\nSetting `enable_large_pr_chunking = true` changes what happens next: the diff is split into up\nto `max_number_of_calls` chunks, each chunk is reviewed on its own, and the answers are merged\ninto a single review that says how many chunks it was built from. Files that do not fit even\nafter chunking are still listed in the coverage footer. Every chunk is a separate model call,\nso a chunked review costs roughly `max_number_of_calls` times a normal one.\n\nWhile the chunks run, the temporary `Preparing review...` comment is rewritten in place with the\nnumber of chunks already analyzed, for example `Preparing review... analyzed 2 of 3 chunks`, plus\n`... 1 chunk failed` when a chunk gives up. The updates require\n`config.publish_output_progress` and a provider that supports both editing and removing a\ncomment, so plain-diff runs keep the frozen placeholder. Automatic commands publish no progress\ncomment, but while `github.publish_as_check_run` is enabled their in-progress check run shows the\nsame chunk count. The comment stays\ntemporary and is still removed before the merged review is published. A fallback model restores\nthe placeholder before it starts, so the visible count never moves backward.\n\nIf a chunk fails or returns malformed output, successful chunks are retained and fallback\nmodels retry only the pending work. Pending chunks can be split for a smaller model, within\nthe call limit; a larger model can also include previously omitted files. Chunks that still\nexceed the model's budget are not sent to it.\n\nWhen only one chunk is unfinished and all source files are already in the plan, a smaller\nfallback model can review fitting files beside oversized files. This requires a separate\nchunk for every file within the existing limit, including completed chunks. Oversized files\nremain pending for later models. If none of the recovered chunks succeeds, the original\ngrouping is restored for the next model. Non-retryable errors stop fallback even when another\nchunk exceeds the budget; this includes guardrail rejections only when reported as non-retryable.\n\nIf every fallback is exhausted, successful chunks are published as a partial review with a\nfailed-chunk coverage warning, even when `publish_output_no_suggestions = false`. Incomplete\nreviews cannot resolve absent persistent findings. If no chunk succeeds, the review fails.\nWith `config.propagate_command_errors = true`, an exhausted fallback chain still signals failure\nto the caller after publishing the partial review and removing the progress comment.\nOptional run details list all models that contributed to the merged review.\n\nEach chunk answers the same questions about a different part of the PR, so the answers are\nmerged field by field:\n\n| Field | Merge rule |\n| --- | --- |\n| `key_issues_to_review` | Union over the chunks, dropping findings that repeat the same file, header and text |\n| `security_concerns` | Every chunk that reported a concern is kept; \"No\" only when every chunk said no |\n| `todo_sections`, `review_priority_files`, `can_be_split` | Union, de-duplicated, in chunk order (`can_be_split` keeps at most 3 sub-PRs) |\n| `relevant_tests` | Yes if any chunk found tests |\n| `score` | The lowest score any chunk gave |\n| `risk_level`, `merge_recommendation` | The most conservative value any chunk gave |\n| `failure_modes` | Concatenate valid cases in chunk order, dropping exact duplicates and keeping at most three |\n| `estimated_effort_to_review_[1-5]` | The highest value any chunk gave |\n| `contribution_time_cost_estimate` | The sum over the chunks, per case |\n| `ticket_compliance_check` | One entry per ticket, with its bullet lists unioned across chunks |\n\nWhen `require_todo_scan` is enabled, the TODO union includes both located findings and prose\nsummaries. Prose without a file location is shown as text without a source link.\n\nThe merged verdict is deliberately never less alarming than the worst chunk: a clean chunk\ncannot raise a score, clear a security concern, or soften a risk level set by another chunk.\n:::\n\n### Structural reach\n\n:::tip\n\nWhen `structural_reach_input_file` points at a file that exists, the review gets one row at the top that rates how\nfar a defect in the change could spread. The row is computed from that file, not by the model, so the same input\nalways gets the same rating.\n\n```\n🔗 Structural reach: Critical\nReach: 40 projects, cross-domain\nDependents: billing-api, payments-worker, web-app, admin-app, reports (+35 more)\nSensitivity: payments\nRating driven by sensitive domain (escalates regardless of size)\n```\n\n**Rating.** Two facts from the input file set the band:\n\n- **Reach** is the number of downstream projects a defect in the change can break. Only a build-graph tool knows\n  it.\n- **Sensitivity** flags changes to areas the repository marks as high-criticality, such as authentication,\n  payments or secrets. A one-line auth change outranks a wide styling sweep.\n\nReach is narrow up to 3 projects, moderate up to 25 and wide above that. The band then follows these rules:\n\n| Condition | Band |\n| --- | --- |\n| Wide reach | At least Moderate |\n| Cross-domain change | At least Moderate |\n| Any sensitive domain | At least High |\n| Sensitive domain with wide reach | Critical |\n| Anything else | Low |\n\nThe row lists each factor and names the one that set the band. It also lists the first five names in\n`dependents`, in the order the producer wrote them.\n\nThe reach bands are defined for projects only. When `reach_unit` is `modules` or `files`, the row shows the count\nand the dependents without a band, because no threshold separates a change to a shared utility from a real spread.\nA cross-domain or sensitive change still gets a band from the rules above. The Reach line still shows the\nnumber, but it does not affect the band.\n\nChange size is not part of the rating, because\n`estimated_effort_to_review_[1-5]` already reflects it. That row and `require_risk_assessment` are the model's\njudgement; this row adds the structural and sensitivity facts the model cannot see in the diff.\n\n**Input file.** Any build-graph tool (Nx, Bazel, Gradle, Turborepo, and so on) can write the reach facts in an\nearlier CI step, so pr-agent needs no adapter per tool. Point `structural_reach_input_file` at the file in host\nconfiguration, for example the `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE` environment variable. Every field is\noptional:\n\n```json\n{\n  \"version\": 1,\n  \"reach\": 12,\n  \"reach_unit\": \"projects\",\n  \"dependents\": [\"billing-api\", \"web-app\"],\n  \"domains\": [\"billing\", \"web\"],\n  \"cross_domain\": true,\n  \"sensitive_domains\": [\"billing\"]\n}\n```\n\n| Field | Type | Meaning |\n| --- | --- | --- |\n| `version` | integer | Schema version. Only `1` is accepted. |\n| `reach` | integer, 0 or more | Number of units affected by the change, including transitive dependents. Defaults to the length of `dependents`. |\n| `reach_unit` | string | What `reach` counts: `projects` (the default), `modules` or `files`. Only `projects` gets a reach band. |\n| `dependents` | list of strings | Names of the affected units, most relevant first. |\n| `domains` | list of strings | Distinct domains or areas the affected projects belong to. |\n| `cross_domain` | boolean | Whether the change spans more than one domain. |\n| `sensitive_domains` | list of strings | Affected domains the repository treats as sensitive. |\n\nUnknown fields are ignored. Strings are limited to 200 characters and the file to 1 MB.\n\n**Trust.** The file is read from inside `GITHUB_WORKSPACE` (or the working directory), so in the GitHub Action a\ncheckout of the pull request could already contain a file at that path, written by the pull request's author.\nGenerate the file in the same job, right before the review step, and delete any existing copy first. Take the\nproject tags and graph configuration the producer reads from the base commit, not from the pull request. Treat the\nband as advisory context for reviewers, never as a merge gate.\n\n**Example producer: Nx.** `nx show projects --affected` lists every project the change affects, including\ntransitive dependents. This step writes them as `dependents`, and lists affected projects tagged `sensitive` as\n`sensitive_domains`:\n\n```bash\naffected() { npx nx show projects --affected --base=\"$BASE_SHA\" --head=\"$HEAD_SHA\" --json \"$@\"; }\naffected | jq --argjson sensitive \"$(affected -p 'tag:sensitive')\" \\\n  '{version: 1, reach_unit: \"projects\", dependents: ., sensitive_domains: $sensitive}' > structural-reach.json\n```\n\nThen set `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE=structural-reach.json` for the review step. Another tool\nneeds only a query that lists the affected projects or packages.\n\n**Example producer: tree-sitter.** For a repository without a build-graph tool,\n`scripts/structural_reach_producer.py` builds a reverse-import graph of the Python, TypeScript and JavaScript\nfiles at the base commit and follows importers from the changed files. Test files are left out of reach and\ndomains, because counting them makes most changes to a shared module read wide. It writes `reach_unit` as\n`modules` (directories) by default, so the row shows the count and the first dependents without a band. Run it as\na CI step before the review; it is not a pr-agent dependency:\n\n```bash\npip install \"tree-sitter-language-pack==1.22.1\"\npython scripts/structural_reach_producer.py --repo . --base \"$BASE_SHA\" --head \"$HEAD_SHA\" \\\n  --unit module --out structural-reach.json\n```\n\nOn this repository, the change merged in pull request 4420 gives:\n\n```\n🔗 Structural reach\nReach: 9 modules\nDependents: pr_agent/git_providers, pr_agent/commands, pr_agent/servers, pr_agent/algo, pr_agent/mosaico (+4 more)\n```\n\n`dependents` is ordered by the number of affected files in each unit. The graph does not see imports built at\nrun time, files loaded by name such as settings, or dependencies declared only in a manifest, such as a shared\n`tsconfig` package used through `extends`. In a monorepo with Nx, Turborepo or Bazel, use that tool instead.\n\n**Failure handling.** The row never blocks a review. If the setting is empty, the input file is missing or does\nnot match the schema, or anything fails while computing the row, the review is published without it.\n\n**Sources.**\n\n- Beyer, B. et al. *Site Reliability Engineering* (Google, 2016), and the AWS Well-Architected Framework: blast\n  radius as the scope of impact of a change or failure.\n- OWASP guidance on sensitive functionality: authentication, session management, cryptography and payments.\n\n:::\n\n### Deterministic risk checks\n\n:::tip\n\nWhen `enable_risk_checks` is enabled (the default), PR-Agent scans changed files and diff hunks for known risk patterns\nwithout making model calls. Incremental and per-commit reviews scope unfiltered path checks to the active incremental\nfile set unless `require_merge_recommendation` is enabled. Findings are rendered as a dedicated row in the review table:\n\n```\n⚠️ Risk checks: 3 finding(s) detected\nSensitive paths (1): .github/workflows/deploy.yml\nRisky shapes (1): `Privilege revocation` in db/migrations/002_revoke.sql\nDeleted files (1): old_auth.py\n```\n\nWhen no findings are detected, the row is omitted completely so clean reviews stay uncluttered.\n\n**Checks performed.**\n\n- **Sensitive paths**: Flags changes to files matching glob patterns in `sensitive_paths`. By default, this covers\n  CI/CD pipelines and local composite actions, package manager manifests and lockfiles, Dockerfiles, Terraform and\n  infrastructure configs, and database migrations.\n- **Risky change shapes**: Scans added and removed lines in diff hunks for destructive SQL (`DROP TABLE`, `ALTER ... RENAME`,\n  `REVOKE ... ON/FROM`, `TRUNCATE`), authentication and secrets keywords, cache invalidations, and any custom patterns\n  configured in `extra_risky_shapes`. Removed lines are also checked for removed function signatures (Python, JS/TS, Go,\n  Rust) and, in `.toml`, `.yaml`, `.yml`, `.json`, `.ini` and `.env` files, removed configuration defaults. Changes to\n  prompt files (`*prompt*.toml`, `*prompt*.yaml`, or files under a `*prompts*/` directory) are flagged as well.\n- **Deleted files**: Flags removed files.\n\n**Custom patterns.** Additional regular expressions can be configured via `extra_risky_shapes`. Because regex execution\nhas security implications, `extra_risky_shapes` must be configured through host configuration (such as environment\nvariables or host settings) and cannot be overridden by repository `.pr_agent.toml` files. Each search with a custom\npattern has a 50 ms limit, and each custom pattern has 1 s in total per review. If a pattern exceeds either one,\nPR-Agent logs a warning and skips that pattern for the rest of the review.\n\n:::\n\n### Merge recommendation\n\nWhen `require_merge_recommendation` is enabled, PR-Agent computes the published verdict from deterministic checks.\nThe model can only make the verdict more cautious: it can lower a clean verdict, or raise `needs_review` to\n`changes_required`, but it cannot override a failed deterministic check.\n\n**Checks and sources**\n\n- `CI on reviewed head` (deterministic): requires passing CI for the reviewed head. Unavailable CI status fails\n  closed.\n- `Head is current with its base` (deterministic): requires the reviewed head to be current with its base for\n  reviewed files. Unavailable staleness status fails closed.\n- `Human authors` (deterministic): requires all authors to be human. Bot/unlinked or unavailable author data fails\n  closed.\n- `No sensitive paths or risky changes` (deterministic): requires no findings from deterministic risk checks\n  (`sensitive_paths`, risky diff shapes, deleted files). Unavailable risk-check data fails closed.\n- `Changed lines within cap` (deterministic): requires total added/removed lines within\n  `pr_reviewer.max_changed_lines`. Unavailable line counts fail closed.\n- `Model merge recommendation` (model, veto only): if the model returns `needs_review` or `changes_required`, the\n  verdict cannot be `no_concerns_found`.\n- `Model risk level` (model, veto only): if the model returns `medium` or `high` risk, the verdict cannot be\n  `no_concerns_found`.\n\n`no_concerns_found` requires all deterministic checks to pass and no model veto. If any deterministic check cannot be\nevaluated, the verdict fails closed. The review includes each check and its result.\n\n**Configuration and status publishing**\n\n- `pr_reviewer.sensitive_paths`: glob patterns for files treated as sensitive by deterministic risk checks.\n  Host-only.\n- `pr_reviewer.max_changed_lines`: host-only changed-line cap for `no_concerns_found`. Counts added and removed\n  lines.\n- `pr_reviewer.extra_risky_shapes`: host-only custom regex patterns scanned in added and removed diff lines.\n- `publish_merge_recommendation_status`: publishes the verdict for the exact reviewed head SHA. GitHub uses the\n  `PR Agent - Review` check run; GitLab uses a commit status.\n\n`needs_review` publishes as neutral on GitHub and skipped on GitLab, so it does not block merges by itself.\n`changes_required` publishes as failure/failed and blocks merges when that status is required. To require it, add\n`PR Agent - Review` as a required status/check in your GitHub branch protection rule or ruleset, or require the\nPR-Agent commit status in your GitLab project's merge rules. A new commit has no PR-Agent verdict status until it is\nreviewed.\n\nThe verdict scans the complete PR diff, including ignored paths and files already reviewed by an incremental review.\nIf the full diff or a trustworthy CI timestamp is unavailable, the verdict cannot be `no_concerns_found`.\n\n### Gated auto-approval\n\n:::warning\n\nOff by default and host-only (`config.enable_auto_approval`). An approval counts toward a protected branch's\nrequired reviews, so enable it only where an automated approval of small, clean changes is acceptable. PR-Agent\nnever merges.\n\n:::\n\nWhen the host sets `config.enable_auto_approval` (for example `CONFIG__ENABLE_AUTO_APPROVAL=true`), `/review` on\nGitHub and GitLab approves the exact commit it reviewed only when all of these hold:\n\n- the computed merge recommendation is `no_concerns_found`;\n- the model returned both a merge recommendation and a risk level, so `require_merge_recommendation` and\n  `require_risk_assessment` must be enabled;\n- the review covered the whole pull request: not an incremental review, no file left out by the ignore rules or the\n  file-type filter, no file left out or cut short to fit the model's context, and no part of the diff failed;\n- the review completed and its finding state could be updated.\n\nEach `/review` run withdraws the approval PR-Agent gave when it starts, and approves again only when it ends with all\nof these holding, so a run that fails or finds a concern leaves no approval behind. On a push, the GitHub App, the\nGitHub Action, and the GitLab webhook dismiss it before any other event filter runs. A change of base branch also\ndismisses it, and on GitHub so does a reopen. On GitHub, PR-Agent only dismisses approvals it gave automatically;\nmanual approvals from the same account are left alone. On GitLab, an approval belongs to the token's account, so use\nan account reserved for PR-Agent. With `publish_output` off, nothing is approved or dismissed.\n\n`enable_auto_approval` is host-only: a repository `.pr_agent.toml` or a comment argument cannot turn it on.\n\n**Required repository settings.**\n\n- On GitHub, turn on \"Dismiss stale pull request approvals when new commits are pushed\" in the branch protection\n  rule or ruleset. PR-Agent can miss a push (a failed webhook delivery, a polling deployment, or a workflow that\n  does not listen to `synchronize`), and GitHub only removes a stale approval itself when this is on.\n- On GitLab, enable merge request approvals for the project and keep approvals reset on push in the project's\n  approval settings, so a missed webhook does not leave a stale approval behind.\n- For the GitHub Action, allow \"GitHub Actions to create and approve pull requests\" in the repository's Actions\n  settings. Pull requests from forks get a read-only token, so they cannot be approved.\n- If the rule restricts who can dismiss reviews, include PR-Agent's account; otherwise it cannot withdraw its own\n  approval, and only logs an error.\n\nGitHub does not let an account approve a pull request it opened. GitLab can also reject approval by the merge\nrequest author according to the project's approval settings. Other git providers are not supported yet.\n\n**Suggested rollout**\n\n1. Enable `require_merge_recommendation`, `require_risk_assessment`, and `publish_merge_recommendation_status` on\n   the host. Tune `sensitive_paths` and `max_changed_lines` as needed.\n2. Require the published verdict status in branch protection or merge rules, and verify verdicts on representative\n   PRs.\n3. Enable `config.enable_auto_approval` for a limited scope first (or a pilot environment), confirm approvals are\n   dismissed on push/base changes, and monitor outcomes.\n4. Expand gradually once the behavior matches your repository's review policy. Keep PR-Agent's account permissions\n   and stale-approval settings in place.\n","docs/docs/commands/similar_issues.md":"---\ntitle: \"Similar Issues\"\nsidebar_position: 8\n---\n\n## Overview\n\n> **Note**: `/similar_issue` is an **experimental** feature. It works only on GitHub, carries a disproportionately large share of the project's dependency and configuration surface for a single-provider command, and is therefore excluded from the v1 stability guarantees. No backend is tested against its real driver.\n\nThe similar issue command retrieves the most similar issues to the current issue.\nIt is an issue-scoped command: comment `/similar_issue` on the issue (served by the GitHub Action; the GitHub App webhook only dispatches comments on pull requests), or run it from the CLI with `--issue_url`:\n\n```\n/similar_issue\n```\n\n## Example usage\n\n<img src=\"/img/similar_issue_original_issue.png\" alt=\"similar_issue_original_issue\" width=\"768\" />\n\n<img src=\"/img/similar_issue_comment.png\" alt=\"similar_issue_comment\" width=\"768\" />\n\n<img src=\"/img/similar_issue.png\" alt=\"similar_issue\" width=\"768\" />\n\n### Indexing and re-runs\n\nTo perform retrieval, the `similar_issue` command indexes the repository's issues in the configured vector database. On every backend:\n\n- The **first run** indexes up to `max_issues_to_scan` issues (default `500`).\n- **Later runs** check the newest `max_issues_to_scan` issues and index any that are missing, so previously-indexed issues are not re-embedded.\n- `force_update_dataset = true` makes every run re-index up to `max_issues_to_scan` issues: LanceDB replaces the repository's rows, Pinecone and Qdrant upsert over the existing rows.\n- `skip_comments = true` skips issue comments and embeds only the issue title and body.\n\nEmbedding inputs are limited to **8,191 tokens** (one token below the model's\n8,192-token context). Issues or comments exceeding this limit are skipped during\nindexing; an oversized issue also excludes its comments. Long similarity queries\nare truncated to their first 8,191 tokens, so later content does not influence\nthe results.\n\nThese keys live under the `[pr_similar_issue]` section. Each backend section below describes its own configuration and re-run behaviour.\n\nIf the embedding service rejects the credentials (HTTP 401) or denies access (HTTP 403), indexing stops immediately on every vector database backend.\nCorrect the embedding API key or access permissions before running the command again; other embedding errors retain the existing batch and per-item fallback behavior.\n\n### Selecting a Vector Database\n\nConfigure your preferred database by setting the `vectordb` parameter under `[pr_similar_issue]` in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"lancedb\"  # options: \"pinecone\", \"lancedb\", \"qdrant\"\n```\n\n#### Available Options\n\nChoose from the following Vector Databases:\n\n1. LanceDB\n2. Pinecone\n3. Qdrant\n\n#### LanceDB Configuration\n\nLanceDB is the default backend (`vectordb = \"lancedb\"`) and needs no external credentials. The index is stored in a local directory given by the `[lancedb] uri` key (default `./lancedb`). A single table (`codium-ai-pr-agent-issues`) is shared by every repository indexed into the same directory; rows are tagged with the repository name in the metadata.\n\nAs described in [Indexing and re-runs](#indexing-and-re-runs), the first run creates the table and indexes up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` replaces the repository's rows with a fresh index of up to `max_issues_to_scan` issues.\n\n#### Pinecone Configuration\n\nTo use Pinecone with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[pinecone]\napi_key = \"...\"\ncloud = \"aws\"\nregion = \"us-east-1\"\n```\n\nThe `cloud` value must be one of `aws`, `gcp` or `azure`, and `region` must be an\navailability region offered by that cloud. These parameters can be obtained by\nregistering to [Pinecone](https://app.pinecone.io/?sessionType=signup/). Note that the\ncommand uses Pinecone's serverless index API; the former `environment` setting from the\ngcp-starter pod tier is no longer supported.\n\n`cloud` and `region` are only used when the index does not exist yet and needs to be\ncreated. An existing index is opened by name and is never recreated, so moving an\nexisting deployment to the new configuration does not lose the stored vectors.\n\nOn re-runs, the first run creates the index and upserts up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[No backend is tested against its real driver]\n\nThe `similar-issue` dependency group is not installed in CI, so the pinecone tests run\nagainst a faked module, the qdrant tests never construct a client, and the lancedb tests\nrun against a fake table.\n:::\n\n:::note[Default vector database]\n\n`vectordb` defaults to `lancedb`, which works with no external credentials. To use\nqdrant or pinecone, set `vectordb = \"qdrant\"` or `vectordb = \"pinecone\"` under\n`[pr_similar_issue]`.\n:::\n\n#### Qdrant Configuration\n\nTo use Qdrant with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[qdrant]\nurl = \"https://YOUR-QDRANT-URL\" # e.g., https://xxxxxxxx-xxxxxxxx.eu-central-1-0.aws.cloud.qdrant.io\napi_key = \"...\"\n```\n\nThen select Qdrant in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"qdrant\"\n```\n\nYou can get a free managed Qdrant instance from [Qdrant Cloud](https://cloud.qdrant.io/).\n\n`api_key` must be present even when the server does not enforce authentication (an empty string is accepted): the command reads both `url` and `api_key` and raises when either is absent. A re-index uploads the records from up to `max_issues_to_scan` issues.\n\nQdrant points are stored in a collection named `codium-ai-pr-agent-issues-v2`, derived by appending a `-v2` suffix to the shared index name (`codium-ai-pr-agent-issues`). The suffix is an implementation detail of the Qdrant backend only; pinecone and lancedb use the unsuffixed name.\n\nOn re-runs, the first run creates the collection and stores up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[Upgrading an index created before the point-id fix]\n\nEarlier versions derived the point id from the issue id alone, so the same issue number collided\nacross repositories. The id is now seeded with the repository name, which means points written by\nan earlier version are never rewritten or deleted - they still carry a matching `metadata.repo`\npayload, so they stay queryable and can surface alongside their replacements.\n\nThe `-v2` collection suffix sidesteps this: the new index is written to\n`codium-ai-pr-agent-issues-v2`, leaving the pre-existing `codium-ai-pr-agent-issues` collection\nuntouched. Nothing is deleted, and the first run after the upgrade re-indexes the repository into\nthe new collection. Once you are satisfied with the results, you can delete the old\n`codium-ai-pr-agent-issues` collection from Qdrant by hand to reclaim the storage.\n:::\n\n## How to use\n\n- Install the command's extra dependencies (vector databases and datasets), which a bare `uv sync` does not include:\n`uv sync --group similar-issue`\n\n- To invoke the 'similar issue' command from **CLI**, run:\n`uv run pr-agent --issue_url=... similar_issue`\n\n- To invoke the 'similar' issue command via online usage, [comment](https://github.com/the-pr-agent/pr-agent/issues/178#issuecomment-1716934893) on an issue:\n`/similar_issue`\n\n- To run automatically when an issue is opened, create a GitHub Actions workflow for the `issues: opened` event that invokes the CLI with that issue's URL. Adding `/similar_issue` to `github_app.pr_commands` does not handle issue-opened events.\n\n  With the default LanceDB backend, restore the configured `[lancedb] uri` directory (default `./lancedb`, relative to the CLI working directory) before running the CLI and save the updated directory afterward, or use a persistent remote Qdrant or Pinecone backend. On ephemeral hosted runners, an unpreserved local index is rebuilt on each run, repeating embedding costs for up to `max_issues_to_scan` issues (default `500`) and leaving previously indexed issues outside that batch unavailable for retrieval.\n","docs/docs/commands/update_changelog.md":"---\ntitle: \"Update Changelog\"\nsidebar_position: 11\n---\n\n## Overview\n\nThe `update_changelog` command automatically updates a Markdown changelog with the PR changes.\nIt uses `CHANGELOG.md` at the repository root by default; `pr_update_changelog.changelog_path` selects a different file.\nIt can be invoked manually by commenting on any PR:\n\n```\n/update_changelog\n```\n\nEmpty or fence-only model responses are retried with the configured fallback models. If no model returns usable content, the command stops without writing to the changelog or publishing an update comment.\n\nHost operators can also opt in to forwarding the newly generated entry to the existing\n[push outputs](../usage-guide/push_outputs.md) destinations by selecting `update_changelog` in\n`push_outputs.commands`. These notifications contain a draft, not confirmation of a repository write.\n\n## Example usage\n\n<img src=\"/img/update_changelog_comment.png\" alt=\"update_changelog_comment\" width=\"768\" />\n\n<img src=\"/img/update_changelog.png\" alt=\"update_changelog\" width=\"768\" />\n\n## Configuration options\n\nUnder the section `pr_update_changelog`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'update changelog' command:\n\n- `changelog_path`: repository-relative path to the Markdown changelog, such as `HISTORY.md` or `docs/CHANGELOG.md`. Default is `CHANGELOG.md`. Set it in the root `.pr_agent.toml` or host configuration; comment/CLI arguments and per-directory settings cannot override it.\n- `push_changelog_changes`: whether to push the changes to the selected changelog, or just publish them as a comment. Default is false (publish as comment). Before pushing, the command requires a confirmed read of that file; a confirmed missing file is treated as empty, while other read failures skip the repository write, attempt to publish a not-pushed fallback comment, and surface the original error. If the repository write itself fails, the command makes one best-effort attempt to publish the generated changelog as a fallback and surfaces the original write error. Because a transport failure may happen after a completed remote write, this fallback reports the repository update as unconfirmed rather than promising it was not pushed.\n- `extra_instructions`: Optional extra instructions to the command. For example: \"Use the following structure: ...\"\n- `add_pr_link`: whether the model should try to add a link to the PR in the changelog. Default is true.\n- `skip_ci_on_push`: whether the commit message (when `push_changelog_changes` is true) will include the term \"[skip ci]\", preventing CI tests to be triggered on the changelog commit. Default is true.\n\n### Custom changelog location\n\nFor a changelog stored under `docs/`, add this to the repository's root `.pr_agent.toml`:\n\n```toml\n[pr_update_changelog]\nchangelog_path = \"docs/CHANGELOG.md\"\n```\n\nThen invoke `/update_changelog` as usual. The command reads that file to follow its existing structure and,\nwhen `push_changelog_changes` is enabled, prepends the new entry to the same file on the PR branch.\nComment-only output also uses the selected file as context and names it in the commit instructions.\n\nThe path must be a non-empty repository-relative file path using `/` separators, without empty,\n`.` or `..` components, Windows drive prefixes, backslashes, or control characters. Invalid values stop\nthe command before reading repository content. Spaces and Unicode names are accepted and kept exactly as written. The command updates\none Markdown changelog per command; it does not discover files, expand globs, or select a file per package.\nThe filename need not end in `.md`, but the generated content remains Markdown.\n"},"files":{"AGENTS.md":"# Repository Guidelines\n\nThis file is the shared source of repository guidance for coding agents. Tool-specific instruction files should import it instead of repeating repository-wide rules.\n\n## Dos and Don’ts\n\n- **Do** match the interpreter requirement declared in `pyproject.toml` (Python ≥ 3.12) and install dependencies with `uv sync` (runtime + dev, from `uv.lock`) before running tools.\n- **Do** run tests with `PYTHONPATH=.` set to keep imports functional (for example `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`).\n- **Do** adjust configuration through `.pr_agent.toml` or files under `pr_agent/settings/` instead of hard-coding values.\n- **Don’t** commit secrets or access tokens; rely on environment variables as shown in the health and e2e tests.\n- **Don’t** reformat or reorder files globally; match existing 120-character lines, import ordering, and docstring style.\n- **Don’t** delete or rename configuration, prompt, or workflow files without maintainer approval.\n\n## Project Structure and Module Organization\n\nPR-Agent automates AI-assisted reviews for pull requests across multiple git providers.\n\n- `pr_agent/agent/` orchestrates commands (`review`, `describe`, `improve`, etc.) via `pr_agent/agent/pr_agent.py`.\n- `pr_agent/commands/` implements individual capabilities such as reviewers, code suggestions, docs updates, and label generation.\n- `pr_agent/algo/` contains shared algorithms, model handlers, prompt/token handling, types, and utilities.\n- `pr_agent/git_providers/` handles integrations with GitHub, GitLab, Bitbucket (cloud and server), Azure DevOps, Gitea, Gerrit, CodeCommit, local checkouts, and plain diffs; `pr_agent/identity_providers/` handles identity and `pr_agent/secret_providers/` handles secrets.\n- `pr_agent/settings/` stores Dynaconf defaults (prompts, configuration templates, ignore lists) respected at runtime; `.pr_agent.toml` overrides repository-level behavior.\n- `pr_agent/servers/` contains webhook and service entrypoints.\n- `tests/unittest/`, `tests/e2e_tests/`, and `tests/health_test/` contain pytest-based unit, end-to-end, and smoke checks.\n- `docs/` holds the Docusaurus site (`docs/docusaurus.config.js` and `docs/sidebars.js` plus content under `docs/docs/`); theme overrides live in `docs/src/` and static assets in `docs/static/`.\n- `.github/workflows/` defines CI pipelines for unit tests, coverage, docs deployment, pre-commit, and PR-agent self-review.\n- `docker/` provides build targets for services (`github_app`, `gitlab_webhook`, etc.) and the `test` stage used in CI; the root `Dockerfile.github_action_dockerhub` only wraps the published `github_action` image for `action.yaml`.\n\n## Architecture and Request Flow\n\nPR-Agent is a CLI/server that runs AI-powered commands (`/review`, `/describe`, `/improve`, `/ask`, etc.) against pull requests on supported git providers or local input. The main dispatch flow is `pr_agent/agent/pr_agent.py` → `command2class` → a command class under `pr_agent/commands/`.\n\nA command generally obtains the appropriate git provider, gathers pull-request context, prepares prompt variables and templates, calls the configured model handler, and publishes or stores the result through the provider.\n\n### Prompt Building\n\nPrompt-driven commands generally construct a `self.vars` dictionary and pass it with the system/user prompt strings to `TokenHandler`. Prompt rendering uses Jinja2 with `StrictUndefined`, so variables referenced by a template should be present in the corresponding vars dictionary; define optional values explicitly and guard optional sections with Jinja conditionals.\n\nSystem/user prompt strings live as TOML files under `pr_agent/settings/` and are loaded into `global_settings` by `pr_agent/config_loader.py`. Command and prompt names normally correspond, for example:\n\n- `pr_reviewer.py` ↔ `pr_reviewer_prompts.toml`\n- `pr_description.py` ↔ `pr_description_prompts.toml`\n- `pr_questions.py` ↔ `pr_questions_prompts.toml`\n\nNew prompt files must also be registered in the `settings_files=[...]` list in `pr_agent/config_loader.py` or they will not be loaded into `global_settings`.\n\n### Settings and Runtime Configuration\n\nUse `get_settings()` from `pr_agent/config_loader.py` as the shared settings accessor. It returns the request-scoped Dynaconf object from `starlette_context` when one is present, otherwise the module-level `global_settings` object.\n\nDefaults live in `pr_agent/settings/configuration.toml`. Per-repository overrides come from the repository's `.pr_agent.toml` and are applied by `pr_agent/git_providers/utils.py::apply_repo_settings` before command dispatch. When introducing a configuration section, add its defaults and comments to `configuration.toml` and keep related prompt/config changes synchronized.\n\nWhen a key's detail belongs in a docs page, keep its `configuration.toml` comment to one line under 160 characters that states what the key does and its allowed values, then point to that page.\n\n`docs/docs/usage-guide/configuration_reference.md` is generated from `configuration.toml` by `python scripts/generate_config_reference.py [output_path]` (run from the repository root), and its header says not to edit it by hand. Write the output to a temporary path and diff it against the page before replacing anything. `tests/unittest/test_config_reference.py` checks that the page matches the generator output, lists exactly the active keys, and asserts a hard-coded active-key count, so update that count when adding or removing keys.\n\nRepository overrides are filtered by `pr_agent/config_security.py`; host-only keys must be supplied through host configuration. Configuration file merges preserve other fields in a section but replace overlapping list/dict values rather than appending or deep-merging; environment variables take precedence.\n\nSensitive values should stay in environment variables or the gitignored `.secrets.toml` files under `pr_agent/settings/` and `pr_agent/settings_prod/`. `apply_secrets_manager_config()` optionally loads values from AWS Secrets Manager.\n\n### Git Providers\n\n`pr_agent/git_providers/` contains provider implementations that share the `GitProvider` interface in `pr_agent/git_providers/git_provider.py`. Provider-dependent behavior should be selected through capability checks such as `provider.is_supported(\"feature\")` rather than concrete provider-type checks, because individual providers can stub or override capabilities. Some output is gated this way too: semantic file types and several other `/describe` sections are only emitted where `gfm_markdown` is supported.\n\n### Servers and Entrypoints\n\n`pr_agent/servers/` hosts webhook and service entrypoints that translate provider events into `PRAgent.handle_request(...)` calls. The CLI entrypoint is `pr_agent/cli.py`, registered as the `pr-agent` console script.\n\n## Build, Test, and Development Commands\n\n- Install dependencies (runtime + dev) into a project virtualenv from the lockfile with `uv sync` using a uv version that satisfies `tool.uv.required-version` in `pyproject.toml`; `uv run` auto-syncs before each command.\n- Run a single unit test (verified): `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`.\n- Run the full unit suite: `PYTHONPATH=. uv run pytest tests/unittest -v`.\n- CI also runs `uv run pytest -q tests/packaging/test_help_docs_package.py`; it is outside `testpaths`, so the unit suite does not cover it. The distribution-contract test checks that the installed uv version satisfies `tool.uv.required-version` in `pyproject.toml`.\n- Execute the CLI locally once dependencies and API keys are available: `uv run pr-agent --pr_url <https://host/org/repo/pull/123> review`.\n- Build the test Docker target mirror of CI when containerizing: `docker build -f docker/Dockerfile --target test .` (loads dev dependencies and copies `tests/`).\n- Build the documentation the same way CI does (Node.js 22): `npm ci` then `npm run build` from `docs/`; `npm start` serves a live preview. After building, run `python3 scripts/check_docs_urls.py` from the repository root to check `docs/build` as CI does. The `docs-ci` workflow publishes `docs/build` to GitHub Pages.\n\n## Coding Style and Existing Tooling\n\nRuff is the single linting tool: `pyproject.toml` configures it and the pre-commit Ruff hook enforces it (Flake8 and the standalone isort hook have been removed).\n\n- Keep Python lines within the 120-character limit declared in `pyproject.toml`.\n- `pyproject.toml` configures Ruff rules `E`, `F`, `B`, `I`, `UP`, `FURB`,  `PERF` and `PLE`. Within the files touched by the task, fix lint violations rather than adding ignore entries. Remove corresponding ignore entries only when they are no longer needed, and preserve intentional exceptions.\n- Before committing, run `uv run ruff check --fix <paths>` on the Python files you touched and fix every issue it reports. Keep fixes mechanical (rename, remove unused imports, sort imports); do not alter program logic while cleaning up — if a lint fix would change behavior, surface it instead of applying it silently.\n- `.pre-commit-config.yaml` is the source of truth for enabled pre-commit hooks. Run them on the files you touched with `uvx pre-commit run --files <paths>` and review the automatic edits so unrelated changes are not included. The pre-commit GitHub Actions workflow runs on pull requests, so the hooks are enforced in CI.\n- No general-purpose Python formatter is currently enforced (`ruff format` is deliberately not adopted yet). Preserve the surrounding file's formatting and avoid unrelated rewrites or repository-wide formatting.\n- Prefer double quotes for Python strings where consistent with the surrounding file.\n- Match existing docstring and comment style—concise English comments using imperative phrasing only where necessary.\n- Configuration files in `pr_agent/settings/` are TOML; preserve formatting, section order, and comments when editing prompts or defaults.\n- Markdown in `docs/` uses Docusaurus conventions: every page starts with YAML front matter (`title`, `sidebar_position`), admonitions use `:::note` fences, collapsible sections use `<details>`, and images live in `docs/static/img/` referenced as `/img/<file>`. Pages stay `.md` (CommonMark) unless they need a JSX component, in which case they are `.mdx`. Register every new page in `docs/sidebars.js`.\n\n## Testing Guidelines\n\n- Pytest is the standard framework; keep new tests under the closest matching directory (`tests/unittest/` for unit logic, `tests/e2e_tests/` for integration flows, `tests/health_test/` for smoke coverage).\n- Pytest configuration lives in `pyproject.toml`, including `asyncio_mode = \"auto\"` and `testpaths = [\"tests/unittest\"]`. The Docker test image keeps `pyproject.toml` at `/app` (uv installs from it), so CI inherits these settings as well. Plain `PYTHONPATH=. uv run pytest` therefore defaults to the unit suite; invoke end-to-end tests explicitly.\n- Prefer focused unit tests that isolate helpers in `pr_agent/algo/`, `pr_agent/commands/`, or provider adapters; use parameterized tests where existing files already do so.\n- Set `PYTHONPATH=.` when invoking pytest from the repository root to avoid import errors.\n- End-to-end suites require provider credentials and may take several minutes; `TOKEN_GITHUB`, `TOKEN_GITLAB`, `BITBUCKET_USERNAME`, and `BITBUCKET_PASSWORD` are CI secret names, not runtime environment variables (see the mappings in `.github/workflows/e2e_tests.yaml`). These tests create remote branches and pull/merge requests and expect deployed apps/webhooks to process them; run them only when credentials and sandboxes are configured.\n- `tests/health_test/main.py` is a manual script for `/describe`, `/review`, and `/improve`; it asserts artifact headers inline, not checked-in artifact files. Update those inline assertions if prompts change meaningfully. CI provider smoke runs `tests/health_test/test_github_smoke.py` instead (`/describe` only, model stubbed, `GITHUB.USER_TOKEN`).\n\n## Review Checklist\n\n- A setting can arrive as a TOML list, a plain string, or an environment value that Dynaconf parses as TOML (`SECTION__KEY=123` arrives as an int). Code that reads it handles each form.\n- A fix in one git provider, AI handler or server usually applies to its siblings. Check the same logic in the others and fix them or name them in the PR.\n- New or changed regexes run in linear time: no nested or adjacent unbounded quantifiers that can match the same characters, and no unbounded leading quantifier in an unanchored search. User-supplied patterns and globs get a length cap before they are compiled or translated.\n- Docs and config comments describe what the branch does. A PR that changes a default or a setting's behavior updates the `configuration.toml` comment and the docs page that state it, and none documents behavior from another PR.\n\n## Commit and Pull Request Guidelines\n\n- Follow `CONTRIBUTING.md`: keep changes focused, add or update tests, and use Conventional Commit-style messages (e.g., `fix: handle missing repo settings gracefully`).\n- Target branch names follow `feature/<name>` or `fix/<issue>` patterns for substantial work.\n- Reference related issues and update README or docs when user-facing behavior shifts.\n- Before requesting review, run the relevant local checks above and make sure the corresponding CI workflows (`build-and-test`, `pre-commit`) pass; coverage is collected and uploaded by `build-and-test` except on docs-page-only PRs, which run packaging and documentation checks instead; `docs-ci` builds the documentation on every pull request that touches `docs/**` (publishing only on pushes to `main` and `add-docs-portal`). That build fails on broken links and anchors, and also runs `scripts/check_docs_urls.py` to confirm the documentation URLs hardcoded in `pr_agent/` and the README still resolve.\n- Include screenshots or terminal captures when modifying user-visible output or documentation previews.\n\n## Safety and Permissions\n\n- Ask for confirmation before adding dependencies, renaming files, or changing workflow definitions; many consumers embed these paths and prompts.\n- Stay within existing formatting and directory conventions—avoid mass refactors, re-sorting of prompts, or reformatting Markdown beyond the touched sections.\n- You may read files, list directories, and run targeted lint/test/doc commands without prior approval; coordinate before launching full Docker builds or e2e suites that rely on external credentials.\n- Never commit cached credentials, API keys, or coverage artifacts; CI already handles secrets through GitHub Actions.\n- Treat prompt and configuration files as single sources of truth—keep related defaults and prompts under `pr_agent/settings/` synchronized when behavior changes. The root `.pr_agent.toml` is intended for this repository's hosted Qodo reviews, not as a mirror of the packaged defaults; some entries have no open-source implementation.\n\n## Security and Configuration Tips\n\n- Secrets should be supplied through environment variables (see usages in `tests/e2e_tests/test_github_app.py` and `tests/health_test/main.py`); do not persist them in code or configuration files.\n- Adjust runtime behavior by overriding keys in `.pr_agent.toml` or by supplying repository-specific Dynaconf files; keep overrides minimal and documented inside the PR description.\n- Review `SECURITY.md` before disclosing vulnerabilities and follow its contact instructions for responsible reporting.\n","docs/docs/commands/add_docs.md":"---\ntitle: \"Add Docs\"\nsidebar_position: 6\n---\n\n## Overview\n\nThe `add_docs` command scans the PR code changes and suggests documentation for any code components that are missing documentation, such as functions, classes, and methods.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/add_docs\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/add_docs` on any PR:\n\n<img src=\"/img/add_docs_comment.png\" alt=\"Add Docs\" width=\"512\" />\n\nThe command will generate documentation suggestions as inline code suggestions.\n\n### Language-specific documentation styles\n\nThe command automatically detects the programming language and generates documentation in the appropriate format:\n\n| Language | Documentation Format |\n|----------|---------------------|\n| Python | Docstrings (Sphinx, Google, Numpy styles) |\n| Java | Javadocs |\n| JavaScript/TypeScript | JSdocs |\n| C++ | Doxygen |\n| Other | Generic documentation |\n\n## Configuration options\n\nUnder the section `[pr_add_docs]`, the following options are available:\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `extra_instructions` | string | `\"\"` | Additional instructions for the AI model |\n| `docs_style` | string | `\"Sphinx\"` | Documentation style for Python. Options: `\"Sphinx\"`, `\"Google Style with Args, Returns, Attributes...etc\"`, `\"Numpy Style\"`, `\"PEP257\"`, `\"reStructuredText\"` |\n| `use_repo_context` | boolean | `true` | Apply conventions from configured repository instruction files (for example `AGENTS.md`); set to `false` to opt out |\n\n### Example configuration\n\nTo customize the documentation style, add the following to your configuration file:\n\n```toml\n[pr_add_docs]\ndocs_style = \"Google Style with Args, Returns, Attributes...etc\"\nextra_instructions = \"Focus on documenting public methods and include usage examples\"\n```\n\nBy default, `/add_docs` follows the shared `config.repo_context_files` selection (`[\"AGENTS.md\"]` by default,\nread from the repository default branch). To disable repository instructions for `/add_docs` only:\n\n```toml\n[pr_add_docs]\nuse_repo_context = false\n```\n\nStructured sibling-repository entries in `config.repo_context_files` are excluded from `/add_docs` to avoid publishing private sibling guidance in PR suggestions. Local repository entries remain in effect.\n\nSetting `config.repo_context_files = []` disables repository instructions across commands. Repository instructions\nare optional prompt context: if they do not fit the selected model's input budget, they are omitted without shortening\nthe PR diff. Explicit `extra_instructions` and `docs_style` take precedence. Repository instructions may add file\nreads and prompt tokens, but do not introduce another model call.\nRepository instructions are appended to the rendered system prompt, including with custom `[pr_add_docs_prompt]`\ntemplates. Existing template variables and diff rendering are left unchanged.\n\n### Command line options\n\nYou can pass configuration options directly in the command:\n\n```\n/add_docs --pr_add_docs.docs_style=\"Numpy Style\"\n```\n\n## How it works\n\n1. The command analyzes the PR diff to identify code components (functions, classes, methods) that lack documentation\n2. It uses AI to generate appropriate documentation based on the code context and language\n3. Documentation suggestions are published as inline code suggestions that can be applied with a single click\n\n### Model response failures\n\nEach model response is validated before it is accepted. Missing content or an\ninvalid documentation structure triggers the next model in `CONFIG.FALLBACK_MODELS`,\nif configured. An explicit empty list or `Code Documentation: null` is a valid\nempty result and does not trigger another model call.\n\nIf all model attempts fail, PR-Agent records the command as failed and removes\nthe temporary progress comment. With `CONFIG.PUBLISH_OUTPUT` enabled, it also\nattempts to post **Failed to generate code documentation for this PR.**\n\n### Publication failures\n\nSuggestions are skipped if their original source line cannot be reliably retained,\nincluding when file content is unavailable or incomplete. Valid suggestions in the\nsame response can still be published.\n\nWith `CONFIG.PUBLISH_OUTPUT` enabled, PR-Agent retries unsuccessful batch\npublication one suggestion at a time. If the batch and every individual retry\nexplicitly report failure, it attempts to post **Failed to publish code\ndocumentation for this PR.** and records the command as failed. Partial success\nor an unconfirmed provider result does not trigger this all-failed outcome.\n","docs/docs/commands/ask.md":"---\ntitle: \"Ask\"\nsidebar_position: 5\n---\n\n## Overview\n\nThe `ask` command answers questions about the PR, based on the PR code changes. Make sure to be specific and clear in your questions.\nIt can be invoked manually by commenting on any PR:\n\n```\n/ask \"...\"\n```\n\n## CLI JSON output\n\nThe CLI can write a single JSON file containing the question, answer, and available token usage:\n\n```bash\npython -m pr_agent.cli --pr_url https://github.com/org/repo/pull/123 \\\n    --json-output answer.json ask \"What changed?\"\n```\n\nThis also works with `ask_question` and in [Plain Diff mode](../usage-guide/plain_diff_mode.md):\n\n```bash\ngit diff | python -m pr_agent.cli --stdin --json-output answer.json ask \"What changed?\"\n```\n\nPlace `--json-output` before the command. The file is overwritten for each invocation and has\n`question`, `answer`, and `usage` fields. `usage` is an empty object when token counts are unavailable,\nincluding when the command explains that no changed files could be analyzed without calling a model.\n\nFor PR URLs, setting `config.publish_output = false` in the host configuration suppresses PR\ncomments without suppressing the requested JSON file. The existing\n[push outputs](../usage-guide/push_outputs.md) feature serves a different purpose: it delivers\nopt-in Ask records to operator-configured sinks and requires publishing to be enabled.\n\n## Example usage\n\n<img src=\"/img/ask_comment.png\" alt=\"Ask Comment\" width=\"512\" />\n\n<img src=\"/img/ask.png\" alt=\"Ask\" width=\"512\" />\n\n## Repository instructions\n\nBoth top-level `/ask` and inline `/ask_line` can use the same repository instruction files as `/review`, `/describe`, and `/improve`.\nFor example, ask whether a migration follows the rollback rules in an existing architecture decision record:\n\n```toml\n[config]\nrepo_context_files = [\"AGENTS.md\", \"docs/adr/database-migrations.md\"]\n```\n\n```text\n/ask \"Does this migration follow our rollback and compatibility rules?\"\n```\n\nLike `/review`, `/describe`, and `/improve`, both Ask modes read `AGENTS.md` from the repository root by default.\nSet `config.repo_context_files = []` in the root repository settings to disable repository instructions for all commands.\nComment arguments cannot change the configured file list.\n\nThe existing [repository context settings](../usage-guide/additional_configurations.md#bringing-per-repo-context-files-to-pr-agent)\ncontrol file selection, source branches, imports, and line limits. Files come from the repository's default branch unless\nconfigured otherwise. Providers without repository file access skip this context; missing or empty files are also skipped.\n\nThe question, selected discussion history, and packed diff keep their existing token budget. The instruction block,\nalready bounded by `repo_context_max_lines`, is included only if it fits in the remaining model context in full.\nOtherwise, the corresponding Ask mode keeps its original prompt and adds a short omission notice to the answer. It does not retry another model\njust to fit instructions. Normal model retries reconsider the original instruction block without reading the files again.\nFor `/ask_line`, the selected lines, complete diff hunk, and fitted thread history likewise take precedence over\nrepository instructions. No instruction files are read when the requested diff hunk is unavailable.\nIncluding repository instructions can add repository API reads and input tokens, but does not add a separate model request.\n\n## Ask lines\n\nYou can run `/ask` on specific lines of code in the PR from the PR's diff view. The command will answer questions based on the code changes in the selected lines.\n\nFor line comments handled by the GitHub App, GitHub Actions, or GitLab webhook, `/ask_question` is an alias of `/ask`.\nStart the comment with `/ask`, `/ask_question`, or `/ask_line` after any leading whitespace;\nthese command names are case-insensitive. Other tokens such as `/asking` are not Ask commands.\nAzure DevOps accepts lowercase `/ask_question` for the same thread and line handling as `/ask`;\nits webhook command names remain case-sensitive.\n\n- Click on the '+' sign next to the line number to select the line.\n- To select multiple lines, click on the '+' sign of the first line and then hold and drag to select the rest of the lines.\n- write `/ask \"...\"` in the comment box and press `Add single comment` button.\n\n<img src=\"/img/Ask_line.png\" alt=\"Ask Line\" width=\"512\" />\n\nIf no matching diff hunk is found for the selected lines, the command explains this without calling a model.\n\nIn the GitHub App, GitHub Actions, and GitLab webhook, a file comment whose first non-whitespace token is `/ask` or\n`/ask_question` uses that file's complete diff as context. These two command names are case-insensitive.\nThe existing file filters and input budgets still apply. If the file has no analyzable diff, or the question cannot\nbe prepared within the configured input budget, the command explains this without calling a model.\nThe answer is posted in the original file-comment thread with a link to the question.\nEarlier replies are included when `pr_questions.use_conversation_history` is enabled and the input budget allows.\nText resembling command options is treated as part of the question.\n\nIn the Azure DevOps webhook, `/ask`, `/ask_question`, or a mention of PR-Agent in a thread on a whole file also uses\nthat file's complete diff, with the same filters, input budgets, and notes. The answer is posted in that thread with a\nlink to the question, and earlier comments in the thread are included as described above.\n\nWith `pr_questions.use_conversation_history=true` (the default), line questions on GitHub, GitLab, and Azure DevOps\ncan include earlier comments from the same thread. Azure DevOps also supports history for threaded top-level questions.\nOther questions are answered independently.\n\nOn GitLab, this reads the selected discussion before answering, adding an API request and potentially more model input\ntokens, but no separate model request. Set `pr_questions.use_conversation_history=false` to answer without earlier\ncomments. Line questions still require a matching hunk in the current diff.\n\n## Ask on images\n\nYou can also ask questions about images that appear in the comment, where the entire PR code will be used as context.\n<br>\nThe basic syntax is:\n\n```\n/ask \"...\"\n\n[Image](https://real_link_to_image)\n```\n\nwhere `https://real_link_to_image` is the direct link to the image.\n\nNote that GitHub has a built-in mechanism of pasting images in comments. However, pasted image does not provide a direct link.\nTo get a direct link to an image, we recommend using the following scheme:\n\n1. First, post a comment that contains **only** the image:\n\n   <img src=\"/img/ask_images1.png\" alt=\"Ask image1\" width=\"512\" />\n\n2. Quote reply to that comment:\n\n   <img src=\"/img/ask_images2.png\" alt=\"Ask image2\" width=\"512\" />\n\n3. In the screen opened, type the question below the image:\n\n   <img src=\"/img/ask_images3.png\" alt=\"Ask image3\" width=\"512\" />\n   <img src=\"/img/ask_images4.png\" alt=\"Ask image4\" width=\"512\" />\n\n4. Post the comment, and receive the answer:\n\n   <img src=\"/img/ask_images5.png\" alt=\"Ask image5\" width=\"512\" />\n\nSee a full video tutorial [here](https://www.qodo.ai/images/pr_agent/ask_image_video.mov)\n\n## Linked ticket context\n\nEnable linked ticket context when asking how a PR satisfies an issue's requirements or acceptance criteria:\n\n```toml\n[pr_questions]\nuse_ticket_context = true\n```\n\nSet this in host or root repository configuration. PR comment/CLI arguments and per-directory files\ncannot enable it because ticket integrations use the operator's credentials.\n\nThis is disabled by default and applies to top-level `/ask` and `ask_question`, not inline `/ask_line` questions.\nIt uses the same [ticket integrations](../core-abilities/fetching_ticket_context.md), credentials, reference formats,\naccess checks and fetch limits as `/review` and `/describe`. Tickets are discovered from the PR/MR metadata;\nlinks written only in the question are not additional ticket sources. This option is independent of\n`pr_reviewer.require_ticket_analysis_review`.\n\nTicket integrations use the operator's configured access policy, not the asker's personal ticket credentials.\nFor Jira, the host-controlled `jira.project_keys` allowlist still applies (`[]` disables lookups);\nconfigure only projects whose ticket content may appear in PR answers.\n\nTicket content is fetched once per command, after an analyzable diff fits. It adds API reads and input tokens\nwhen enabled and uses the existing model request. Unavailable tickets are skipped. Each model attempt includes only\nwhole ticket records that fit after the existing question, conversation history and selected diff, so ticket\ncontext does not displace code already selected for the answer. Large tickets may be omitted, including all\ntickets when there is no room. The usual diff-based answer remains available in that case.\n\n## Configuration options\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>ask_heading</b></td>\n    <td>\n      Plain-text heading for top-level <code>/ask</code> answers. The default is <code>Ask</code>.\n      Markdown renderers escape punctuation to keep the surrounding formatting and ❓ emoji fixed,\n      while plain-text converters publish the configured text without escape characters.\n      This does not affect <code>/ask_line</code> replies or the <code>Answer</code> section heading.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10. Instead, tell the user this type of question is not allowed.\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>use_conversation_history</b></td>\n    <td>If set to true, the command will use the conversation history from the same thread when answering questions on specific code lines (GitHub, GitLab, and Azure DevOps) or threaded top-level questions (Azure DevOps only). Default is true.</td>\n  </tr>\n  <tr>\n    <td><b>use_ticket_context</b></td>\n    <td>Include linked ticket content in top-level questions using the remaining prompt budget. Default is false. See <a href=\"#linked-ticket-context\">Linked ticket context</a>.</td>\n  </tr>\n</table>\n\n</details>\n\nExample usage in a configuration file:\n\n```toml\n[pr_questions]\nask_heading = \"Architecture Question\"\nextra_instructions = \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10.\"\n```\n\nThe heading above renders as `### **Architecture Question** ❓`.\n\nExample usage in a PR comment:\n\n```\n/ask \"What does this change do?\" --pr_questions.extra_instructions=\"Answer in one short paragraph.\"\n```\n","docs/docs/commands/describe.md":"---\ntitle: \"Describe\"\nsidebar_position: 2\n---\n\n## Overview\n\nGenerate a PR title, type, summary, code walkthrough and labels.\n\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or it can be invoked manually by commenting on any PR:\n\n```\n/describe\n```\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/describe` on any PR:\n\n<img src=\"/img/describe_comment.png\" alt=\"Describe comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a description for the PR:\n\n<img src=\"/img/describe_new.webp\" alt=\"Describe New\" width=\"512\" />\n\nWhile a large PR's chunks run, the temporary `Preparing PR description...` comment is rewritten in place, for example `Preparing PR description... analyzed 2 of 3 chunks`; once every chunk has settled, `, 1 chunk failed` is added if a chunk gave up. This needs `config.publish_output_progress` and a provider that can edit and remove comments; single-chunk runs keep the plain placeholder.\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/describe --pr_description.some_config1=... --pr_description.some_config2=...\n```\n\nFrom the CLI, save the generated description and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output describe.json describe\n```\n\nThe JSON file is written after the description is assembled. Place `--json-output` before `describe` or `describe_pr`; it works with `--pr_url` or with plain-diff input (`--stdin` or `--diff-file`).\n\n### Automatic triggering\n\nTo run the `describe` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/describe\",\n    ...\n]\n\n[pr_description]\npublish_labels = true\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_description]` section contains the configurations for the `describe` command you want to edit (if any).\n\n## File walkthrough summaries\n\nOn providers that support the HTML walkthrough, short file summaries appear on a new line after the filename.\nWhen detailed changes are available, expanding the file entry reveals them while the short summary stays visible when collapsed.\nGitLab descriptions no longer use description-list indentation for these summaries.\n\nThe description reader can extract file summaries from both the current and legacy walkthrough formats.\nIf separate PR-Agent installations generate walkthroughs and reuse their file summaries (for example, `/describe` and `/review`), upgrade them together; older readers cannot extract file summaries from the new format.\n\n## Preserving the original user description\n\nBy default, PR-Agent tries to preserve your original PR description by placing it above the generated content.\nThis requires including your description during the initial PR creation.\n\n\"PR-Agent removed the original description from the PR. Why\"?\n\nFrom our experience, there are two possible reasons:\n\n- If you edit the description _while_ the automated command is running, a race condition may occur, potentially causing your original description to be lost. Hence, create a description before launching the PR.\n\n- When _updating_ a description previously generated by PR-Agent, `/describe` preserves text after the first recognized `### **User description**` heading until the next recognized boundary heading, trimming surrounding whitespace and a trailing `___`. If no boundary heading follows, it stops at the first `___` substring, or at the end if none is present, and trims surrounding whitespace. If the generated description has no recognized `### **User description**` heading, add that heading before your manual text; otherwise that text can be lost on the next body update.\n\n  Boundary headings are lines starting with `### **PR type**`, `### **PR description**`, `### **PR labels**`, `### **Type**`, `### **Description**`, `### **Labels**`, or `### 🤖 Generated by PR Agent`, matched case-insensitively outside fenced code blocks. Manual headings with these prefixes also end preservation, even if more text follows the prefix. Keep manual edits inside these boundaries; edits to generated sections are replaced.\n\n<img src=\"/img/pr_description_user_description.png\" alt=\"Describe comment\" width=\"512\" />\n\n## Flowchart Support {#sequence-diagram-support}\nThe `/describe` command includes a Mermaid flowchart summarizing the main PR changes on providers that support `gfm_markdown`.\n\nThis option is enabled by default via the `pr_description.enable_pr_diagram` param.\n\nThe direction of the diagram adapts to its shape. A diagram whose longest chain of nodes exceeds `pr_description.pr_diagram_direction_threshold` is drawn top-down rather than left-to-right, so that wide diagrams are not scaled down until they become unreadable. Set `pr_description.pr_diagram_direction` to `LR` or `TD` to pin the direction instead.\n\n\n[//]: # (### How to enable\\disable)\n\n[//]: # ()\n[//]: # (In your configuration:)\n\n[//]: # ()\n[//]: # (```)\n\n[//]: # (toml)\n\n[//]: # ([pr_description])\n\n[//]: # (enable_pr_diagram = true)\n\n[//]: # (```)\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>Possible configurations</summary>\n\n<table>\n  <tr>\n    <td><b>publish_labels</b></td>\n    <td>If set to true, the command will publish labels to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment</b></td>\n    <td>If set to true, the command will publish the description as a comment to the PR. If false, it will overwrite the original description.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment_persistent</b></td>\n    <td>If set to true and `publish_description_as_comment` is true, the command will publish the description as a persistent comment to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>add_original_user_description</b></td>\n    <td>If set to true, the command will add the original user description to the generated description.</td>\n  </tr>\n  <tr>\n    <td><b>generate_ai_title</b></td>\n    <td>If set to true, the command will also generate an AI title for the PR.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_type</b></td>\n    <td>If set to false, it will not show the `PR type` as a text value in the description content.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_description</b></td>\n    <td>If set to false, the AI-generated summary section will not be requested from the model, nor shown in the description content. The other sections (diagram, changes walkthrough) are unaffected.</td>\n  </tr>\n  <tr>\n    <td><b>final_update_message</b></td>\n    <td>If set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/the-pr-agent/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`.</td>\n  </tr>\n  <tr>\n    <td><b>enable_semantic_files_types</b></td>\n    <td>If set to true, \"Changes walkthrough\" section will be generated.</td>\n  </tr>\n  <tr>\n        <td><b>file_table_collapsible_open_by_default</b></td>\n        <td>Controls whether the file list in the \"Changes walkthrough\" section is initially open or closed.</td>\n  </tr>\n  <tr>\n    <td><b>collapsible_file_list</b></td>\n    <td>If set to true, the file list in the \"Changes walkthrough\" section will be collapsible. If set to \"adaptive\", the file list will be collapsible only when the number of files exceeds <code>collapsible_file_list_threshold</code>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_handling</b></td>\n    <td>If set to true, in case of a large PR the command will make several calls to the AI and combine them to be able to cover more files.</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_diagram</b></td>\n    <td>If set to true, the command will generate a Mermaid flowchart summarizing the main pull request changes. This field remains empty if not applicable.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction</b></td>\n    <td>Direction of the generated Mermaid flowchart: <b>adaptive</b>, <b>LR</b> or <b>TD</b>. With adaptive, the direction is chosen from the shape of the diagram.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction_threshold</b></td>\n    <td>With <b>adaptive</b> direction, a diagram whose longest chain exceeds this many nodes is drawn top-down instead of left-to-right.</td>\n  </tr>\n</table>\n\n</details>\n\n## Markers template\n\nTo enable markers, set `pr_description.use_description_markers=true`.\nMarkers enable to easily integrate user's content and auto-generated content, with a template-like mechanism.\n\nFor example, if the PR original description was:\n\n```\nUser content...\n\n## PR Type:\npr_agent:type\n\n## PR Description:\npr_agent:summary\n\n## PR Walkthrough:\npr_agent:walkthrough\n\n## PR Diagram:\npr_agent:diagram\n```\n\nThe marker `pr_agent:type` will be replaced with the PR type, `pr_agent:summary` will be replaced with the PR summary, `pr_agent:walkthrough` will be replaced with the PR walkthrough, and `pr_agent:diagram` will be replaced with the flowchart (if enabled).\n\n<img src=\"/img/describe_markers_before.png\" alt=\"Describe markers before\" width=\"512\" />\n\nbecomes\n\n<img src=\"/img/describe_markers_after.webp\" alt=\"Describe markers after\" width=\"512\" />\n\n**Configuration params**:\n\n- `use_description_markers`: if set to true, the command will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false.\n- `include_generated_by_header`: only applies when `use_description_markers` is true. If true (default), the command adds a 'Generated by PR Agent at ...' header to automatic content when the provider supplies a head commit SHA, otherwise the header is 'Generated by PR Agent' (or uses `config.bot_display_name` when configured). If false, no header is added.\n- `diagram`: if present as a marker, will be replaced by the PR flowchart (if enabled).\n\n## Custom labels\n\nThe default labels of the describe command are quite generic, since they are meant to be used in any repo: [`Bug fix`, `Tests`, `Enhancement`, `Documentation`, `Other`].\n\nYou can define custom labels that are relevant for your repo and use cases.\nCustom labels can be defined in the PR-Agent host configuration, or directly in the repo's\n[labels page](#handle-custom-labels-from-the-repos-labels-page). The host configuration options cannot be set from\nthe repository's `.pr_agent.toml` or comment arguments.\n\nMake sure to provide proper title, and a detailed and well-phrased description for each label, so the command will know when to suggest it.\nEach label description should be a **conditional statement**, that indicates if to add the label to the PR or not, according to the PR content.\n\n<details open>\n<summary>Auto-remove custom label when no longer relevant</summary>\n\nIf the custom label is no longer relevant, it will be automatically removed from the PR by running the `generate_labels` command or the `describe` command.\n\n</details>\n\n\n### Handle custom labels from a configuration file\n\nExample for a custom labels configuration setup in the PR-Agent host configuration:\n\n```\n[config]\nenable_custom_labels=true\n\n\n[custom_labels.\"sql_changes\"]\ndescription = \"Use when a PR contains changes to SQL queries\"\n\n[custom_labels.\"test\"]\ndescription = \"use when a PR primarily contains new tests\"\n\n...\n```\n\n### Handle custom labels from the Repo's labels page\n\nYou can also control the custom labels that will be suggested by the `describe` command from the repo's labels page:\n\n- GitHub : go to `https://github.com/{owner}/{repo}/labels` (or click on the \"Labels\" tab in the issues or PRs page)\n- GitLab : go to `https://gitlab.com/{owner}/{repo}/-/labels` (or click on \"Manage\" -> \"Labels\" on the left menu)\n\nNow add/edit the custom labels. they should be formatted as follows:\n\n- Label name: The name of the custom label.\n- Description: Start the description of with prefix `pr_agent:`, for example: `pr_agent: Description of when AI should suggest this label`.<br>\n\nExamples for custom labels:\n\n- `Main topic:performance` -  pr_agent:The main topic of this PR is performance\n- `New endpoint` -  pr_agent:A new endpoint was added in this PR\n- `SQL query` -  pr_agent:A new SQL query was added in this PR\n- `Dockerfile changes` - pr_agent:The PR contains changes in the Dockerfile\n- ...\n\nThe description should be comprehensive and detailed, indicating when to add the desired label. For example:\n<img src=\"/img/add_native_custom_labels.webp\" alt=\"Add native custom labels\" width=\"768\" />\n\n## Usage Tips\n\n:::tip[Automation]\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app) for the describe command is:\n```\npr_commands = [\"/describe\", ...]\n```\nmeaning the `describe` command will run automatically on every PR, with the default configurations.\n:::\n\n- Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:\n\n   ```\n   pr_commands = [\"/describe --pr_description.use_description_markers=true\", ...]\n   ```\n\n   the command will replace every marker of the form `pr_agent:marker_name` in the PR description with the relevant content, where `marker_name` is one of the following:\n\n   - `type`: the PR type.\n   - `summary`: the PR summary.\n   - `walkthrough`: the PR walkthrough.\n\n- Note that when markers are enabled, if the original PR description does not contain any markers, the command will not alter the description at all.\n","docs/docs/commands/generate_labels.md":"---\ntitle: \"Generate Labels\"\nsidebar_position: 7\n---\n\n## Overview\n\nThe `generate_labels` command scans the PR code changes and generates custom labels for the PR based on the content and context of the changes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/generate_labels\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/generate_labels` on any PR.\n\nThe command will analyze the PR and add appropriate labels.\n\nFor local or CI workflows that need label suggestions without a hosting-provider token,\npass a unified diff and write the filtered labels to a JSON artifact:\n\n```bash\npython -m pr_agent.cli --diff-file changes.diff --json-output labels.json generate_labels\n```\n\nThe JSON result contains a `labels` list and a `usage` object (empty when token usage\nis unavailable). Only model-generated labels that pass the existing allowlist are included;\nlabels already on a hosted PR are not included. A PR without analyzable changes produces\nan empty list. This option does not change the normal label publication behavior.\nCheck the command's exit status before consuming the artifact: a failed run does not delete a previous JSON file.\n\n## Configuration options\n\nThe `generate_labels` command uses configurations from the `[pr_description]` section for custom labels.\n\n### Enabling custom labels\n\nTo use custom labels, you need to enable them in the configuration:\n\nSet these options in the PR-Agent host configuration. Repository `.pr_agent.toml` files and comment arguments cannot\nchange them.\n\n```toml\n[config]\nenable_custom_labels = true\n```\n\n### Defining custom labels\n\nYou can define your own custom labels in the `[custom_labels]` section. See the [custom_labels.toml](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/custom_labels.toml) file for examples.\n\nExample configuration:\n\n```toml\n[custom_labels.\"Bug fix\"]\ndescription = \"A fix for a bug in the codebase\"\n\n[custom_labels.\"Feature\"]\ndescription = \"A new feature or enhancement\"\n\n[custom_labels.\"Documentation\"]\ndescription = \"Documentation changes only\"\n\n[custom_labels.\"Tests\"]\ndescription = \"Adding or modifying tests\"\n\n[custom_labels.\"Refactoring\"]\ndescription = \"Code refactoring without functional changes\"\n```\n\n### How labels are applied\n\n1. The command analyzes the PR diff and commit messages\n2. It uses AI to determine which labels best match the PR content\n3. Labels are automatically applied to the PR (if the git provider supports it)\n4. If labels cannot be applied directly, they are published as a comment\n\nBoth `/generate_labels` and `/describe` filter model-generated labels before publishing.\nThe allowed set contains the built-in PR types (`Bug fix`, `Tests`, `Enhancement`,\n`Documentation`, `Other`) plus the configured custom label names when custom labels\nare enabled. With custom labels enabled but no custom set configured, the default\nset also includes `Bug fix with tests`. Matching ignores case, and unknown generated\nlabels are dropped with a warning. Existing human-added labels are preserved and\nare not restricted by this filter.\n\nPrompt enum keys such as `bug_fix` and `RELEASE_READY` are resolved to their\nallowed display names, ignoring case. If a nonempty model response contains only\nrejected labels, `/generate_labels` leaves the current labels unchanged. An\nexplicit `labels: []` response retains the existing behavior of clearing old\nbot-owned labels while preserving human-added labels.\n\nIf the current labels cannot be read, `/generate_labels` skips publication and\nrecords the command as failed. A known provider failure while publishing labels\nalso marks the command as failed. With `config.propagate_command_errors = true`, these\nfailures raise an error after temporary-comment cleanup.\n\nA successful provider acknowledgement means its label operation completed normally;\nit does not verify the final remote label set. Providers apply labels differently,\nand a failure can leave some changes applied. The command does not retry or roll\nback those changes. Labels generated by `/describe` and `/review` remain auxiliary\nto their primary output.\n\n## Comparison with `/describe` labels\n\nThe `/describe` command also generates labels as part of its output. The key differences are:\n\n| Feature | `/generate_labels` | `/describe` |\n|---------|-------------------|-------------|\n| Purpose | Dedicated label generation | Full PR description with labels |\n| Output | Labels only | Title, summary, walkthrough, and labels |\n| Custom labels | ✅ Supported | ✅ Supported |\n| Use case | When you only need labels | When you want a complete PR description |\n\n## Tips\n\n- Use custom labels that match your team's workflow and labeling conventions\n- Combine with automation to automatically label PRs when they are opened\n- Review the generated labels and adjust custom label descriptions if the AI consistently misclassifies PRs\n","docs/docs/commands/help.md":"---\ntitle: \"Help\"\nsidebar_position: 9\n---\n\n## Overview\n\nThe `help` command provides a list of all the available commands and their descriptions.\nInvoke commands by posting their slash commands. The checkboxes shown on GitHub do not execute commands when checked.\n\nOn Bitbucket Cloud, Gerrit and CodeCommit, `/help` without a question displays an unsupported-format notice instead of the command list. `/help <question>` can still answer questions from the documentation.\n\nLocal mode only displays the unsupported-format notice for `/help`. Plain-diff mode supports the command list, but `/help <question>` is currently unavailable in both local and plain-diff modes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/help\n```\n\nCalling `/help` without a question displays the command list, where supported, without initializing an AI handler,\nso errors during that initialization do not block the list.\n`/help <question>` still uses the configured AI model.\n\nWhen answering a question, the command tries the configured fallback models if a model returns an invalid response format\nor an empty answer. If all attempts fail, no answer is published and the command records a failure.\nA response that reports no relevant information is still shown normally.\n\n## Example usage\n\nInvoke the `help` command by commenting on a PR with:\n\n<img src=\"/img/help1.png\" alt=\"Help command input\" width=\"750\" />\n\n\nResponse will include a list of available commands:\n\n<img src=\"/img/help2.webp\" alt=\"Help command output\" width=\"750\" />\n","docs/docs/commands/help_docs.md":"---\ntitle: \"Help Docs\"\nsidebar_position: 10\n---\n\n:::warning[`/help_docs` is currently disabled]\nAs of **v0.36.1**, the `/help_docs` command is temporarily disabled as a mitigation for a\ncredential-exposure vulnerability ([#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)):\nthe command accepted an untrusted runtime override of its git clone target, and the clone-URL\nhost validation only checked substring containment, so a host that merely *contained* the\nallowed host could receive the git provider token.\n\nThe command is not registered in `PRAgent`, so invoking it has no effect on any provider. The\npage below documents the command as it behaves once it is re-enabled.\n:::\n\n## Overview\n\nThe `help_docs` command can answer a free-text question based on a git documentation folder.\n\nIt can be invoked manually by commenting on any PR or Issue:\n\n```\n/help_docs \"...\"\n```\n\nOr configured to be triggered automatically when a [new issue is opened](../installation/github.md#run-as-a-github-action).\n\nThe command assumes by default that the documentation is located in the root of the repository, at `/docs` folder.\nHowever, this can be customized by setting the `docs_path` configuration option:\n\n```toml\n[pr_help_docs]\nrepo_url = \"\"                 # The repository to use as context\ndocs_path = \"docs\"            # The documentation folder\nrepo_default_branch = \"main\"  # The branch to use in case repo_url overwritten\n\n```\n\nSee more configuration options in the [Configuration options](#configuration-options) section.\n\n## Example usage\n\n[//]: # (#### Asking a question about this repository:)\n\n[//]: # (<img src=\"/img/help_docs_comment.png\" alt=\"help_docs on the documentation of this repository\" width=\"512\" />)\n\n**Asking a question about another repository**\n\n<img src=\"/img/help_docs_comment_explicit_git.png\" alt=\"help_docs on the documentation of another repository\" width=\"512\" />\n\n**Response**:\n\n<img src=\"/img/help_docs_response.png\" alt=\"help_docs response\" width=\"512\" />\n\n## Run automatically when a new issue is opened\n\nYou can configure PR-Agent to run `help_docs` automatically on any newly created issue.\nThis can be useful, for example, for providing immediate feedback to users who open issues with questions on open-source projects with extensive documentation.\n\nHere's how:\n\n1. Follow the steps depicted under [Run as a GitHub Action](../installation/github.md#run-as-a-github-action) to create a new workflow, such as:`.github/workflows/help_docs.yml`:\n\n2. Edit your yaml file to the following:\n\n   ```yaml\n   name: Run pr agent on every opened issue, respond to user comments on an issue\n\n   #When the action is triggered\n   on:\n     issues:\n       types: [opened] #New issue\n\n   # Read env. variables\n   env:\n     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n     GITHUB_API_URL: ${{ github.api_url }}\n     GIT_REPO_URL: ${{ github.event.repository.clone_url }}\n     ISSUE_URL: ${{ github.event.issue.html_url || github.event.comment.html_url }}\n     ISSUE_BODY: ${{ github.event.issue.body || github.event.comment.body }}\n     OPENAI_KEY: ${{ secrets.OPENAI_KEY }}\n\n   # The actual set of actions\n   jobs:\n     issue_agent:\n       runs-on: ubuntu-latest\n       if: ${{ github.event.sender.type != 'Bot' }} #Do not respond to bots\n\n       # Set required permissions\n       permissions:\n         contents: read    # For reading repository contents\n         issues: write     # For commenting on issues\n\n       steps:\n         - name: Run PR Agent on Issues\n           if: ${{ env.ISSUE_URL != '' }}\n           uses: docker://pragent/pr-agent:latest\n           with:\n             entrypoint: /bin/bash #Replace invoking cli.py directly with a shell\n             args: |\n               -c \"cd /app && \\\n               echo 'Running Issue Agent action step on ISSUE_URL=$ISSUE_URL' && \\\n               export config__git_provider='github' && \\\n                           export github__user_token=$GITHUB_TOKEN && \\\n               export github__base_url=$GITHUB_API_URL && \\\n               export openai__key=$OPENAI_KEY && \\\n               python -m pr_agent.cli --issue_url=$ISSUE_URL --pr_help_docs.repo_url=\"...\" --pr_help_docs.docs_path=\"...\" --pr_help_docs.openai_key=$OPENAI_KEY && \\\n               help_docs \"$ISSUE_BODY\"\n   ```\n\n3. Following completion of the remaining steps (such as adding secrets and relevant configurations, such as `repo_url` and `docs_path`) merge this change to your main branch.\n   When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is related to the documentation of the repository.\n\n---\n\n## Configuration options\n\nUnder the section `pr_help_docs`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'help docs' command:\n\n- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context.\n- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect.\n- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url).\n- `exclude_root_readme`:  Whether or not to exclude the root README file for querying the model.\n- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model.\n\n---\n","docs/docs/commands/index.md":"---\ntitle: \"Commands\"\nsidebar_position: 1\n---\n\nEach PR-Agent command has a dedicated page that explains its behavior and usage:\n\n| Command | Description |\n|------|-------------|\n| **[PR Description (`/describe`)](./describe.md)** | Generate a PR title, type, summary, code walkthrough and labels. |\n| **[PR Review (`/review`)](./review.md)** | Generate a PR review with feedback on possible issues, security concerns, tests and review effort. |\n| **[Code Suggestions (`/improve`)](./improve.mdx)** | Runs /review, whose findings can carry committable code fixes. |\n| **[Question Answering (`/ask ...`)](./ask.md)** | Answering free-text questions about the PR, or on specific code lines |\n| **[Add Documentation (`/add_docs`)](./add_docs.md)** | Generate documentation for code components that are missing it |\n| **[Generate Labels (`/generate_labels`)](./generate_labels.md)** | Generate custom labels for the PR based on the code changes |\n| **[Similar Issues (`/similar_issue`)](./similar_issues.md)** | Find similar issues in the repository based on the current issue |\n| **[Help (`/help`)](./help.md)** | Provides a list of all the available commands |\n| **[Help Docs (`/help_docs`)](./help_docs.md)** | **Temporarily disabled.** Answers questions about a Git repository’s documentation. |\n| **[Update Changelog (`/update_changelog`)](./update_changelog.md)** | Automatically updating the CHANGELOG.md file with the PR changes |\n\n## Usage examples\n\nEach command can be triggered in two ways:\n\n- **As a comment** — write the command (e.g. `/review`) as a comment, and PR-Agent replies. Most commands are commented on a PR; issue-scoped commands such as `similar_issue` are commented on an issue.\n- **From the [CLI](../usage-guide/automations_and_usage.md#local-repo-cli)** — run `python -m pr_agent.cli --pr_url=<PR_URL> <command>`. Issue-scoped commands take `--issue_url=<ISSUE_URL>` instead of `--pr_url`. The module form works only from an environment where the `pr_agent` package is importable (for example, the venv created by `uv sync`). If `pr-agent` is on your `PATH`, run it directly.\n\nBoth accept the same command arguments and [configuration overrides](../usage-guide/configuration_options.md).\n\n| Command                                     | Comment                          | CLI                                                             |\n|------------------------------------------|----------------------------------|----------------------------------------------------------------|\n| [Describe](./describe.md)                | `/describe`                      | `python -m pr_agent.cli --pr_url=<PR_URL> describe`             |\n| [Review](./review.md)                    | `/review`                        | `python -m pr_agent.cli --pr_url=<PR_URL> review`              |\n| [Improve](./improve.mdx)                  | `/improve`                       | `python -m pr_agent.cli --pr_url=<PR_URL> improve`             |\n| [Ask](./ask.md)                          | `/ask \"How does X work?\"`        | `python -m pr_agent.cli --pr_url=<PR_URL> ask \"How does X work?\"` |\n| [Add Docs](./add_docs.md)                | `/add_docs`                      | `python -m pr_agent.cli --pr_url=<PR_URL> add_docs`           |\n| [Generate Labels](./generate_labels.md)  | `/generate_labels`               | `python -m pr_agent.cli --pr_url=<PR_URL> generate_labels`     |\n| [Similar Issues](./similar_issues.md)    | `/similar_issue`                 | `python -m pr_agent.cli --issue_url=<ISSUE_URL> similar_issue` |\n| [Help](./help.md)                        | `/help`                          | `python -m pr_agent.cli --pr_url=<PR_URL> help`                |\n| [Update Changelog](./update_changelog.md)| `/update_changelog`              | `python -m pr_agent.cli --pr_url=<PR_URL> update_changelog`    |\n\n`/help_docs` is temporarily disabled (see [#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)) and is therefore omitted from the table above.\n\nFor screenshots, arguments, and a walkthrough of a typical use case, see the **Example usage** section on each command's page linked above.\n","docs/docs/commands/review.md":"---\ntitle: \"Review\"\nsidebar_position: 3\n---\n\n## Overview\n\nGenerate a PR review with feedback on possible issues, security concerns, tests and review effort.\n<br>\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or can be invoked manually by commenting on any PR:\n\n```\n/review\n```\n\nNote that the main purpose of the `review` command is to provide the **PR reviewer** with useful feedback and insights. Findings can also carry a fix, which GitHub and the other supported providers offer as a [committable suggestion](#fixes-and-committable-suggestions).\n\n(Read more about the different personas in the PR process and how PR-Agent aims to assist them in our [blog](https://www.qodo.ai/blog/understanding-the-challenges-and-pain-points-of-the-pull-request-cycle/))\n\n:::note\n`/improve` runs `/review` as of 0.51. See [Improve](./improve.mdx).\n:::\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/review` on any PR:\n\n<img src=\"/img/review_comment.png\" alt=\"review comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a review for the PR:\n\n<img src=\"/img/review3.png\" alt=\"review\" width=\"512\" />\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...\n```\n\nFrom the CLI, save the parsed review and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output review.json review\n```\n\nThe JSON file is written after the review completes. Place `--json-output` before `review` or `review_pr`.\nIts `coverage` object lists files omitted by the token budget or chunk-call limit, as well as\ndeletions represented only by filename notices (`files_not_reviewed`), and those whose patches\nwere clipped to fit the token budget (`files_partially_reviewed`).\nFiles excluded by file-type filtering are not included in these coverage lists.\nFilename notices are optional context, not reviewed source; filtered-file notices take priority\nwhen both kinds compete for the remaining request budget.\nFilename notices supplement source changes and do not trigger a model call on their own.\nA deletion-only PR without source changes to analyze is skipped, even when deletion patches are available.\nThe JSON includes the full lists even when the Markdown footer summarizes them.\nIt also includes `total_chunks` and `failed_chunks` for the final analysis plan, after fallback recovery.\nThese count analysis chunks, not model requests or retry attempts. A nonzero `failed_chunks` means that the\nreview is partial even if both file lists are empty; findings from successful chunks are retained.\n\n### Automatic triggering\n\nTo run the `review` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/review\",\n    ...\n]\n\n[pr_reviewer]\nextra_instructions = \"...\"\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_reviewer]` section contains the configurations for the `review` command you want to edit (if any).\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>persistent_comment</b></td>\n    <td>If set to true, the review comment will be persistent, meaning that every new review request will edit the previous one.</td>\n  </tr>\n  <tr>\n    <td><b>per_commit_review</b></td>\n    <td>If set to true, each commit of the PR is reviewed on its own diff and commit message, and one review comment is published per commit. See <a href=\"#reviewing-each-commit-separately\">Reviewing each commit separately</a>. It can't be turned on from a command argument, only from a configuration file or environment variable. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_commits_per_review</b></td>\n    <td>Maximum number of commits <code>per_commit_review</code> reviews one by one. When more commits than that are not reviewed yet, the whole PR is reviewed in one review instead, with a notice. It can't be set from a command argument or a per directory configuration file. Default is 0, no limit.</td>\n  </tr>\n  <tr>\n    <td><b>publish_review_failure_comment</b></td>\n    <td>\n      Set to false to suppress the \"Failed to review PR\" comment, including when a persistent review comment\n      cannot be updated. Successful review output and the command's failure status are unchanged. Default is true.\n      On GitHub, GitLab, and Azure DevOps, when the comment author can be verified, repeated failures update one\n      comment instead of adding another, and the next review that completes removes it. If the provider rejects\n      that edit or removal, the earlier comment stays and no other is added. A review in which some chunks failed\n      keeps it; files left out for the token budget do not. With\n      <code>gitlab.reply_to_trigger_comment</code>, each failure still replies to its own command, and a persistent\n      review comment that cannot be updated gets a comment of its own each time. Those are removed the same way,\n      and so are the failure comments of earlier versions.\n    </td>\n  </tr>\n  <tr>\n    <td><b>publish_error_details</b></td>\n    <td>\n      If set to true, a failed manual review comment includes a deterministic, sanitized failure reason for known\n      provider and runtime errors. The failure formatter does not call an AI model, never publishes raw exception\n      text, and falls back to a generic internal-error message. Default is false.\n    </td>\n  </tr>\n  <tr>\n    <td><b>review_heading</b></td>\n    <td>\n      Visible base heading for review comments, without the Markdown prefix or incremental label.\n      For example, <code>review_heading = \"Guideline Compliance Check\"</code> renders\n      <code>## Guideline Compliance Check 🔍</code> for a full review and\n      <code>## Incremental Guideline Compliance Check 🔍</code> for an incremental review.\n      On GitHub, GitLab, Azure DevOps, and Bitbucket Cloud, changing this value updates the same\n      persistent review comment; it does not create a separate review channel.\n    </td>\n  </tr>\n  <tr>\n    <td><b>persistent_finding_state</b></td>\n    <td>If set to true, PR-Agent persists structured review finding state across complete review runs, so findings can be resolved and reopened. Resolved findings retain the original Markdown formatting of their description. Incremental and partial reviews do not resolve absent findings. Default is true.</td>\n\n  </tr>\n  <tr>\n    <td><b>max_previous_findings_chars</b></td>\n        <td>Character budget for the findings stored by earlier reviews (requires <code>persistent_finding_state</code>). They are given to the model so it repeats a still-valid finding with its earlier wording instead of re-raising it reworded, and does not re-raise a resolved one unless the code reintroduces it. On GitHub and GitLab, an inline key-issue thread that someone other than PR-Agent resolved is given as dismissed, with its last reply, so the model does not re-raise it unless the code makes it worse. Set to 0 to disable. Default is 8000.\n      On Azure DevOps, verified PR-Agent inline key issues with <code>wontFix</code> or <code>byDesign</code>\n      are also passed as dismissed when the status differs from <code>azure_devops.default_comment_status</code>.\n      A matching default stays an ordinary prior finding. This infers a human decision; Azure does not identify\n      the status-changing actor here, and the current default may differ from the default used at creation.\n      PR-Agent resolves its posting identity through Azure DevOps. Set\n      <code>azure_devops_server.agent_identity</code> to override it or when automatic lookup is unavailable.\n    </td>\n  </tr>\n  <tr>\n  <td><b>final_update_message</b></td>\n  <td>When set to true, updating a persistent review comment during online commenting will automatically add a short comment with a link to the updated review in the pull request.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\".</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_coverage_footer</b></td>\n    <td>If set to true, the command will display a review coverage footer when source changes were not reviewed or were only partially reviewed, including deleted files represented by filename notices.\n    A review with this footer is published even when <code>publish_output_no_suggestions</code> is false.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_chunking</b></td>\n    <td>If set to true, and the token budget leaves files out of the review, the diff is split into chunks, each chunk is reviewed separately, and the per-chunk results are merged into one review. See <a href=\"#reviewing-a-pr-that-does-not-fit-in-one-call\">Reviewing a PR that does not fit in one call</a>. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_number_of_calls</b></td>\n    <td>Maximum number of chunk review calls, used only when <code>enable_large_pr_chunking</code> is true. Default is 3.</td>\n  </tr>\n  <tr>\n    <td><b>num_max_findings</b></td>\n    <td>Maximum number of returned findings. Default is 6.</td>\n  </tr>\n  <tr>\n    <td><b>inline_key_issues</b></td>\n    <td>If set to true (the default), each key issue is published as an inline comment where the provider supports verified inline-comment publication (GitHub, Bitbucket Cloud, Azure DevOps, GitLab, Gitea). A finding leaves the review summary when a matching comment exists or the provider accepts the new comment. Findings that cannot be anchored or published stay in the summary. A finding that carries a fix is published as a committable suggestion when `pr_code_suggestions.committable_code_suggestions` is true, the fix is at most ten lines and its `existing_code` matches the file at the finding's lines; otherwise the fix appears as a code block in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>min_finding_confidence</b></td>\n    <td>When above 0, the model reports an integer confidence from 0 to 10 for each finding, shown in its header in the review summary (inline comments do not show it). Findings below this value are dropped before publishing, and in a chunked review they are dropped before the <code>num_max_findings</code> cut, so they cannot displace a more confident finding. A run that dropped findings does not mark earlier findings as resolved. A missing or out-of-range confidence is treated as absent: the finding is kept. A threshold outside 0-10 is treated as 0 (disabled). Default is 0: keep all findings, and the model is not asked for a confidence.</td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Enable\\disable specific sub-sections</summary>\n\n<table>\n  <tr>\n    <td><b>require_score_review</b></td>\n    <td>If set to true, the command will add a section that scores the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_tests_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains tests.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_effort_to_review</b></td>\n    <td>If set to true, the command will add a section that estimates the effort needed to review the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_contribution_time_cost</b></td>\n    <td>If set to true, the command will add a section that estimates the time required for a senior developer to create and submit such changes.</td>\n  </tr>\n  <tr>\n    <td><b>require_can_be_split_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains several themes, and can be split into smaller PRs.</td>\n  </tr>\n  <tr>\n    <td><b>require_security_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains a possible security or vulnerability issue.</td>\n  </tr>\n    <tr>\n    <td><b>require_todo_scan</b></td>\n    <td>If set to true, the command will add a section that lists TODO comments found in the PR code changes.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_ticket_analysis_review</b></td>\n    <td>\n      If set to true and ticket context is available, the command adds a ticket-compliance section to the review comment\n      that checks whether the PR fulfills the ticket requirements. Supported sources include GitHub and GitLab issues,\n      linked Azure DevOps work items, Jira Cloud tickets, and Asana tasks.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_risk_assessment</b></td>\n    <td>If set to true, the command will add a section that rates the overall risk of the PR as low, medium or high.</td>\n  </tr>\n  <tr>\n    <td><b>require_merge_recommendation</b></td>\n    <td>If set to true, the command publishes a recommendation computed from deterministic checks. Only passing checks\n    allow no_concerns_found; needs_review means a check did not pass or could not be evaluated, and changes_required\n    reflects a model veto. The value reports the review's findings, not a guarantee about the code. See\n    <a href=\"#merge-recommendation\">Merge recommendation</a>.</td>\n  </tr>\n  <tr>\n    <td><b>publish_merge_recommendation_status</b></td>\n    <td>If set to true with <code>require_merge_recommendation</code>, publishes the verdict on the reviewed commit.\n    GitHub uses the <code>PR Agent - Review</code> check; GitLab uses a commit status. <code>needs_review</code>\n    publishes as neutral on GitHub and skipped on GitLab, so it does not block a merge; <code>changes_required</code>\n    publishes as a failure.</td>\n  </tr>\n  <tr>\n    <td><b>max_changed_lines</b></td>\n    <td>Host-only changed-line cap for <code>no_concerns_found</code>. A larger diff makes the recommendation\n    <code>needs_review</code> at best. The cap counts added and removed lines.</td>\n  </tr>\n  <tr>\n    <td><b>require_failure_modes</b></td>\n    <td>Off by default. If enabled, adds up to three concrete failure scenarios, each with what could break,\n    where, its trigger, how it could be detected, and whether a test or check in this PR covers it.\n    These scenarios guide human review; they do not gate merging or prove that the PR is safe.</td>\n  </tr>\n  <tr>\n    <td><b>require_artifact_findings</b></td>\n    <td>Off by default, and only active when a <a href=\"../../installation/github/#ci-artifact-context\">CI artifact</a> reaches /review.\n    If enabled, adds a \"CI artifact findings\" section with up to five neutral facts from the artifact: destroyed or replaced\n    resources, failed jobs (including allowed-to-fail ones), failed tests, vulnerabilities and notable warnings. Each fact\n    carries a short quote from the artifact; a quote that cannot be found in the artifact is marked, and credentials in\n    facts and quotes are redacted. The section reports what the artifact shows and leaves the decision to the reviewer.\n    Host configuration only: a repository settings file or comment cannot set it.</td>\n  </tr>\n  <tr>\n    <td><b>require_priority_files</b></td>\n    <td>If set to true, the command will add a section listing the files a human reviewer should inspect first.</td>\n  </tr>\n  <tr>\n    <td><b>structural_reach_input_file</b></td>\n    <td>Path to a JSON file with structural reach facts, written by a build-graph tool earlier in CI. When the file\n    exists, adds a deterministic change-risk row (Low, Moderate, High or Critical) with no model call. Relative to\n    <code>GITHUB_WORKSPACE</code> when that is set, otherwise to the working directory. Host configuration only: a\n    repository settings file or a comment cannot set it, because the file is read from the host. See\n    <a href=\"#structural-reach\">Structural reach</a>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_risk_checks</b></td>\n    <td>\n      If set to true, deterministically scans diff files and unfiltered PR files for sensitive paths, destructive SQL,\n      cache flushes, and authentication/secrets patterns without making model calls. Findings are rendered as a risk-checks\n      row in the review summary table. When no findings are detected, nothing is added. Default is true. See\n      <a href=\"#deterministic-risk-checks\">Deterministic risk checks</a>.\n    </td>\n  </tr>\n  <tr>\n    <td><b>sensitive_paths</b></td>\n    <td>\n      List of glob patterns identifying files considered sensitive (such as CI workflows, package manifests, lockfiles,\n      migrations, and infrastructure configurations). Changes to matching files flag a deterministic review risk finding.\n      Default includes common CI/CD, package manager, container, infrastructure, and migration paths.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_risky_shapes</b></td>\n    <td>\n      List of custom regular expression patterns to scan within added and removed lines in diff hunks. Patterns matching a\n      line flag a deterministic risk finding. Patterns longer than 200 characters, or with a quantified group that holds a\n      nested quantifier or an alternation (such as `(a+)+` or `(a|b)+`), are skipped with a logged warning. Host\n      configuration only: a repository settings file or comment cannot set it. Default is empty.\n    </td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Adding PR labels</summary>\n\nYou can enable\\disable the `review` command to add specific labels to the PR:\n\n<table>\n  <tr>\n    <td><b>enable_review_labels_security</b></td>\n    <td>If set to true, the command will publish a 'Possible security concern' label if it detects a security issue.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_labels_effort</b></td>\n    <td>If set to true, the command will publish a 'Review effort x/5' label (1–5 scale). Existing effort labels are kept when this option or effort estimation is disabled, or when the review has no valid replacement estimate. Security labels follow their own settings.</td>\n  </tr>\n</table>\n\n</details>\n\n## Usage Tips\n\n### General guidelines\n\n:::tip\n\nThe `review` command provides a collection of configurable feedbacks about a PR.\nIt is recommended to review the [Configuration options](#configuration-options) section, and choose the relevant options for your use case.\n\nSome of the features that are disabled by default are quite useful, and should be considered for enabling. For example:\n`require_score_review`, and more.\n\nOn the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases.\n:::\n\n### Automation\n\n:::tip\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened) for the `review` command is:\n```\npr_commands = [\"/review\", ...]\n```\nMeaning the `review` command will run automatically on every PR, without any additional configurations.\nEdit this field to enable/disable the command, or to change the configurations used.\n:::\n\n### Auto-generated PR labels by the Review Command\n\n:::tip\n\nThe `review` command can automatically add labels to your Pull Requests:\n\n- **`Possible security concern`**: This label is applied if the command detects a potential [security vulnerability](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L147) in the PR's code. This feedback is controlled by the 'enable_review_labels_security' flag (default is true).\n- **`Review effort 3/5`**: This label estimates the [effort](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L119) required to review the PR on a scale of 1 to 5. This feedback is controlled by the 'enable_review_labels_effort' flag (default is true).\n\nThe command matches these label names and earlier 1–5 effort formats case-insensitively.\nOther labels, such as `Review effort::high`, are left unchanged.\n\nTicket compliance is reported in the review comment, not as a PR label. It is controlled by\n`pr_reviewer.require_ticket_analysis_review` and requires available ticket context. The command does not add\nticket-compliance labels or a \"No ticket found\" label. See\n[Fetching ticket context](../core-abilities/fetching_ticket_context.md) for linking and authentication details.\n\n\n:::\n\n### Auto-blocking PRs from being merged based on the generated labels\n\n:::tip\n\nYou can configure a CI/CD Action to prevent merging PRs with specific labels. For example, implement a dedicated [GitHub Action](https://medium.com/sequra-tech/quick-tip-block-pull-request-merge-using-labels-6cc326936221).\n\nThis approach helps ensure PRs with potential security issues will not be merged without further review.\n\nSince AI may make mistakes or lack complete context, use this feature judiciously. For flexibility, users with appropriate permissions can remove generated labels when necessary. When a label is removed, this action will be automatically documented in the PR discussion, clearly indicating it was a deliberate override by an authorized user to allow the merge.\n:::\n\n### Extra instructions\n\n:::tip\n\nExtra instructions are important.\nThe `review` command can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.\n\nBe specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-command, and the relevant aspects of the PR that you want to emphasize.\n\nExamples of extra instructions:\n```\n[pr_reviewer]\nextra_instructions=\"\"\"\\\nIn the code feedback section, emphasize the following:\n- Does the code logic cover relevant edge cases?\n- Is the code logic clear and easy to understand?\n- Is the code logic efficient?\n...\n\"\"\"\n```\nUse triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.\n:::\n\n### Fixes and committable suggestions\n\nA finding can carry a fix: the model adds `existing_code` (the lines it wants to change, copied from the file) and\n`improved_code` (their replacement) when a concrete change resolves the issue. A finding without a clear fix has neither field.\n\nWhen `inline_key_issues` is on (the default) and the provider can verify inline comments (GitHub, Bitbucket Cloud, Azure DevOps,\nGitLab, Gitea), each finding is posted as an inline comment. If `pr_code_suggestions.committable_code_suggestions` is true and\n`existing_code` matches the file at the finding's lines, the fix is posted as a committable suggestion that you can apply from the\nPR page. Otherwise the fix is shown as a text block in the comment. A finding that is not posted inline (the provider cannot verify\ninline comments, `inline_key_issues` is off, or publishing failed) stays in the review summary, and its fix appears there as a text\nblock. Findings are capped by `pr_reviewer.num_max_findings` (6 by default), and chunked reviews keep the same cap.\n\nThree `pr_code_suggestions` settings are honoured: `committable_code_suggestions`, `extra_instructions`\n(added to the review's extra instructions when it differs from `pr_reviewer.extra_instructions`) and\n`suggestions_heading` (the base heading for code-suggestion comments). Other `pr_code_suggestions` keys have no effect.\n\n```\n/review --pr_code_suggestions.committable_code_suggestions=true\n```\n\n### Reviewing each commit separately\n\n:::tip\n\nProjects that keep one logical change per commit can ask for a review of every commit instead of the combined PR diff,\nin a configuration file:\n\n```\n[pr_reviewer]\nper_commit_review = true\n```\n\nEach commit is reviewed against its own parent, with its commit message in the prompt, and gets its own\nincremental review comment that names and links the commit. These comments are never the persistent\nreview comment, and they do not change the review labels.\n\nEach run reviews only the commits of the PR that were not reviewed yet, so `-i` is not needed in `pr_commands` or\n`push_commands`, and the first run reviews every commit. A commit is identified by a fingerprint of its own changes\n(file names and patch lines, without line numbers), and counts as reviewed once its review succeeds: the fingerprint\nis kept in a hidden marker in the commit's review comment or, when no comment is published for it, in one record\ncomment that is edited in place. A commit whose review failed is reviewed again on the next run; automatic runs stop\nretrying it after 3 failed attempts, while a manual `/review` always retries.\n`minimal_commits_for_incremental_review` and `minimal_minutes_for_incremental_review` do not apply to per commit\nreview, since each run picks the commits to review from these markers instead of the `-i` thresholds.\nThe commit list is read from the git provider on every run, so after a force push the review follows the rewritten\nhistory: a commit that was rebased without changing its own patch is not reviewed again, a commit that was amended or\nhad fixups folded into it (for example with `git rebase --autosquash`) is reviewed again, and fixup commits that no\nlonger exist are not reviewed. Markers count only in comments PR-Agent wrote; when the git provider cannot confirm\nthat, the whole PR is reviewed in one review with a notice instead.\nOn GitLab, a commit with a collapsed, too large or rename only file is reviewed again after a rebase, since its\nfingerprint includes its SHA.\n\nSet `publish_output_no_suggestions = false` in the `[pr_reviewer]` section\n(`--pr_reviewer.publish_output_no_suggestions=false` on the command line) to skip the comment of a commit with\nno findings and no coverage warning.\nWith `inline_key_issues = true`, each finding is published as an inline comment on the commit it was found in,\nanchored to that commit's own diff, so GitHub and GitLab show it as outdated once a later commit changes those lines.\nA finding that cannot be anchored there, for example because its line is outside that commit's diff or the provider\nrejects it, stays in that commit's review comment instead of being moved to a nearby line.\n\nMerge commits, empty commits and the root commit of a history have no diff of their own and are skipped. A commit that\nfails to review is reported like a failed review and does not stop the remaining commits. Every reviewed commit is a\nseparate model call, so the first review of a PR with many commits costs accordingly; later runs review only the new\ncommits.\nHosts that want to bound that cost can set `max_commits_per_review` (default 0, no limit): when more commits than that\nare not reviewed yet, the whole PR is reviewed in one review with a notice, and its commits count as reviewed.\nThe markers live only in PR-Agent's own comments, so if those comments are removed, the next run reviews every commit\nof the PR again, unless `max_commits_per_review` is set and the PR has more commits than that, in which case the whole\nPR gets one review.\nBoth settings belong to the operator, so a command argument such as `--pr_reviewer.per_commit_review=true` is\nrejected.\nEach commit's comment shows its own run details, while the `--json-output` file and the GitHub Action `review` output\ndescribe the last reviewed commit only.\n\nPer commit review is available on GitHub and GitLab. Other git providers fall back to a regular review of the whole PR.\nGitHub lists at most 250 commits of a PR, so a PR with more commits than that is also reviewed as a whole, with a\nnotice explaining why.\n:::\n\n### Reviewing a PR that does not fit in one call\n\n:::tip\n\nWhen a PR diff is larger than the model's token budget, the `review` command drops whole files\nuntil the diff fits, and lists the dropped files in the review coverage footer.\n\nSetting `enable_large_pr_chunking = true` changes what happens next: the diff is split into up\nto `max_number_of_calls` chunks, each chunk is reviewed on its own, and the answers are merged\ninto a single review that says how many chunks it was built from. Files that do not fit even\nafter chunking are still listed in the coverage footer. Every chunk is a separate model call,\nso a chunked review costs roughly `max_number_of_calls` times a normal one.\n\nWhile the chunks run, the temporary `Preparing review...` comment is rewritten in place with the\nnumber of chunks already analyzed, for example `Preparing review... analyzed 2 of 3 chunks`, plus\n`... 1 chunk failed` when a chunk gives up. The updates require\n`config.publish_output_progress` and a provider that supports both editing and removing a\ncomment, so plain-diff runs keep the frozen placeholder. Automatic commands publish no progress\ncomment, but while `github.publish_as_check_run` is enabled their in-progress check run shows the\nsame chunk count. The comment stays\ntemporary and is still removed before the merged review is published. A fallback model restores\nthe placeholder before it starts, so the visible count never moves backward.\n\nIf a chunk fails or returns malformed output, successful chunks are retained and fallback\nmodels retry only the pending work. Pending chunks can be split for a smaller model, within\nthe call limit; a larger model can also include previously omitted files. Chunks that still\nexceed the model's budget are not sent to it.\n\nWhen only one chunk is unfinished and all source files are already in the plan, a smaller\nfallback model can review fitting files beside oversized files. This requires a separate\nchunk for every file within the existing limit, including completed chunks. Oversized files\nremain pending for later models. If none of the recovered chunks succeeds, the original\ngrouping is restored for the next model. Non-retryable errors stop fallback even when another\nchunk exceeds the budget; this includes guardrail rejections only when reported as non-retryable.\n\nIf every fallback is exhausted, successful chunks are published as a partial review with a\nfailed-chunk coverage warning, even when `publish_output_no_suggestions = false`. Incomplete\nreviews cannot resolve absent persistent findings. If no chunk succeeds, the review fails.\nWith `config.propagate_command_errors = true`, an exhausted fallback chain still signals failure\nto the caller after publishing the partial review and removing the progress comment.\nOptional run details list all models that contributed to the merged review.\n\nEach chunk answers the same questions about a different part of the PR, so the answers are\nmerged field by field:\n\n| Field | Merge rule |\n| --- | --- |\n| `key_issues_to_review` | Union over the chunks, dropping findings that repeat the same file, header and text |\n| `security_concerns` | Every chunk that reported a concern is kept; \"No\" only when every chunk said no |\n| `todo_sections`, `review_priority_files`, `can_be_split` | Union, de-duplicated, in chunk order (`can_be_split` keeps at most 3 sub-PRs) |\n| `relevant_tests` | Yes if any chunk found tests |\n| `score` | The lowest score any chunk gave |\n| `risk_level`, `merge_recommendation` | The most conservative value any chunk gave |\n| `failure_modes` | Concatenate valid cases in chunk order, dropping exact duplicates and keeping at most three |\n| `estimated_effort_to_review_[1-5]` | The highest value any chunk gave |\n| `contribution_time_cost_estimate` | The sum over the chunks, per case |\n| `ticket_compliance_check` | One entry per ticket, with its bullet lists unioned across chunks |\n\nWhen `require_todo_scan` is enabled, the TODO union includes both located findings and prose\nsummaries. Prose without a file location is shown as text without a source link.\n\nThe merged verdict is deliberately never less alarming than the worst chunk: a clean chunk\ncannot raise a score, clear a security concern, or soften a risk level set by another chunk.\n:::\n\n### Structural reach\n\n:::tip\n\nWhen `structural_reach_input_file` points at a file that exists, the review gets one row at the top that rates how\nfar a defect in the change could spread. The row is computed from that file, not by the model, so the same input\nalways gets the same rating.\n\n```\n🔗 Structural reach: Critical\nReach: 40 projects, cross-domain\nDependents: billing-api, payments-worker, web-app, admin-app, reports (+35 more)\nSensitivity: payments\nRating driven by sensitive domain (escalates regardless of size)\n```\n\n**Rating.** Two facts from the input file set the band:\n\n- **Reach** is the number of downstream projects a defect in the change can break. Only a build-graph tool knows\n  it.\n- **Sensitivity** flags changes to areas the repository marks as high-criticality, such as authentication,\n  payments or secrets. A one-line auth change outranks a wide styling sweep.\n\nReach is narrow up to 3 projects, moderate up to 25 and wide above that. The band then follows these rules:\n\n| Condition | Band |\n| --- | --- |\n| Wide reach | At least Moderate |\n| Cross-domain change | At least Moderate |\n| Any sensitive domain | At least High |\n| Sensitive domain with wide reach | Critical |\n| Anything else | Low |\n\nThe row lists each factor and names the one that set the band. It also lists the first five names in\n`dependents`, in the order the producer wrote them.\n\nThe reach bands are defined for projects only. When `reach_unit` is `modules` or `files`, the row shows the count\nand the dependents without a band, because no threshold separates a change to a shared utility from a real spread.\nA cross-domain or sensitive change still gets a band from the rules above. The Reach line still shows the\nnumber, but it does not affect the band.\n\nChange size is not part of the rating, because\n`estimated_effort_to_review_[1-5]` already reflects it. That row and `require_risk_assessment` are the model's\njudgement; this row adds the structural and sensitivity facts the model cannot see in the diff.\n\n**Input file.** Any build-graph tool (Nx, Bazel, Gradle, Turborepo, and so on) can write the reach facts in an\nearlier CI step, so pr-agent needs no adapter per tool. Point `structural_reach_input_file` at the file in host\nconfiguration, for example the `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE` environment variable. Every field is\noptional:\n\n```json\n{\n  \"version\": 1,\n  \"reach\": 12,\n  \"reach_unit\": \"projects\",\n  \"dependents\": [\"billing-api\", \"web-app\"],\n  \"domains\": [\"billing\", \"web\"],\n  \"cross_domain\": true,\n  \"sensitive_domains\": [\"billing\"]\n}\n```\n\n| Field | Type | Meaning |\n| --- | --- | --- |\n| `version` | integer | Schema version. Only `1` is accepted. |\n| `reach` | integer, 0 or more | Number of units affected by the change, including transitive dependents. Defaults to the length of `dependents`. |\n| `reach_unit` | string | What `reach` counts: `projects` (the default), `modules` or `files`. Only `projects` gets a reach band. |\n| `dependents` | list of strings | Names of the affected units, most relevant first. |\n| `domains` | list of strings | Distinct domains or areas the affected projects belong to. |\n| `cross_domain` | boolean | Whether the change spans more than one domain. |\n| `sensitive_domains` | list of strings | Affected domains the repository treats as sensitive. |\n\nUnknown fields are ignored. Strings are limited to 200 characters and the file to 1 MB.\n\n**Trust.** The file is read from inside `GITHUB_WORKSPACE` (or the working directory), so in the GitHub Action a\ncheckout of the pull request could already contain a file at that path, written by the pull request's author.\nGenerate the file in the same job, right before the review step, and delete any existing copy first. Take the\nproject tags and graph configuration the producer reads from the base commit, not from the pull request. Treat the\nband as advisory context for reviewers, never as a merge gate.\n\n**Example producer: Nx.** `nx show projects --affected` lists every project the change affects, including\ntransitive dependents. This step writes them as `dependents`, and lists affected projects tagged `sensitive` as\n`sensitive_domains`:\n\n```bash\naffected() { npx nx show projects --affected --base=\"$BASE_SHA\" --head=\"$HEAD_SHA\" --json \"$@\"; }\naffected | jq --argjson sensitive \"$(affected -p 'tag:sensitive')\" \\\n  '{version: 1, reach_unit: \"projects\", dependents: ., sensitive_domains: $sensitive}' > structural-reach.json\n```\n\nThen set `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE=structural-reach.json` for the review step. Another tool\nneeds only a query that lists the affected projects or packages.\n\n**Example producer: tree-sitter.** For a repository without a build-graph tool,\n`scripts/structural_reach_producer.py` builds a reverse-import graph of the Python, TypeScript and JavaScript\nfiles at the base commit and follows importers from the changed files. Test files are left out of reach and\ndomains, because counting them makes most changes to a shared module read wide. It writes `reach_unit` as\n`modules` (directories) by default, so the row shows the count and the first dependents without a band. Run it as\na CI step before the review; it is not a pr-agent dependency:\n\n```bash\npip install \"tree-sitter-language-pack==1.22.1\"\npython scripts/structural_reach_producer.py --repo . --base \"$BASE_SHA\" --head \"$HEAD_SHA\" \\\n  --unit module --out structural-reach.json\n```\n\nOn this repository, the change merged in pull request 4420 gives:\n\n```\n🔗 Structural reach\nReach: 9 modules\nDependents: pr_agent/git_providers, pr_agent/commands, pr_agent/servers, pr_agent/algo, pr_agent/mosaico (+4 more)\n```\n\n`dependents` is ordered by the number of affected files in each unit. The graph does not see imports built at\nrun time, files loaded by name such as settings, or dependencies declared only in a manifest, such as a shared\n`tsconfig` package used through `extends`. In a monorepo with Nx, Turborepo or Bazel, use that tool instead.\n\n**Failure handling.** The row never blocks a review. If the setting is empty, the input file is missing or does\nnot match the schema, or anything fails while computing the row, the review is published without it.\n\n**Sources.**\n\n- Beyer, B. et al. *Site Reliability Engineering* (Google, 2016), and the AWS Well-Architected Framework: blast\n  radius as the scope of impact of a change or failure.\n- OWASP guidance on sensitive functionality: authentication, session management, cryptography and payments.\n\n:::\n\n### Deterministic risk checks\n\n:::tip\n\nWhen `enable_risk_checks` is enabled (the default), PR-Agent scans changed files and diff hunks for known risk patterns\nwithout making model calls. Incremental and per-commit reviews scope unfiltered path checks to the active incremental\nfile set unless `require_merge_recommendation` is enabled. Findings are rendered as a dedicated row in the review table:\n\n```\n⚠️ Risk checks: 3 finding(s) detected\nSensitive paths (1): .github/workflows/deploy.yml\nRisky shapes (1): `Privilege revocation` in db/migrations/002_revoke.sql\nDeleted files (1): old_auth.py\n```\n\nWhen no findings are detected, the row is omitted completely so clean reviews stay uncluttered.\n\n**Checks performed.**\n\n- **Sensitive paths**: Flags changes to files matching glob patterns in `sensitive_paths`. By default, this covers\n  CI/CD pipelines and local composite actions, package manager manifests and lockfiles, Dockerfiles, Terraform and\n  infrastructure configs, and database migrations.\n- **Risky change shapes**: Scans added and removed lines in diff hunks for destructive SQL (`DROP TABLE`, `ALTER ... RENAME`,\n  `REVOKE ... ON/FROM`, `TRUNCATE`), authentication and secrets keywords, cache invalidations, and any custom patterns\n  configured in `extra_risky_shapes`. Removed lines are also checked for removed function signatures (Python, JS/TS, Go,\n  Rust) and, in `.toml`, `.yaml`, `.yml`, `.json`, `.ini` and `.env` files, removed configuration defaults. Changes to\n  prompt files (`*prompt*.toml`, `*prompt*.yaml`, or files under a `*prompts*/` directory) are flagged as well.\n- **Deleted files**: Flags removed files.\n\n**Custom patterns.** Additional regular expressions can be configured via `extra_risky_shapes`. Because regex execution\nhas security implications, `extra_risky_shapes` must be configured through host configuration (such as environment\nvariables or host settings) and cannot be overridden by repository `.pr_agent.toml` files. Each search with a custom\npattern has a 50 ms limit, and each custom pattern has 1 s in total per review. If a pattern exceeds either one,\nPR-Agent logs a warning and skips that pattern for the rest of the review.\n\n:::\n\n### Merge recommendation\n\nWhen `require_merge_recommendation` is enabled, PR-Agent computes the published verdict from deterministic checks.\nThe model can only make the verdict more cautious: it can lower a clean verdict, or raise `needs_review` to\n`changes_required`, but it cannot override a failed deterministic check.\n\n**Checks and sources**\n\n- `CI on reviewed head` (deterministic): requires passing CI for the reviewed head. Unavailable CI status fails\n  closed.\n- `Head is current with its base` (deterministic): requires the reviewed head to be current with its base for\n  reviewed files. Unavailable staleness status fails closed.\n- `Human authors` (deterministic): requires all authors to be human. Bot/unlinked or unavailable author data fails\n  closed.\n- `No sensitive paths or risky changes` (deterministic): requires no findings from deterministic risk checks\n  (`sensitive_paths`, risky diff shapes, deleted files). Unavailable risk-check data fails closed.\n- `Changed lines within cap` (deterministic): requires total added/removed lines within\n  `pr_reviewer.max_changed_lines`. Unavailable line counts fail closed.\n- `Model merge recommendation` (model, veto only): if the model returns `needs_review` or `changes_required`, the\n  verdict cannot be `no_concerns_found`.\n- `Model risk level` (model, veto only): if the model returns `medium` or `high` risk, the verdict cannot be\n  `no_concerns_found`.\n\n`no_concerns_found` requires all deterministic checks to pass and no model veto. If any deterministic check cannot be\nevaluated, the verdict fails closed. The review includes each check and its result.\n\n**Configuration and status publishing**\n\n- `pr_reviewer.sensitive_paths`: glob patterns for files treated as sensitive by deterministic risk checks.\n  Host-only.\n- `pr_reviewer.max_changed_lines`: host-only changed-line cap for `no_concerns_found`. Counts added and removed\n  lines.\n- `pr_reviewer.extra_risky_shapes`: host-only custom regex patterns scanned in added and removed diff lines.\n- `publish_merge_recommendation_status`: publishes the verdict for the exact reviewed head SHA. GitHub uses the\n  `PR Agent - Review` check run; GitLab uses a commit status.\n\n`needs_review` publishes as neutral on GitHub and skipped on GitLab, so it does not block merges by itself.\n`changes_required` publishes as failure/failed and blocks merges when that status is required. To require it, add\n`PR Agent - Review` as a required status/check in your GitHub branch protection rule or ruleset, or require the\nPR-Agent commit status in your GitLab project's merge rules. A new commit has no PR-Agent verdict status until it is\nreviewed.\n\nThe verdict scans the complete PR diff, including ignored paths and files already reviewed by an incremental review.\nIf the full diff or a trustworthy CI timestamp is unavailable, the verdict cannot be `no_concerns_found`.\n\n### Gated auto-approval\n\n:::warning\n\nOff by default and host-only (`config.enable_auto_approval`). An approval counts toward a protected branch's\nrequired reviews, so enable it only where an automated approval of small, clean changes is acceptable. PR-Agent\nnever merges.\n\n:::\n\nWhen the host sets `config.enable_auto_approval` (for example `CONFIG__ENABLE_AUTO_APPROVAL=true`), `/review` on\nGitHub and GitLab approves the exact commit it reviewed only when all of these hold:\n\n- the computed merge recommendation is `no_concerns_found`;\n- the model returned both a merge recommendation and a risk level, so `require_merge_recommendation` and\n  `require_risk_assessment` must be enabled;\n- the review covered the whole pull request: not an incremental review, no file left out by the ignore rules or the\n  file-type filter, no file left out or cut short to fit the model's context, and no part of the diff failed;\n- the review completed and its finding state could be updated.\n\nEach `/review` run withdraws the approval PR-Agent gave when it starts, and approves again only when it ends with all\nof these holding, so a run that fails or finds a concern leaves no approval behind. On a push, the GitHub App, the\nGitHub Action, and the GitLab webhook dismiss it before any other event filter runs. A change of base branch also\ndismisses it, and on GitHub so does a reopen. On GitHub, PR-Agent only dismisses approvals it gave automatically;\nmanual approvals from the same account are left alone. On GitLab, an approval belongs to the token's account, so use\nan account reserved for PR-Agent. With `publish_output` off, nothing is approved or dismissed.\n\n`enable_auto_approval` is host-only: a repository `.pr_agent.toml` or a comment argument cannot turn it on.\n\n**Required repository settings.**\n\n- On GitHub, turn on \"Dismiss stale pull request approvals when new commits are pushed\" in the branch protection\n  rule or ruleset. PR-Agent can miss a push (a failed webhook delivery, a polling deployment, or a workflow that\n  does not listen to `synchronize`), and GitHub only removes a stale approval itself when this is on.\n- On GitLab, enable merge request approvals for the project and keep approvals reset on push in the project's\n  approval settings, so a missed webhook does not leave a stale approval behind.\n- For the GitHub Action, allow \"GitHub Actions to create and approve pull requests\" in the repository's Actions\n  settings. Pull requests from forks get a read-only token, so they cannot be approved.\n- If the rule restricts who can dismiss reviews, include PR-Agent's account; otherwise it cannot withdraw its own\n  approval, and only logs an error.\n\nGitHub does not let an account approve a pull request it opened. GitLab can also reject approval by the merge\nrequest author according to the project's approval settings. Other git providers are not supported yet.\n\n**Suggested rollout**\n\n1. Enable `require_merge_recommendation`, `require_risk_assessment`, and `publish_merge_recommendation_status` on\n   the host. Tune `sensitive_paths` and `max_changed_lines` as needed.\n2. Require the published verdict status in branch protection or merge rules, and verify verdicts on representative\n   PRs.\n3. Enable `config.enable_auto_approval` for a limited scope first (or a pilot environment), confirm approvals are\n   dismissed on push/base changes, and monitor outcomes.\n4. Expand gradually once the behavior matches your repository's review policy. Keep PR-Agent's account permissions\n   and stale-approval settings in place.\n","docs/docs/commands/similar_issues.md":"---\ntitle: \"Similar Issues\"\nsidebar_position: 8\n---\n\n## Overview\n\n> **Note**: `/similar_issue` is an **experimental** feature. It works only on GitHub, carries a disproportionately large share of the project's dependency and configuration surface for a single-provider command, and is therefore excluded from the v1 stability guarantees. No backend is tested against its real driver.\n\nThe similar issue command retrieves the most similar issues to the current issue.\nIt is an issue-scoped command: comment `/similar_issue` on the issue (served by the GitHub Action; the GitHub App webhook only dispatches comments on pull requests), or run it from the CLI with `--issue_url`:\n\n```\n/similar_issue\n```\n\n## Example usage\n\n<img src=\"/img/similar_issue_original_issue.png\" alt=\"similar_issue_original_issue\" width=\"768\" />\n\n<img src=\"/img/similar_issue_comment.png\" alt=\"similar_issue_comment\" width=\"768\" />\n\n<img src=\"/img/similar_issue.png\" alt=\"similar_issue\" width=\"768\" />\n\n### Indexing and re-runs\n\nTo perform retrieval, the `similar_issue` command indexes the repository's issues in the configured vector database. On every backend:\n\n- The **first run** indexes up to `max_issues_to_scan` issues (default `500`).\n- **Later runs** check the newest `max_issues_to_scan` issues and index any that are missing, so previously-indexed issues are not re-embedded.\n- `force_update_dataset = true` makes every run re-index up to `max_issues_to_scan` issues: LanceDB replaces the repository's rows, Pinecone and Qdrant upsert over the existing rows.\n- `skip_comments = true` skips issue comments and embeds only the issue title and body.\n\nEmbedding inputs are limited to **8,191 tokens** (one token below the model's\n8,192-token context). Issues or comments exceeding this limit are skipped during\nindexing; an oversized issue also excludes its comments. Long similarity queries\nare truncated to their first 8,191 tokens, so later content does not influence\nthe results.\n\nThese keys live under the `[pr_similar_issue]` section. Each backend section below describes its own configuration and re-run behaviour.\n\nIf the embedding service rejects the credentials (HTTP 401) or denies access (HTTP 403), indexing stops immediately on every vector database backend.\nCorrect the embedding API key or access permissions before running the command again; other embedding errors retain the existing batch and per-item fallback behavior.\n\n### Selecting a Vector Database\n\nConfigure your preferred database by setting the `vectordb` parameter under `[pr_similar_issue]` in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"lancedb\"  # options: \"pinecone\", \"lancedb\", \"qdrant\"\n```\n\n#### Available Options\n\nChoose from the following Vector Databases:\n\n1. LanceDB\n2. Pinecone\n3. Qdrant\n\n#### LanceDB Configuration\n\nLanceDB is the default backend (`vectordb = \"lancedb\"`) and needs no external credentials. The index is stored in a local directory given by the `[lancedb] uri` key (default `./lancedb`). A single table (`codium-ai-pr-agent-issues`) is shared by every repository indexed into the same directory; rows are tagged with the repository name in the metadata.\n\nAs described in [Indexing and re-runs](#indexing-and-re-runs), the first run creates the table and indexes up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` replaces the repository's rows with a fresh index of up to `max_issues_to_scan` issues.\n\n#### Pinecone Configuration\n\nTo use Pinecone with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[pinecone]\napi_key = \"...\"\ncloud = \"aws\"\nregion = \"us-east-1\"\n```\n\nThe `cloud` value must be one of `aws`, `gcp` or `azure`, and `region` must be an\navailability region offered by that cloud. These parameters can be obtained by\nregistering to [Pinecone](https://app.pinecone.io/?sessionType=signup/). Note that the\ncommand uses Pinecone's serverless index API; the former `environment` setting from the\ngcp-starter pod tier is no longer supported.\n\n`cloud` and `region` are only used when the index does not exist yet and needs to be\ncreated. An existing index is opened by name and is never recreated, so moving an\nexisting deployment to the new configuration does not lose the stored vectors.\n\nOn re-runs, the first run creates the index and upserts up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[No backend is tested against its real driver]\n\nThe `similar-issue` dependency group is not installed in CI, so the pinecone tests run\nagainst a faked module, the qdrant tests never construct a client, and the lancedb tests\nrun against a fake table.\n:::\n\n:::note[Default vector database]\n\n`vectordb` defaults to `lancedb`, which works with no external credentials. To use\nqdrant or pinecone, set `vectordb = \"qdrant\"` or `vectordb = \"pinecone\"` under\n`[pr_similar_issue]`.\n:::\n\n#### Qdrant Configuration\n\nTo use Qdrant with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[qdrant]\nurl = \"https://YOUR-QDRANT-URL\" # e.g., https://xxxxxxxx-xxxxxxxx.eu-central-1-0.aws.cloud.qdrant.io\napi_key = \"...\"\n```\n\nThen select Qdrant in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"qdrant\"\n```\n\nYou can get a free managed Qdrant instance from [Qdrant Cloud](https://cloud.qdrant.io/).\n\n`api_key` must be present even when the server does not enforce authentication (an empty string is accepted): the command reads both `url` and `api_key` and raises when either is absent. A re-index uploads the records from up to `max_issues_to_scan` issues.\n\nQdrant points are stored in a collection named `codium-ai-pr-agent-issues-v2`, derived by appending a `-v2` suffix to the shared index name (`codium-ai-pr-agent-issues`). The suffix is an implementation detail of the Qdrant backend only; pinecone and lancedb use the unsuffixed name.\n\nOn re-runs, the first run creates the collection and stores up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[Upgrading an index created before the point-id fix]\n\nEarlier versions derived the point id from the issue id alone, so the same issue number collided\nacross repositories. The id is now seeded with the repository name, which means points written by\nan earlier version are never rewritten or deleted - they still carry a matching `metadata.repo`\npayload, so they stay queryable and can surface alongside their replacements.\n\nThe `-v2` collection suffix sidesteps this: the new index is written to\n`codium-ai-pr-agent-issues-v2`, leaving the pre-existing `codium-ai-pr-agent-issues` collection\nuntouched. Nothing is deleted, and the first run after the upgrade re-indexes the repository into\nthe new collection. Once you are satisfied with the results, you can delete the old\n`codium-ai-pr-agent-issues` collection from Qdrant by hand to reclaim the storage.\n:::\n\n## How to use\n\n- Install the command's extra dependencies (vector databases and datasets), which a bare `uv sync` does not include:\n`uv sync --group similar-issue`\n\n- To invoke the 'similar issue' command from **CLI**, run:\n`uv run pr-agent --issue_url=... similar_issue`\n\n- To invoke the 'similar' issue command via online usage, [comment](https://github.com/the-pr-agent/pr-agent/issues/178#issuecomment-1716934893) on an issue:\n`/similar_issue`\n\n- To run automatically when an issue is opened, create a GitHub Actions workflow for the `issues: opened` event that invokes the CLI with that issue's URL. Adding `/similar_issue` to `github_app.pr_commands` does not handle issue-opened events.\n\n  With the default LanceDB backend, restore the configured `[lancedb] uri` directory (default `./lancedb`, relative to the CLI working directory) before running the CLI and save the updated directory afterward, or use a persistent remote Qdrant or Pinecone backend. On ephemeral hosted runners, an unpreserved local index is rebuilt on each run, repeating embedding costs for up to `max_issues_to_scan` issues (default `500`) and leaving previously indexed issues outside that batch unavailable for retrieval.\n","docs/docs/commands/update_changelog.md":"---\ntitle: \"Update Changelog\"\nsidebar_position: 11\n---\n\n## Overview\n\nThe `update_changelog` command automatically updates a Markdown changelog with the PR changes.\nIt uses `CHANGELOG.md` at the repository root by default; `pr_update_changelog.changelog_path` selects a different file.\nIt can be invoked manually by commenting on any PR:\n\n```\n/update_changelog\n```\n\nEmpty or fence-only model responses are retried with the configured fallback models. If no model returns usable content, the command stops without writing to the changelog or publishing an update comment.\n\nHost operators can also opt in to forwarding the newly generated entry to the existing\n[push outputs](../usage-guide/push_outputs.md) destinations by selecting `update_changelog` in\n`push_outputs.commands`. These notifications contain a draft, not confirmation of a repository write.\n\n## Example usage\n\n<img src=\"/img/update_changelog_comment.png\" alt=\"update_changelog_comment\" width=\"768\" />\n\n<img src=\"/img/update_changelog.png\" alt=\"update_changelog\" width=\"768\" />\n\n## Configuration options\n\nUnder the section `pr_update_changelog`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'update changelog' command:\n\n- `changelog_path`: repository-relative path to the Markdown changelog, such as `HISTORY.md` or `docs/CHANGELOG.md`. Default is `CHANGELOG.md`. Set it in the root `.pr_agent.toml` or host configuration; comment/CLI arguments and per-directory settings cannot override it.\n- `push_changelog_changes`: whether to push the changes to the selected changelog, or just publish them as a comment. Default is false (publish as comment). Before pushing, the command requires a confirmed read of that file; a confirmed missing file is treated as empty, while other read failures skip the repository write, attempt to publish a not-pushed fallback comment, and surface the original error. If the repository write itself fails, the command makes one best-effort attempt to publish the generated changelog as a fallback and surfaces the original write error. Because a transport failure may happen after a completed remote write, this fallback reports the repository update as unconfirmed rather than promising it was not pushed.\n- `extra_instructions`: Optional extra instructions to the command. For example: \"Use the following structure: ...\"\n- `add_pr_link`: whether the model should try to add a link to the PR in the changelog. Default is true.\n- `skip_ci_on_push`: whether the commit message (when `push_changelog_changes` is true) will include the term \"[skip ci]\", preventing CI tests to be triggered on the changelog commit. Default is true.\n\n### Custom changelog location\n\nFor a changelog stored under `docs/`, add this to the repository's root `.pr_agent.toml`:\n\n```toml\n[pr_update_changelog]\nchangelog_path = \"docs/CHANGELOG.md\"\n```\n\nThen invoke `/update_changelog` as usual. The command reads that file to follow its existing structure and,\nwhen `push_changelog_changes` is enabled, prepends the new entry to the same file on the PR branch.\nComment-only output also uses the selected file as context and names it in the commit instructions.\n\nThe path must be a non-empty repository-relative file path using `/` separators, without empty,\n`.` or `..` components, Windows drive prefixes, backslashes, or control characters. Invalid values stop\nthe command before reading repository content. Spaces and Unicode names are accepted and kept exactly as written. The command updates\none Markdown changelog per command; it does not discover files, expand globs, or select a file per package.\nThe filename need not end in `.md`, but the generated content remains Markdown.\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# Repository Guidelines\n\nThis file is the shared source of repository guidance for coding agents. Tool-specific instruction files should import it instead of repeating repository-wide rules.\n\n## Dos and Don’ts\n\n- **Do** match the interpreter requirement declared in `pyproject.toml` (Python ≥ 3.12) and install dependencies with `uv sync` (runtime + dev, from `uv.lock`) before running tools.\n- **Do** run tests with `PYTHONPATH=.` set to keep imports functional (for example `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`).\n- **Do** adjust configuration through `.pr_agent.toml` or files under `pr_agent/settings/` instead of hard-coding values.\n- **Don’t** commit secrets or access tokens; rely on environment variables as shown in the health and e2e tests.\n- **Don’t** reformat or reorder files globally; match existing 120-character lines, import ordering, and docstring style.\n- **Don’t** delete or rename configuration, prompt, or workflow files without maintainer approval.\n\n## Project Structure and Module Organization\n\nPR-Agent automates AI-assisted reviews for pull requests across multiple git providers.\n\n- `pr_agent/agent/` orchestrates commands (`review`, `describe`, `improve`, etc.) via `pr_agent/agent/pr_agent.py`.\n- `pr_agent/commands/` implements individual capabilities such as reviewers, code suggestions, docs updates, and label generation.\n- `pr_agent/algo/` contains shared algorithms, model handlers, prompt/token handling, types, and utilities.\n- `pr_agent/git_providers/` handles integrations with GitHub, GitLab, Bitbucket (cloud and server), Azure DevOps, Gitea, Gerrit, CodeCommit, local checkouts, and plain diffs; `pr_agent/identity_providers/` handles identity and `pr_agent/secret_providers/` handles secrets.\n- `pr_agent/settings/` stores Dynaconf defaults (prompts, configuration templates, ignore lists) respected at runtime; `.pr_agent.toml` overrides repository-level behavior.\n- `pr_agent/servers/` contains webhook and service entrypoints.\n- `tests/unittest/`, `tests/e2e_tests/`, and `tests/health_test/` contain pytest-based unit, end-to-end, and smoke checks.\n- `docs/` holds the Docusaurus site (`docs/docusaurus.config.js` and `docs/sidebars.js` plus content under `docs/docs/`); theme overrides live in `docs/src/` and static assets in `docs/static/`.\n- `.github/workflows/` defines CI pipelines for unit tests, coverage, docs deployment, pre-commit, and PR-agent self-review.\n- `docker/` provides build targets for services (`github_app`, `gitlab_webhook`, etc.) and the `test` stage used in CI; the root `Dockerfile.github_action_dockerhub` only wraps the published `github_action` image for `action.yaml`.\n\n## Architecture and Request Flow\n\nPR-Agent is a CLI/server that runs AI-powered commands (`/review`, `/describe`, `/improve`, `/ask`, etc.) against pull requests on supported git providers or local input. The main dispatch flow is `pr_agent/agent/pr_agent.py` → `command2class` → a command class under `pr_agent/commands/`.\n\nA command generally obtains the appropriate git provider, gathers pull-request context, prepares prompt variables and templates, calls the configured model handler, and publishes or stores the result through the provider.\n\n### Prompt Building\n\nPrompt-driven commands generally construct a `self.vars` dictionary and pass it with the system/user prompt strings to `TokenHandler`. Prompt rendering uses Jinja2 with `StrictUndefined`, so variables referenced by a template should be present in the corresponding vars dictionary; define optional values explicitly and guard optional sections with Jinja conditionals.\n\nSystem/user prompt strings live as TOML files under `pr_agent/settings/` and are loaded into `global_settings` by `pr_agent/config_loader.py`. Command and prompt names normally correspond, for example:\n\n- `pr_reviewer.py` ↔ `pr_reviewer_prompts.toml`\n- `pr_description.py` ↔ `pr_description_prompts.toml`\n- `pr_questions.py` ↔ `pr_questions_prompts.toml`\n\nNew prompt files must also be registered in the `settings_files=[...]` list in `pr_agent/config_loader.py` or they will not be loaded into `global_settings`.\n\n### Settings and Runtime Configuration\n\nUse `get_settings()` from `pr_agent/config_loader.py` as the shared settings accessor. It returns the request-scoped Dynaconf object from `starlette_context` when one is present, otherwise the module-level `global_settings` object.\n\nDefaults live in `pr_agent/settings/configuration.toml`. Per-repository overrides come from the repository's `.pr_agent.toml` and are applied by `pr_agent/git_providers/utils.py::apply_repo_settings` before command dispatch. When introducing a configuration section, add its defaults and comments to `configuration.toml` and keep related prompt/config changes synchronized.\n\nWhen a key's detail belongs in a docs page, keep its `configuration.toml` comment to one line under 160 characters that states what the key does and its allowed values, then point to that page.\n\n`docs/docs/usage-guide/configuration_reference.md` is generated from `configuration.toml` by `python scripts/generate_config_reference.py [output_path]` (run from the repository root), and its header says not to edit it by hand. Write the output to a temporary path and diff it against the page before replacing anything. `tests/unittest/test_config_reference.py` checks that the page matches the generator output, lists exactly the active keys, and asserts a hard-coded active-key count, so update that count when adding or removing keys.\n\nRepository overrides are filtered by `pr_agent/config_security.py`; host-only keys must be supplied through host configuration. Configuration file merges preserve other fields in a section but replace overlapping list/dict values rather than appending or deep-merging; environment variables take precedence.\n\nSensitive values should stay in environment variables or the gitignored `.secrets.toml` files under `pr_agent/settings/` and `pr_agent/settings_prod/`. `apply_secrets_manager_config()` optionally loads values from AWS Secrets Manager.\n\n### Git Providers\n\n`pr_agent/git_providers/` contains provider implementations that share the `GitProvider` interface in `pr_agent/git_providers/git_provider.py`. Provider-dependent behavior should be selected through capability checks such as `provider.is_supported(\"feature\")` rather than concrete provider-type checks, because individual providers can stub or override capabilities. Some output is gated this way too: semantic file types and several other `/describe` sections are only emitted where `gfm_markdown` is supported.\n\n### Servers and Entrypoints\n\n`pr_agent/servers/` hosts webhook and service entrypoints that translate provider events into `PRAgent.handle_request(...)` calls. The CLI entrypoint is `pr_agent/cli.py`, registered as the `pr-agent` console script.\n\n## Build, Test, and Development Commands\n\n- Install dependencies (runtime + dev) into a project virtualenv from the lockfile with `uv sync` using a uv version that satisfies `tool.uv.required-version` in `pyproject.toml`; `uv run` auto-syncs before each command.\n- Run a single unit test (verified): `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`.\n- Run the full unit suite: `PYTHONPATH=. uv run pytest tests/unittest -v`.\n- CI also runs `uv run pytest -q tests/packaging/test_help_docs_package.py`; it is outside `testpaths`, so the unit suite does not cover it. The distribution-contract test checks that the installed uv version satisfies `tool.uv.required-version` in `pyproject.toml`.\n- Execute the CLI locally once dependencies and API keys are available: `uv run pr-agent --pr_url <https://host/org/repo/pull/123> review`.\n- Build the test Docker target mirror of CI when containerizing: `docker build -f docker/Dockerfile --target test .` (loads dev dependencies and copies `tests/`).\n- Build the documentation the same way CI does (Node.js 22): `npm ci` then `npm run build` from `docs/`; `npm start` serves a live preview. After building, run `python3 scripts/check_docs_urls.py` from the repository root to check `docs/build` as CI does. The `docs-ci` workflow publishes `docs/build` to GitHub Pages.\n\n## Coding Style and Existing Tooling\n\nRuff is the single linting tool: `pyproject.toml` configures it and the pre-commit Ruff hook enforces it (Flake8 and the standalone isort hook have been removed).\n\n- Keep Python lines within the 120-character limit declared in `pyproject.toml`.\n- `pyproject.toml` configures Ruff rules `E`, `F`, `B`, `I`, `UP`, `FURB`,  `PERF` and `PLE`. Within the files touched by the task, fix lint violations rather than adding ignore entries. Remove corresponding ignore entries only when they are no longer needed, and preserve intentional exceptions.\n- Before committing, run `uv run ruff check --fix <paths>` on the Python files you touched and fix every issue it reports. Keep fixes mechanical (rename, remove unused imports, sort imports); do not alter program logic while cleaning up — if a lint fix would change behavior, surface it instead of applying it silently.\n- `.pre-commit-config.yaml` is the source of truth for enabled pre-commit hooks. Run them on the files you touched with `uvx pre-commit run --files <paths>` and review the automatic edits so unrelated changes are not included. The pre-commit GitHub Actions workflow runs on pull requests, so the hooks are enforced in CI.\n- No general-purpose Python formatter is currently enforced (`ruff format` is deliberately not adopted yet). Preserve the surrounding file's formatting and avoid unrelated rewrites or repository-wide formatting.\n- Prefer double quotes for Python strings where consistent with the surrounding file.\n- Match existing docstring and comment style—concise English comments using imperative phrasing only where necessary.\n- Configuration files in `pr_agent/settings/` are TOML; preserve formatting, section order, and comments when editing prompts or defaults.\n- Markdown in `docs/` uses Docusaurus conventions: every page starts with YAML front matter (`title`, `sidebar_position`), admonitions use `:::note` fences, collapsible sections use `<details>`, and images live in `docs/static/img/` referenced as `/img/<file>`. Pages stay `.md` (CommonMark) unless they need a JSX component, in which case they are `.mdx`. Register every new page in `docs/sidebars.js`.\n\n## Testing Guidelines\n\n- Pytest is the standard framework; keep new tests under the closest matching directory (`tests/unittest/` for unit logic, `tests/e2e_tests/` for integration flows, `tests/health_test/` for smoke coverage).\n- Pytest configuration lives in `pyproject.toml`, including `asyncio_mode = \"auto\"` and `testpaths = [\"tests/unittest\"]`. The Docker test image keeps `pyproject.toml` at `/app` (uv installs from it), so CI inherits these settings as well. Plain `PYTHONPATH=. uv run pytest` therefore defaults to the unit suite; invoke end-to-end tests explicitly.\n- Prefer focused unit tests that isolate helpers in `pr_agent/algo/`, `pr_agent/commands/`, or provider adapters; use parameterized tests where existing files already do so.\n- Set `PYTHONPATH=.` when invoking pytest from the repository root to avoid import errors.\n- End-to-end suites require provider credentials and may take several minutes; `TOKEN_GITHUB`, `TOKEN_GITLAB`, `BITBUCKET_USERNAME`, and `BITBUCKET_PASSWORD` are CI secret names, not runtime environment variables (see the mappings in `.github/workflows/e2e_tests.yaml`). These tests create remote branches and pull/merge requests and expect deployed apps/webhooks to process them; run them only when credentials and sandboxes are configured.\n- `tests/health_test/main.py` is a manual script for `/describe`, `/review`, and `/improve`; it asserts artifact headers inline, not checked-in artifact files. Update those inline assertions if prompts change meaningfully. CI provider smoke runs `tests/health_test/test_github_smoke.py` instead (`/describe` only, model stubbed, `GITHUB.USER_TOKEN`).\n\n## Review Checklist\n\n- A setting can arrive as a TOML list, a plain string, or an environment value that Dynaconf parses as TOML (`SECTION__KEY=123` arrives as an int). Code that reads it handles each form.\n- A fix in one git provider, AI handler or server usually applies to its siblings. Check the same logic in the others and fix them or name them in the PR.\n- New or changed regexes run in linear time: no nested or adjacent unbounded quantifiers that can match the same characters, and no unbounded leading quantifier in an unanchored search. User-supplied patterns and globs get a length cap before they are compiled or translated.\n- Docs and config comments describe what the branch does. A PR that changes a default or a setting's behavior updates the `configuration.toml` comment and the docs page that state it, and none documents behavior from another PR.\n\n## Commit and Pull Request Guidelines\n\n- Follow `CONTRIBUTING.md`: keep changes focused, add or update tests, and use Conventional Commit-style messages (e.g., `fix: handle missing repo settings gracefully`).\n- Target branch names follow `feature/<name>` or `fix/<issue>` patterns for substantial work.\n- Reference related issues and update README or docs when user-facing behavior shifts.\n- Before requesting review, run the relevant local checks above and make sure the corresponding CI workflows (`build-and-test`, `pre-commit`) pass; coverage is collected and uploaded by `build-and-test` except on docs-page-only PRs, which run packaging and documentation checks instead; `docs-ci` builds the documentation on every pull request that touches `docs/**` (publishing only on pushes to `main` and `add-docs-portal`). That build fails on broken links and anchors, and also runs `scripts/check_docs_urls.py` to confirm the documentation URLs hardcoded in `pr_agent/` and the README still resolve.\n- Include screenshots or terminal captures when modifying user-visible output or documentation previews.\n\n## Safety and Permissions\n\n- Ask for confirmation before adding dependencies, renaming files, or changing workflow definitions; many consumers embed these paths and prompts.\n- Stay within existing formatting and directory conventions—avoid mass refactors, re-sorting of prompts, or reformatting Markdown beyond the touched sections.\n- You may read files, list directories, and run targeted lint/test/doc commands without prior approval; coordinate before launching full Docker builds or e2e suites that rely on external credentials.\n- Never commit cached credentials, API keys, or coverage artifacts; CI already handles secrets through GitHub Actions.\n- Treat prompt and configuration files as single sources of truth—keep related defaults and prompts under `pr_agent/settings/` synchronized when behavior changes. The root `.pr_agent.toml` is intended for this repository's hosted Qodo reviews, not as a mirror of the packaged defaults; some entries have no open-source implementation.\n\n## Security and Configuration Tips\n\n- Secrets should be supplied through environment variables (see usages in `tests/e2e_tests/test_github_app.py` and `tests/health_test/main.py`); do not persist them in code or configuration files.\n- Adjust runtime behavior by overriding keys in `.pr_agent.toml` or by supplying repository-specific Dynaconf files; keep overrides minimal and documented inside the PR description.\n- Review `SECURITY.md` before disclosing vulnerabilities and follow its contact instructions for responsible reporting.\n","isInternal":false,"tokens":3341,"sizeBytes":15518},{"name":"add_docs.md","path":"docs/docs/commands/add_docs.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/add_docs.md","title":"Command: /add_docs","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Add Docs\"\nsidebar_position: 6\n---\n\n## Overview\n\nThe `add_docs` command scans the PR code changes and suggests documentation for any code components that are missing documentation, such as functions, classes, and methods.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/add_docs\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/add_docs` on any PR:\n\n<img src=\"/img/add_docs_comment.png\" alt=\"Add Docs\" width=\"512\" />\n\nThe command will generate documentation suggestions as inline code suggestions.\n\n### Language-specific documentation styles\n\nThe command automatically detects the programming language and generates documentation in the appropriate format:\n\n| Language | Documentation Format |\n|----------|---------------------|\n| Python | Docstrings (Sphinx, Google, Numpy styles) |\n| Java | Javadocs |\n| JavaScript/TypeScript | JSdocs |\n| C++ | Doxygen |\n| Other | Generic documentation |\n\n## Configuration options\n\nUnder the section `[pr_add_docs]`, the following options are available:\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `extra_instructions` | string | `\"\"` | Additional instructions for the AI model |\n| `docs_style` | string | `\"Sphinx\"` | Documentation style for Python. Options: `\"Sphinx\"`, `\"Google Style with Args, Returns, Attributes...etc\"`, `\"Numpy Style\"`, `\"PEP257\"`, `\"reStructuredText\"` |\n| `use_repo_context` | boolean | `true` | Apply conventions from configured repository instruction files (for example `AGENTS.md`); set to `false` to opt out |\n\n### Example configuration\n\nTo customize the documentation style, add the following to your configuration file:\n\n```toml\n[pr_add_docs]\ndocs_style = \"Google Style with Args, Returns, Attributes...etc\"\nextra_instructions = \"Focus on documenting public methods and include usage examples\"\n```\n\nBy default, `/add_docs` follows the shared `config.repo_context_files` selection (`[\"AGENTS.md\"]` by default,\nread from the repository default branch). To disable repository instructions for `/add_docs` only:\n\n```toml\n[pr_add_docs]\nuse_repo_context = false\n```\n\nStructured sibling-repository entries in `config.repo_context_files` are excluded from `/add_docs` to avoid publishing private sibling guidance in PR suggestions. Local repository entries remain in effect.\n\nSetting `config.repo_context_files = []` disables repository instructions across commands. Repository instructions\nare optional prompt context: if they do not fit the selected model's input budget, they are omitted without shortening\nthe PR diff. Explicit `extra_instructions` and `docs_style` take precedence. Repository instructions may add file\nreads and prompt tokens, but do not introduce another model call.\nRepository instructions are appended to the rendered system prompt, including with custom `[pr_add_docs_prompt]`\ntemplates. Existing template variables and diff rendering are left unchanged.\n\n### Command line options\n\nYou can pass configuration options directly in the command:\n\n```\n/add_docs --pr_add_docs.docs_style=\"Numpy Style\"\n```\n\n## How it works\n\n1. The command analyzes the PR diff to identify code components (functions, classes, methods) that lack documentation\n2. It uses AI to generate appropriate documentation based on the code context and language\n3. Documentation suggestions are published as inline code suggestions that can be applied with a single click\n\n### Model response failures\n\nEach model response is validated before it is accepted. Missing content or an\ninvalid documentation structure triggers the next model in `CONFIG.FALLBACK_MODELS`,\nif configured. An explicit empty list or `Code Documentation: null` is a valid\nempty result and does not trigger another model call.\n\nIf all model attempts fail, PR-Agent records the command as failed and removes\nthe temporary progress comment. With `CONFIG.PUBLISH_OUTPUT` enabled, it also\nattempts to post **Failed to generate code documentation for this PR.**\n\n### Publication failures\n\nSuggestions are skipped if their original source line cannot be reliably retained,\nincluding when file content is unavailable or incomplete. Valid suggestions in the\nsame response can still be published.\n\nWith `CONFIG.PUBLISH_OUTPUT` enabled, PR-Agent retries unsuccessful batch\npublication one suggestion at a time. If the batch and every individual retry\nexplicitly report failure, it attempts to post **Failed to publish code\ndocumentation for this PR.** and records the command as failed. Partial success\nor an unconfirmed provider result does not trigger this all-failed outcome.\n","frontmatter":{"title":"Add Docs","sidebar_position":6},"isInternal":false,"tokens":931,"sizeBytes":4573},{"name":"ask.md","path":"docs/docs/commands/ask.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/ask.md","title":"Command: /ask","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Ask\"\nsidebar_position: 5\n---\n\n## Overview\n\nThe `ask` command answers questions about the PR, based on the PR code changes. Make sure to be specific and clear in your questions.\nIt can be invoked manually by commenting on any PR:\n\n```\n/ask \"...\"\n```\n\n## CLI JSON output\n\nThe CLI can write a single JSON file containing the question, answer, and available token usage:\n\n```bash\npython -m pr_agent.cli --pr_url https://github.com/org/repo/pull/123 \\\n    --json-output answer.json ask \"What changed?\"\n```\n\nThis also works with `ask_question` and in [Plain Diff mode](../usage-guide/plain_diff_mode.md):\n\n```bash\ngit diff | python -m pr_agent.cli --stdin --json-output answer.json ask \"What changed?\"\n```\n\nPlace `--json-output` before the command. The file is overwritten for each invocation and has\n`question`, `answer`, and `usage` fields. `usage` is an empty object when token counts are unavailable,\nincluding when the command explains that no changed files could be analyzed without calling a model.\n\nFor PR URLs, setting `config.publish_output = false` in the host configuration suppresses PR\ncomments without suppressing the requested JSON file. The existing\n[push outputs](../usage-guide/push_outputs.md) feature serves a different purpose: it delivers\nopt-in Ask records to operator-configured sinks and requires publishing to be enabled.\n\n## Example usage\n\n<img src=\"/img/ask_comment.png\" alt=\"Ask Comment\" width=\"512\" />\n\n<img src=\"/img/ask.png\" alt=\"Ask\" width=\"512\" />\n\n## Repository instructions\n\nBoth top-level `/ask` and inline `/ask_line` can use the same repository instruction files as `/review`, `/describe`, and `/improve`.\nFor example, ask whether a migration follows the rollback rules in an existing architecture decision record:\n\n```toml\n[config]\nrepo_context_files = [\"AGENTS.md\", \"docs/adr/database-migrations.md\"]\n```\n\n```text\n/ask \"Does this migration follow our rollback and compatibility rules?\"\n```\n\nLike `/review`, `/describe`, and `/improve`, both Ask modes read `AGENTS.md` from the repository root by default.\nSet `config.repo_context_files = []` in the root repository settings to disable repository instructions for all commands.\nComment arguments cannot change the configured file list.\n\nThe existing [repository context settings](../usage-guide/additional_configurations.md#bringing-per-repo-context-files-to-pr-agent)\ncontrol file selection, source branches, imports, and line limits. Files come from the repository's default branch unless\nconfigured otherwise. Providers without repository file access skip this context; missing or empty files are also skipped.\n\nThe question, selected discussion history, and packed diff keep their existing token budget. The instruction block,\nalready bounded by `repo_context_max_lines`, is included only if it fits in the remaining model context in full.\nOtherwise, the corresponding Ask mode keeps its original prompt and adds a short omission notice to the answer. It does not retry another model\njust to fit instructions. Normal model retries reconsider the original instruction block without reading the files again.\nFor `/ask_line`, the selected lines, complete diff hunk, and fitted thread history likewise take precedence over\nrepository instructions. No instruction files are read when the requested diff hunk is unavailable.\nIncluding repository instructions can add repository API reads and input tokens, but does not add a separate model request.\n\n## Ask lines\n\nYou can run `/ask` on specific lines of code in the PR from the PR's diff view. The command will answer questions based on the code changes in the selected lines.\n\nFor line comments handled by the GitHub App, GitHub Actions, or GitLab webhook, `/ask_question` is an alias of `/ask`.\nStart the comment with `/ask`, `/ask_question`, or `/ask_line` after any leading whitespace;\nthese command names are case-insensitive. Other tokens such as `/asking` are not Ask commands.\nAzure DevOps accepts lowercase `/ask_question` for the same thread and line handling as `/ask`;\nits webhook command names remain case-sensitive.\n\n- Click on the '+' sign next to the line number to select the line.\n- To select multiple lines, click on the '+' sign of the first line and then hold and drag to select the rest of the lines.\n- write `/ask \"...\"` in the comment box and press `Add single comment` button.\n\n<img src=\"/img/Ask_line.png\" alt=\"Ask Line\" width=\"512\" />\n\nIf no matching diff hunk is found for the selected lines, the command explains this without calling a model.\n\nIn the GitHub App, GitHub Actions, and GitLab webhook, a file comment whose first non-whitespace token is `/ask` or\n`/ask_question` uses that file's complete diff as context. These two command names are case-insensitive.\nThe existing file filters and input budgets still apply. If the file has no analyzable diff, or the question cannot\nbe prepared within the configured input budget, the command explains this without calling a model.\nThe answer is posted in the original file-comment thread with a link to the question.\nEarlier replies are included when `pr_questions.use_conversation_history` is enabled and the input budget allows.\nText resembling command options is treated as part of the question.\n\nIn the Azure DevOps webhook, `/ask`, `/ask_question`, or a mention of PR-Agent in a thread on a whole file also uses\nthat file's complete diff, with the same filters, input budgets, and notes. The answer is posted in that thread with a\nlink to the question, and earlier comments in the thread are included as described above.\n\nWith `pr_questions.use_conversation_history=true` (the default), line questions on GitHub, GitLab, and Azure DevOps\ncan include earlier comments from the same thread. Azure DevOps also supports history for threaded top-level questions.\nOther questions are answered independently.\n\nOn GitLab, this reads the selected discussion before answering, adding an API request and potentially more model input\ntokens, but no separate model request. Set `pr_questions.use_conversation_history=false` to answer without earlier\ncomments. Line questions still require a matching hunk in the current diff.\n\n## Ask on images\n\nYou can also ask questions about images that appear in the comment, where the entire PR code will be used as context.\n<br>\nThe basic syntax is:\n\n```\n/ask \"...\"\n\n[Image](https://real_link_to_image)\n```\n\nwhere `https://real_link_to_image` is the direct link to the image.\n\nNote that GitHub has a built-in mechanism of pasting images in comments. However, pasted image does not provide a direct link.\nTo get a direct link to an image, we recommend using the following scheme:\n\n1. First, post a comment that contains **only** the image:\n\n   <img src=\"/img/ask_images1.png\" alt=\"Ask image1\" width=\"512\" />\n\n2. Quote reply to that comment:\n\n   <img src=\"/img/ask_images2.png\" alt=\"Ask image2\" width=\"512\" />\n\n3. In the screen opened, type the question below the image:\n\n   <img src=\"/img/ask_images3.png\" alt=\"Ask image3\" width=\"512\" />\n   <img src=\"/img/ask_images4.png\" alt=\"Ask image4\" width=\"512\" />\n\n4. Post the comment, and receive the answer:\n\n   <img src=\"/img/ask_images5.png\" alt=\"Ask image5\" width=\"512\" />\n\nSee a full video tutorial [here](https://www.qodo.ai/images/pr_agent/ask_image_video.mov)\n\n## Linked ticket context\n\nEnable linked ticket context when asking how a PR satisfies an issue's requirements or acceptance criteria:\n\n```toml\n[pr_questions]\nuse_ticket_context = true\n```\n\nSet this in host or root repository configuration. PR comment/CLI arguments and per-directory files\ncannot enable it because ticket integrations use the operator's credentials.\n\nThis is disabled by default and applies to top-level `/ask` and `ask_question`, not inline `/ask_line` questions.\nIt uses the same [ticket integrations](../core-abilities/fetching_ticket_context.md), credentials, reference formats,\naccess checks and fetch limits as `/review` and `/describe`. Tickets are discovered from the PR/MR metadata;\nlinks written only in the question are not additional ticket sources. This option is independent of\n`pr_reviewer.require_ticket_analysis_review`.\n\nTicket integrations use the operator's configured access policy, not the asker's personal ticket credentials.\nFor Jira, the host-controlled `jira.project_keys` allowlist still applies (`[]` disables lookups);\nconfigure only projects whose ticket content may appear in PR answers.\n\nTicket content is fetched once per command, after an analyzable diff fits. It adds API reads and input tokens\nwhen enabled and uses the existing model request. Unavailable tickets are skipped. Each model attempt includes only\nwhole ticket records that fit after the existing question, conversation history and selected diff, so ticket\ncontext does not displace code already selected for the answer. Large tickets may be omitted, including all\ntickets when there is no room. The usual diff-based answer remains available in that case.\n\n## Configuration options\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>ask_heading</b></td>\n    <td>\n      Plain-text heading for top-level <code>/ask</code> answers. The default is <code>Ask</code>.\n      Markdown renderers escape punctuation to keep the surrounding formatting and ❓ emoji fixed,\n      while plain-text converters publish the configured text without escape characters.\n      This does not affect <code>/ask_line</code> replies or the <code>Answer</code> section heading.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10. Instead, tell the user this type of question is not allowed.\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>use_conversation_history</b></td>\n    <td>If set to true, the command will use the conversation history from the same thread when answering questions on specific code lines (GitHub, GitLab, and Azure DevOps) or threaded top-level questions (Azure DevOps only). Default is true.</td>\n  </tr>\n  <tr>\n    <td><b>use_ticket_context</b></td>\n    <td>Include linked ticket content in top-level questions using the remaining prompt budget. Default is false. See <a href=\"#linked-ticket-context\">Linked ticket context</a>.</td>\n  </tr>\n</table>\n\n</details>\n\nExample usage in a configuration file:\n\n```toml\n[pr_questions]\nask_heading = \"Architecture Question\"\nextra_instructions = \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10.\"\n```\n\nThe heading above renders as `### **Architecture Question** ❓`.\n\nExample usage in a PR comment:\n\n```\n/ask \"What does this change do?\" --pr_questions.extra_instructions=\"Answer in one short paragraph.\"\n```\n","frontmatter":{"title":"Ask","sidebar_position":5},"isInternal":false,"tokens":2409,"sizeBytes":10869},{"name":"describe.md","path":"docs/docs/commands/describe.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/describe.md","title":"Command: /describe","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Describe\"\nsidebar_position: 2\n---\n\n## Overview\n\nGenerate a PR title, type, summary, code walkthrough and labels.\n\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or it can be invoked manually by commenting on any PR:\n\n```\n/describe\n```\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/describe` on any PR:\n\n<img src=\"/img/describe_comment.png\" alt=\"Describe comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a description for the PR:\n\n<img src=\"/img/describe_new.webp\" alt=\"Describe New\" width=\"512\" />\n\nWhile a large PR's chunks run, the temporary `Preparing PR description...` comment is rewritten in place, for example `Preparing PR description... analyzed 2 of 3 chunks`; once every chunk has settled, `, 1 chunk failed` is added if a chunk gave up. This needs `config.publish_output_progress` and a provider that can edit and remove comments; single-chunk runs keep the plain placeholder.\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/describe --pr_description.some_config1=... --pr_description.some_config2=...\n```\n\nFrom the CLI, save the generated description and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output describe.json describe\n```\n\nThe JSON file is written after the description is assembled. Place `--json-output` before `describe` or `describe_pr`; it works with `--pr_url` or with plain-diff input (`--stdin` or `--diff-file`).\n\n### Automatic triggering\n\nTo run the `describe` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/describe\",\n    ...\n]\n\n[pr_description]\npublish_labels = true\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_description]` section contains the configurations for the `describe` command you want to edit (if any).\n\n## File walkthrough summaries\n\nOn providers that support the HTML walkthrough, short file summaries appear on a new line after the filename.\nWhen detailed changes are available, expanding the file entry reveals them while the short summary stays visible when collapsed.\nGitLab descriptions no longer use description-list indentation for these summaries.\n\nThe description reader can extract file summaries from both the current and legacy walkthrough formats.\nIf separate PR-Agent installations generate walkthroughs and reuse their file summaries (for example, `/describe` and `/review`), upgrade them together; older readers cannot extract file summaries from the new format.\n\n## Preserving the original user description\n\nBy default, PR-Agent tries to preserve your original PR description by placing it above the generated content.\nThis requires including your description during the initial PR creation.\n\n\"PR-Agent removed the original description from the PR. Why\"?\n\nFrom our experience, there are two possible reasons:\n\n- If you edit the description _while_ the automated command is running, a race condition may occur, potentially causing your original description to be lost. Hence, create a description before launching the PR.\n\n- When _updating_ a description previously generated by PR-Agent, `/describe` preserves text after the first recognized `### **User description**` heading until the next recognized boundary heading, trimming surrounding whitespace and a trailing `___`. If no boundary heading follows, it stops at the first `___` substring, or at the end if none is present, and trims surrounding whitespace. If the generated description has no recognized `### **User description**` heading, add that heading before your manual text; otherwise that text can be lost on the next body update.\n\n  Boundary headings are lines starting with `### **PR type**`, `### **PR description**`, `### **PR labels**`, `### **Type**`, `### **Description**`, `### **Labels**`, or `### 🤖 Generated by PR Agent`, matched case-insensitively outside fenced code blocks. Manual headings with these prefixes also end preservation, even if more text follows the prefix. Keep manual edits inside these boundaries; edits to generated sections are replaced.\n\n<img src=\"/img/pr_description_user_description.png\" alt=\"Describe comment\" width=\"512\" />\n\n## Flowchart Support {#sequence-diagram-support}\nThe `/describe` command includes a Mermaid flowchart summarizing the main PR changes on providers that support `gfm_markdown`.\n\nThis option is enabled by default via the `pr_description.enable_pr_diagram` param.\n\nThe direction of the diagram adapts to its shape. A diagram whose longest chain of nodes exceeds `pr_description.pr_diagram_direction_threshold` is drawn top-down rather than left-to-right, so that wide diagrams are not scaled down until they become unreadable. Set `pr_description.pr_diagram_direction` to `LR` or `TD` to pin the direction instead.\n\n\n[//]: # (### How to enable\\disable)\n\n[//]: # ()\n[//]: # (In your configuration:)\n\n[//]: # ()\n[//]: # (```)\n\n[//]: # (toml)\n\n[//]: # ([pr_description])\n\n[//]: # (enable_pr_diagram = true)\n\n[//]: # (```)\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>Possible configurations</summary>\n\n<table>\n  <tr>\n    <td><b>publish_labels</b></td>\n    <td>If set to true, the command will publish labels to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment</b></td>\n    <td>If set to true, the command will publish the description as a comment to the PR. If false, it will overwrite the original description.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment_persistent</b></td>\n    <td>If set to true and `publish_description_as_comment` is true, the command will publish the description as a persistent comment to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>add_original_user_description</b></td>\n    <td>If set to true, the command will add the original user description to the generated description.</td>\n  </tr>\n  <tr>\n    <td><b>generate_ai_title</b></td>\n    <td>If set to true, the command will also generate an AI title for the PR.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_type</b></td>\n    <td>If set to false, it will not show the `PR type` as a text value in the description content.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_description</b></td>\n    <td>If set to false, the AI-generated summary section will not be requested from the model, nor shown in the description content. The other sections (diagram, changes walkthrough) are unaffected.</td>\n  </tr>\n  <tr>\n    <td><b>final_update_message</b></td>\n    <td>If set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/the-pr-agent/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`.</td>\n  </tr>\n  <tr>\n    <td><b>enable_semantic_files_types</b></td>\n    <td>If set to true, \"Changes walkthrough\" section will be generated.</td>\n  </tr>\n  <tr>\n        <td><b>file_table_collapsible_open_by_default</b></td>\n        <td>Controls whether the file list in the \"Changes walkthrough\" section is initially open or closed.</td>\n  </tr>\n  <tr>\n    <td><b>collapsible_file_list</b></td>\n    <td>If set to true, the file list in the \"Changes walkthrough\" section will be collapsible. If set to \"adaptive\", the file list will be collapsible only when the number of files exceeds <code>collapsible_file_list_threshold</code>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_handling</b></td>\n    <td>If set to true, in case of a large PR the command will make several calls to the AI and combine them to be able to cover more files.</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_diagram</b></td>\n    <td>If set to true, the command will generate a Mermaid flowchart summarizing the main pull request changes. This field remains empty if not applicable.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction</b></td>\n    <td>Direction of the generated Mermaid flowchart: <b>adaptive</b>, <b>LR</b> or <b>TD</b>. With adaptive, the direction is chosen from the shape of the diagram.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction_threshold</b></td>\n    <td>With <b>adaptive</b> direction, a diagram whose longest chain exceeds this many nodes is drawn top-down instead of left-to-right.</td>\n  </tr>\n</table>\n\n</details>\n\n## Markers template\n\nTo enable markers, set `pr_description.use_description_markers=true`.\nMarkers enable to easily integrate user's content and auto-generated content, with a template-like mechanism.\n\nFor example, if the PR original description was:\n\n```\nUser content...\n\n## PR Type:\npr_agent:type\n\n## PR Description:\npr_agent:summary\n\n## PR Walkthrough:\npr_agent:walkthrough\n\n## PR Diagram:\npr_agent:diagram\n```\n\nThe marker `pr_agent:type` will be replaced with the PR type, `pr_agent:summary` will be replaced with the PR summary, `pr_agent:walkthrough` will be replaced with the PR walkthrough, and `pr_agent:diagram` will be replaced with the flowchart (if enabled).\n\n<img src=\"/img/describe_markers_before.png\" alt=\"Describe markers before\" width=\"512\" />\n\nbecomes\n\n<img src=\"/img/describe_markers_after.webp\" alt=\"Describe markers after\" width=\"512\" />\n\n**Configuration params**:\n\n- `use_description_markers`: if set to true, the command will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false.\n- `include_generated_by_header`: only applies when `use_description_markers` is true. If true (default), the command adds a 'Generated by PR Agent at ...' header to automatic content when the provider supplies a head commit SHA, otherwise the header is 'Generated by PR Agent' (or uses `config.bot_display_name` when configured). If false, no header is added.\n- `diagram`: if present as a marker, will be replaced by the PR flowchart (if enabled).\n\n## Custom labels\n\nThe default labels of the describe command are quite generic, since they are meant to be used in any repo: [`Bug fix`, `Tests`, `Enhancement`, `Documentation`, `Other`].\n\nYou can define custom labels that are relevant for your repo and use cases.\nCustom labels can be defined in the PR-Agent host configuration, or directly in the repo's\n[labels page](#handle-custom-labels-from-the-repos-labels-page). The host configuration options cannot be set from\nthe repository's `.pr_agent.toml` or comment arguments.\n\nMake sure to provide proper title, and a detailed and well-phrased description for each label, so the command will know when to suggest it.\nEach label description should be a **conditional statement**, that indicates if to add the label to the PR or not, according to the PR content.\n\n<details open>\n<summary>Auto-remove custom label when no longer relevant</summary>\n\nIf the custom label is no longer relevant, it will be automatically removed from the PR by running the `generate_labels` command or the `describe` command.\n\n</details>\n\n\n### Handle custom labels from a configuration file\n\nExample for a custom labels configuration setup in the PR-Agent host configuration:\n\n```\n[config]\nenable_custom_labels=true\n\n\n[custom_labels.\"sql_changes\"]\ndescription = \"Use when a PR contains changes to SQL queries\"\n\n[custom_labels.\"test\"]\ndescription = \"use when a PR primarily contains new tests\"\n\n...\n```\n\n### Handle custom labels from the Repo's labels page\n\nYou can also control the custom labels that will be suggested by the `describe` command from the repo's labels page:\n\n- GitHub : go to `https://github.com/{owner}/{repo}/labels` (or click on the \"Labels\" tab in the issues or PRs page)\n- GitLab : go to `https://gitlab.com/{owner}/{repo}/-/labels` (or click on \"Manage\" -> \"Labels\" on the left menu)\n\nNow add/edit the custom labels. they should be formatted as follows:\n\n- Label name: The name of the custom label.\n- Description: Start the description of with prefix `pr_agent:`, for example: `pr_agent: Description of when AI should suggest this label`.<br>\n\nExamples for custom labels:\n\n- `Main topic:performance` -  pr_agent:The main topic of this PR is performance\n- `New endpoint` -  pr_agent:A new endpoint was added in this PR\n- `SQL query` -  pr_agent:A new SQL query was added in this PR\n- `Dockerfile changes` - pr_agent:The PR contains changes in the Dockerfile\n- ...\n\nThe description should be comprehensive and detailed, indicating when to add the desired label. For example:\n<img src=\"/img/add_native_custom_labels.webp\" alt=\"Add native custom labels\" width=\"768\" />\n\n## Usage Tips\n\n:::tip[Automation]\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app) for the describe command is:\n```\npr_commands = [\"/describe\", ...]\n```\nmeaning the `describe` command will run automatically on every PR, with the default configurations.\n:::\n\n- Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:\n\n   ```\n   pr_commands = [\"/describe --pr_description.use_description_markers=true\", ...]\n   ```\n\n   the command will replace every marker of the form `pr_agent:marker_name` in the PR description with the relevant content, where `marker_name` is one of the following:\n\n   - `type`: the PR type.\n   - `summary`: the PR summary.\n   - `walkthrough`: the PR walkthrough.\n\n- Note that when markers are enabled, if the original PR description does not contain any markers, the command will not alter the description at all.\n","frontmatter":{"title":"Describe","sidebar_position":2},"isInternal":false,"tokens":3332,"sizeBytes":14150},{"name":"generate_labels.md","path":"docs/docs/commands/generate_labels.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/generate_labels.md","title":"Command: /generate_labels","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Generate Labels\"\nsidebar_position: 7\n---\n\n## Overview\n\nThe `generate_labels` command scans the PR code changes and generates custom labels for the PR based on the content and context of the changes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/generate_labels\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/generate_labels` on any PR.\n\nThe command will analyze the PR and add appropriate labels.\n\nFor local or CI workflows that need label suggestions without a hosting-provider token,\npass a unified diff and write the filtered labels to a JSON artifact:\n\n```bash\npython -m pr_agent.cli --diff-file changes.diff --json-output labels.json generate_labels\n```\n\nThe JSON result contains a `labels` list and a `usage` object (empty when token usage\nis unavailable). Only model-generated labels that pass the existing allowlist are included;\nlabels already on a hosted PR are not included. A PR without analyzable changes produces\nan empty list. This option does not change the normal label publication behavior.\nCheck the command's exit status before consuming the artifact: a failed run does not delete a previous JSON file.\n\n## Configuration options\n\nThe `generate_labels` command uses configurations from the `[pr_description]` section for custom labels.\n\n### Enabling custom labels\n\nTo use custom labels, you need to enable them in the configuration:\n\nSet these options in the PR-Agent host configuration. Repository `.pr_agent.toml` files and comment arguments cannot\nchange them.\n\n```toml\n[config]\nenable_custom_labels = true\n```\n\n### Defining custom labels\n\nYou can define your own custom labels in the `[custom_labels]` section. See the [custom_labels.toml](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/custom_labels.toml) file for examples.\n\nExample configuration:\n\n```toml\n[custom_labels.\"Bug fix\"]\ndescription = \"A fix for a bug in the codebase\"\n\n[custom_labels.\"Feature\"]\ndescription = \"A new feature or enhancement\"\n\n[custom_labels.\"Documentation\"]\ndescription = \"Documentation changes only\"\n\n[custom_labels.\"Tests\"]\ndescription = \"Adding or modifying tests\"\n\n[custom_labels.\"Refactoring\"]\ndescription = \"Code refactoring without functional changes\"\n```\n\n### How labels are applied\n\n1. The command analyzes the PR diff and commit messages\n2. It uses AI to determine which labels best match the PR content\n3. Labels are automatically applied to the PR (if the git provider supports it)\n4. If labels cannot be applied directly, they are published as a comment\n\nBoth `/generate_labels` and `/describe` filter model-generated labels before publishing.\nThe allowed set contains the built-in PR types (`Bug fix`, `Tests`, `Enhancement`,\n`Documentation`, `Other`) plus the configured custom label names when custom labels\nare enabled. With custom labels enabled but no custom set configured, the default\nset also includes `Bug fix with tests`. Matching ignores case, and unknown generated\nlabels are dropped with a warning. Existing human-added labels are preserved and\nare not restricted by this filter.\n\nPrompt enum keys such as `bug_fix` and `RELEASE_READY` are resolved to their\nallowed display names, ignoring case. If a nonempty model response contains only\nrejected labels, `/generate_labels` leaves the current labels unchanged. An\nexplicit `labels: []` response retains the existing behavior of clearing old\nbot-owned labels while preserving human-added labels.\n\nIf the current labels cannot be read, `/generate_labels` skips publication and\nrecords the command as failed. A known provider failure while publishing labels\nalso marks the command as failed. With `config.propagate_command_errors = true`, these\nfailures raise an error after temporary-comment cleanup.\n\nA successful provider acknowledgement means its label operation completed normally;\nit does not verify the final remote label set. Providers apply labels differently,\nand a failure can leave some changes applied. The command does not retry or roll\nback those changes. Labels generated by `/describe` and `/review` remain auxiliary\nto their primary output.\n\n## Comparison with `/describe` labels\n\nThe `/describe` command also generates labels as part of its output. The key differences are:\n\n| Feature | `/generate_labels` | `/describe` |\n|---------|-------------------|-------------|\n| Purpose | Dedicated label generation | Full PR description with labels |\n| Output | Labels only | Title, summary, walkthrough, and labels |\n| Custom labels | ✅ Supported | ✅ Supported |\n| Use case | When you only need labels | When you want a complete PR description |\n\n## Tips\n\n- Use custom labels that match your team's workflow and labeling conventions\n- Combine with automation to automatically label PRs when they are opened\n- Review the generated labels and adjust custom label descriptions if the AI consistently misclassifies PRs\n","frontmatter":{"title":"Generate Labels","sidebar_position":7},"isInternal":false,"tokens":992,"sizeBytes":4876},{"name":"help_docs.md","path":"docs/docs/commands/help_docs.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/help_docs.md","title":"Command: /help_docs","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Help Docs\"\nsidebar_position: 10\n---\n\n:::warning[`/help_docs` is currently disabled]\nAs of **v0.36.1**, the `/help_docs` command is temporarily disabled as a mitigation for a\ncredential-exposure vulnerability ([#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)):\nthe command accepted an untrusted runtime override of its git clone target, and the clone-URL\nhost validation only checked substring containment, so a host that merely *contained* the\nallowed host could receive the git provider token.\n\nThe command is not registered in `PRAgent`, so invoking it has no effect on any provider. The\npage below documents the command as it behaves once it is re-enabled.\n:::\n\n## Overview\n\nThe `help_docs` command can answer a free-text question based on a git documentation folder.\n\nIt can be invoked manually by commenting on any PR or Issue:\n\n```\n/help_docs \"...\"\n```\n\nOr configured to be triggered automatically when a [new issue is opened](../installation/github.md#run-as-a-github-action).\n\nThe command assumes by default that the documentation is located in the root of the repository, at `/docs` folder.\nHowever, this can be customized by setting the `docs_path` configuration option:\n\n```toml\n[pr_help_docs]\nrepo_url = \"\"                 # The repository to use as context\ndocs_path = \"docs\"            # The documentation folder\nrepo_default_branch = \"main\"  # The branch to use in case repo_url overwritten\n\n```\n\nSee more configuration options in the [Configuration options](#configuration-options) section.\n\n## Example usage\n\n[//]: # (#### Asking a question about this repository:)\n\n[//]: # (<img src=\"/img/help_docs_comment.png\" alt=\"help_docs on the documentation of this repository\" width=\"512\" />)\n\n**Asking a question about another repository**\n\n<img src=\"/img/help_docs_comment_explicit_git.png\" alt=\"help_docs on the documentation of another repository\" width=\"512\" />\n\n**Response**:\n\n<img src=\"/img/help_docs_response.png\" alt=\"help_docs response\" width=\"512\" />\n\n## Run automatically when a new issue is opened\n\nYou can configure PR-Agent to run `help_docs` automatically on any newly created issue.\nThis can be useful, for example, for providing immediate feedback to users who open issues with questions on open-source projects with extensive documentation.\n\nHere's how:\n\n1. Follow the steps depicted under [Run as a GitHub Action](../installation/github.md#run-as-a-github-action) to create a new workflow, such as:`.github/workflows/help_docs.yml`:\n\n2. Edit your yaml file to the following:\n\n   ```yaml\n   name: Run pr agent on every opened issue, respond to user comments on an issue\n\n   #When the action is triggered\n   on:\n     issues:\n       types: [opened] #New issue\n\n   # Read env. variables\n   env:\n     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n     GITHUB_API_URL: ${{ github.api_url }}\n     GIT_REPO_URL: ${{ github.event.repository.clone_url }}\n     ISSUE_URL: ${{ github.event.issue.html_url || github.event.comment.html_url }}\n     ISSUE_BODY: ${{ github.event.issue.body || github.event.comment.body }}\n     OPENAI_KEY: ${{ secrets.OPENAI_KEY }}\n\n   # The actual set of actions\n   jobs:\n     issue_agent:\n       runs-on: ubuntu-latest\n       if: ${{ github.event.sender.type != 'Bot' }} #Do not respond to bots\n\n       # Set required permissions\n       permissions:\n         contents: read    # For reading repository contents\n         issues: write     # For commenting on issues\n\n       steps:\n         - name: Run PR Agent on Issues\n           if: ${{ env.ISSUE_URL != '' }}\n           uses: docker://pragent/pr-agent:latest\n           with:\n             entrypoint: /bin/bash #Replace invoking cli.py directly with a shell\n             args: |\n               -c \"cd /app && \\\n               echo 'Running Issue Agent action step on ISSUE_URL=$ISSUE_URL' && \\\n               export config__git_provider='github' && \\\n                           export github__user_token=$GITHUB_TOKEN && \\\n               export github__base_url=$GITHUB_API_URL && \\\n               export openai__key=$OPENAI_KEY && \\\n               python -m pr_agent.cli --issue_url=$ISSUE_URL --pr_help_docs.repo_url=\"...\" --pr_help_docs.docs_path=\"...\" --pr_help_docs.openai_key=$OPENAI_KEY && \\\n               help_docs \"$ISSUE_BODY\"\n   ```\n\n3. Following completion of the remaining steps (such as adding secrets and relevant configurations, such as `repo_url` and `docs_path`) merge this change to your main branch.\n   When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is related to the documentation of the repository.\n\n---\n\n## Configuration options\n\nUnder the section `pr_help_docs`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'help docs' command:\n\n- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context.\n- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect.\n- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url).\n- `exclude_root_readme`:  Whether or not to exclude the root README file for querying the model.\n- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model.\n\n---\n","frontmatter":{"title":"Help Docs","sidebar_position":10},"isInternal":false,"tokens":1214,"sizeBytes":5425},{"name":"help.md","path":"docs/docs/commands/help.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/help.md","title":"Command: /help","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Help\"\nsidebar_position: 9\n---\n\n## Overview\n\nThe `help` command provides a list of all the available commands and their descriptions.\nInvoke commands by posting their slash commands. The checkboxes shown on GitHub do not execute commands when checked.\n\nOn Bitbucket Cloud, Gerrit and CodeCommit, `/help` without a question displays an unsupported-format notice instead of the command list. `/help <question>` can still answer questions from the documentation.\n\nLocal mode only displays the unsupported-format notice for `/help`. Plain-diff mode supports the command list, but `/help <question>` is currently unavailable in both local and plain-diff modes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/help\n```\n\nCalling `/help` without a question displays the command list, where supported, without initializing an AI handler,\nso errors during that initialization do not block the list.\n`/help <question>` still uses the configured AI model.\n\nWhen answering a question, the command tries the configured fallback models if a model returns an invalid response format\nor an empty answer. If all attempts fail, no answer is published and the command records a failure.\nA response that reports no relevant information is still shown normally.\n\n## Example usage\n\nInvoke the `help` command by commenting on a PR with:\n\n<img src=\"/img/help1.png\" alt=\"Help command input\" width=\"750\" />\n\n\nResponse will include a list of available commands:\n\n<img src=\"/img/help2.webp\" alt=\"Help command output\" width=\"750\" />\n","frontmatter":{"title":"Help","sidebar_position":9},"isInternal":false,"tokens":315,"sizeBytes":1525},{"name":"index.md","path":"docs/docs/commands/index.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/index.md","title":"Command: /index","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Commands\"\nsidebar_position: 1\n---\n\nEach PR-Agent command has a dedicated page that explains its behavior and usage:\n\n| Command | Description |\n|------|-------------|\n| **[PR Description (`/describe`)](./describe.md)** | Generate a PR title, type, summary, code walkthrough and labels. |\n| **[PR Review (`/review`)](./review.md)** | Generate a PR review with feedback on possible issues, security concerns, tests and review effort. |\n| **[Code Suggestions (`/improve`)](./improve.mdx)** | Runs /review, whose findings can carry committable code fixes. |\n| **[Question Answering (`/ask ...`)](./ask.md)** | Answering free-text questions about the PR, or on specific code lines |\n| **[Add Documentation (`/add_docs`)](./add_docs.md)** | Generate documentation for code components that are missing it |\n| **[Generate Labels (`/generate_labels`)](./generate_labels.md)** | Generate custom labels for the PR based on the code changes |\n| **[Similar Issues (`/similar_issue`)](./similar_issues.md)** | Find similar issues in the repository based on the current issue |\n| **[Help (`/help`)](./help.md)** | Provides a list of all the available commands |\n| **[Help Docs (`/help_docs`)](./help_docs.md)** | **Temporarily disabled.** Answers questions about a Git repository’s documentation. |\n| **[Update Changelog (`/update_changelog`)](./update_changelog.md)** | Automatically updating the CHANGELOG.md file with the PR changes |\n\n## Usage examples\n\nEach command can be triggered in two ways:\n\n- **As a comment** — write the command (e.g. `/review`) as a comment, and PR-Agent replies. Most commands are commented on a PR; issue-scoped commands such as `similar_issue` are commented on an issue.\n- **From the [CLI](../usage-guide/automations_and_usage.md#local-repo-cli)** — run `python -m pr_agent.cli --pr_url=<PR_URL> <command>`. Issue-scoped commands take `--issue_url=<ISSUE_URL>` instead of `--pr_url`. The module form works only from an environment where the `pr_agent` package is importable (for example, the venv created by `uv sync`). If `pr-agent` is on your `PATH`, run it directly.\n\nBoth accept the same command arguments and [configuration overrides](../usage-guide/configuration_options.md).\n\n| Command                                     | Comment                          | CLI                                                             |\n|------------------------------------------|----------------------------------|----------------------------------------------------------------|\n| [Describe](./describe.md)                | `/describe`                      | `python -m pr_agent.cli --pr_url=<PR_URL> describe`             |\n| [Review](./review.md)                    | `/review`                        | `python -m pr_agent.cli --pr_url=<PR_URL> review`              |\n| [Improve](./improve.mdx)                  | `/improve`                       | `python -m pr_agent.cli --pr_url=<PR_URL> improve`             |\n| [Ask](./ask.md)                          | `/ask \"How does X work?\"`        | `python -m pr_agent.cli --pr_url=<PR_URL> ask \"How does X work?\"` |\n| [Add Docs](./add_docs.md)                | `/add_docs`                      | `python -m pr_agent.cli --pr_url=<PR_URL> add_docs`           |\n| [Generate Labels](./generate_labels.md)  | `/generate_labels`               | `python -m pr_agent.cli --pr_url=<PR_URL> generate_labels`     |\n| [Similar Issues](./similar_issues.md)    | `/similar_issue`                 | `python -m pr_agent.cli --issue_url=<ISSUE_URL> similar_issue` |\n| [Help](./help.md)                        | `/help`                          | `python -m pr_agent.cli --pr_url=<PR_URL> help`                |\n| [Update Changelog](./update_changelog.md)| `/update_changelog`              | `python -m pr_agent.cli --pr_url=<PR_URL> update_changelog`    |\n\n`/help_docs` is temporarily disabled (see [#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)) and is therefore omitted from the table above.\n\nFor screenshots, arguments, and a walkthrough of a typical use case, see the **Example usage** section on each command's page linked above.\n","frontmatter":{"title":"Commands","sidebar_position":1},"isInternal":false,"tokens":956,"sizeBytes":4115},{"name":"review.md","path":"docs/docs/commands/review.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/review.md","title":"Command: /review","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Review\"\nsidebar_position: 3\n---\n\n## Overview\n\nGenerate a PR review with feedback on possible issues, security concerns, tests and review effort.\n<br>\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or can be invoked manually by commenting on any PR:\n\n```\n/review\n```\n\nNote that the main purpose of the `review` command is to provide the **PR reviewer** with useful feedback and insights. Findings can also carry a fix, which GitHub and the other supported providers offer as a [committable suggestion](#fixes-and-committable-suggestions).\n\n(Read more about the different personas in the PR process and how PR-Agent aims to assist them in our [blog](https://www.qodo.ai/blog/understanding-the-challenges-and-pain-points-of-the-pull-request-cycle/))\n\n:::note\n`/improve` runs `/review` as of 0.51. See [Improve](./improve.mdx).\n:::\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/review` on any PR:\n\n<img src=\"/img/review_comment.png\" alt=\"review comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a review for the PR:\n\n<img src=\"/img/review3.png\" alt=\"review\" width=\"512\" />\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...\n```\n\nFrom the CLI, save the parsed review and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output review.json review\n```\n\nThe JSON file is written after the review completes. Place `--json-output` before `review` or `review_pr`.\nIts `coverage` object lists files omitted by the token budget or chunk-call limit, as well as\ndeletions represented only by filename notices (`files_not_reviewed`), and those whose patches\nwere clipped to fit the token budget (`files_partially_reviewed`).\nFiles excluded by file-type filtering are not included in these coverage lists.\nFilename notices are optional context, not reviewed source; filtered-file notices take priority\nwhen both kinds compete for the remaining request budget.\nFilename notices supplement source changes and do not trigger a model call on their own.\nA deletion-only PR without source changes to analyze is skipped, even when deletion patches are available.\nThe JSON includes the full lists even when the Markdown footer summarizes them.\nIt also includes `total_chunks` and `failed_chunks` for the final analysis plan, after fallback recovery.\nThese count analysis chunks, not model requests or retry attempts. A nonzero `failed_chunks` means that the\nreview is partial even if both file lists are empty; findings from successful chunks are retained.\n\n### Automatic triggering\n\nTo run the `review` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/review\",\n    ...\n]\n\n[pr_reviewer]\nextra_instructions = \"...\"\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_reviewer]` section contains the configurations for the `review` command you want to edit (if any).\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>persistent_comment</b></td>\n    <td>If set to true, the review comment will be persistent, meaning that every new review request will edit the previous one.</td>\n  </tr>\n  <tr>\n    <td><b>per_commit_review</b></td>\n    <td>If set to true, each commit of the PR is reviewed on its own diff and commit message, and one review comment is published per commit. See <a href=\"#reviewing-each-commit-separately\">Reviewing each commit separately</a>. It can't be turned on from a command argument, only from a configuration file or environment variable. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_commits_per_review</b></td>\n    <td>Maximum number of commits <code>per_commit_review</code> reviews one by one. When more commits than that are not reviewed yet, the whole PR is reviewed in one review instead, with a notice. It can't be set from a command argument or a per directory configuration file. Default is 0, no limit.</td>\n  </tr>\n  <tr>\n    <td><b>publish_review_failure_comment</b></td>\n    <td>\n      Set to false to suppress the \"Failed to review PR\" comment, including when a persistent review comment\n      cannot be updated. Successful review output and the command's failure status are unchanged. Default is true.\n      On GitHub, GitLab, and Azure DevOps, when the comment author can be verified, repeated failures update one\n      comment instead of adding another, and the next review that completes removes it. If the provider rejects\n      that edit or removal, the earlier comment stays and no other is added. A review in which some chunks failed\n      keeps it; files left out for the token budget do not. With\n      <code>gitlab.reply_to_trigger_comment</code>, each failure still replies to its own command, and a persistent\n      review comment that cannot be updated gets a comment of its own each time. Those are removed the same way,\n      and so are the failure comments of earlier versions.\n    </td>\n  </tr>\n  <tr>\n    <td><b>publish_error_details</b></td>\n    <td>\n      If set to true, a failed manual review comment includes a deterministic, sanitized failure reason for known\n      provider and runtime errors. The failure formatter does not call an AI model, never publishes raw exception\n      text, and falls back to a generic internal-error message. Default is false.\n    </td>\n  </tr>\n  <tr>\n    <td><b>review_heading</b></td>\n    <td>\n      Visible base heading for review comments, without the Markdown prefix or incremental label.\n      For example, <code>review_heading = \"Guideline Compliance Check\"</code> renders\n      <code>## Guideline Compliance Check 🔍</code> for a full review and\n      <code>## Incremental Guideline Compliance Check 🔍</code> for an incremental review.\n      On GitHub, GitLab, Azure DevOps, and Bitbucket Cloud, changing this value updates the same\n      persistent review comment; it does not create a separate review channel.\n    </td>\n  </tr>\n  <tr>\n    <td><b>persistent_finding_state</b></td>\n    <td>If set to true, PR-Agent persists structured review finding state across complete review runs, so findings can be resolved and reopened. Resolved findings retain the original Markdown formatting of their description. Incremental and partial reviews do not resolve absent findings. Default is true.</td>\n\n  </tr>\n  <tr>\n    <td><b>max_previous_findings_chars</b></td>\n        <td>Character budget for the findings stored by earlier reviews (requires <code>persistent_finding_state</code>). They are given to the model so it repeats a still-valid finding with its earlier wording instead of re-raising it reworded, and does not re-raise a resolved one unless the code reintroduces it. On GitHub and GitLab, an inline key-issue thread that someone other than PR-Agent resolved is given as dismissed, with its last reply, so the model does not re-raise it unless the code makes it worse. Set to 0 to disable. Default is 8000.\n      On Azure DevOps, verified PR-Agent inline key issues with <code>wontFix</code> or <code>byDesign</code>\n      are also passed as dismissed when the status differs from <code>azure_devops.default_comment_status</code>.\n      A matching default stays an ordinary prior finding. This infers a human decision; Azure does not identify\n      the status-changing actor here, and the current default may differ from the default used at creation.\n      PR-Agent resolves its posting identity through Azure DevOps. Set\n      <code>azure_devops_server.agent_identity</code> to override it or when automatic lookup is unavailable.\n    </td>\n  </tr>\n  <tr>\n  <td><b>final_update_message</b></td>\n  <td>When set to true, updating a persistent review comment during online commenting will automatically add a short comment with a link to the updated review in the pull request.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\".</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_coverage_footer</b></td>\n    <td>If set to true, the command will display a review coverage footer when source changes were not reviewed or were only partially reviewed, including deleted files represented by filename notices.\n    A review with this footer is published even when <code>publish_output_no_suggestions</code> is false.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_chunking</b></td>\n    <td>If set to true, and the token budget leaves files out of the review, the diff is split into chunks, each chunk is reviewed separately, and the per-chunk results are merged into one review. See <a href=\"#reviewing-a-pr-that-does-not-fit-in-one-call\">Reviewing a PR that does not fit in one call</a>. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_number_of_calls</b></td>\n    <td>Maximum number of chunk review calls, used only when <code>enable_large_pr_chunking</code> is true. Default is 3.</td>\n  </tr>\n  <tr>\n    <td><b>num_max_findings</b></td>\n    <td>Maximum number of returned findings. Default is 6.</td>\n  </tr>\n  <tr>\n    <td><b>inline_key_issues</b></td>\n    <td>If set to true (the default), each key issue is published as an inline comment where the provider supports verified inline-comment publication (GitHub, Bitbucket Cloud, Azure DevOps, GitLab, Gitea). A finding leaves the review summary when a matching comment exists or the provider accepts the new comment. Findings that cannot be anchored or published stay in the summary. A finding that carries a fix is published as a committable suggestion when `pr_code_suggestions.committable_code_suggestions` is true, the fix is at most ten lines and its `existing_code` matches the file at the finding's lines; otherwise the fix appears as a code block in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>min_finding_confidence</b></td>\n    <td>When above 0, the model reports an integer confidence from 0 to 10 for each finding, shown in its header in the review summary (inline comments do not show it). Findings below this value are dropped before publishing, and in a chunked review they are dropped before the <code>num_max_findings</code> cut, so they cannot displace a more confident finding. A run that dropped findings does not mark earlier findings as resolved. A missing or out-of-range confidence is treated as absent: the finding is kept. A threshold outside 0-10 is treated as 0 (disabled). Default is 0: keep all findings, and the model is not asked for a confidence.</td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Enable\\disable specific sub-sections</summary>\n\n<table>\n  <tr>\n    <td><b>require_score_review</b></td>\n    <td>If set to true, the command will add a section that scores the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_tests_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains tests.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_effort_to_review</b></td>\n    <td>If set to true, the command will add a section that estimates the effort needed to review the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_contribution_time_cost</b></td>\n    <td>If set to true, the command will add a section that estimates the time required for a senior developer to create and submit such changes.</td>\n  </tr>\n  <tr>\n    <td><b>require_can_be_split_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains several themes, and can be split into smaller PRs.</td>\n  </tr>\n  <tr>\n    <td><b>require_security_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains a possible security or vulnerability issue.</td>\n  </tr>\n    <tr>\n    <td><b>require_todo_scan</b></td>\n    <td>If set to true, the command will add a section that lists TODO comments found in the PR code changes.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_ticket_analysis_review</b></td>\n    <td>\n      If set to true and ticket context is available, the command adds a ticket-compliance section to the review comment\n      that checks whether the PR fulfills the ticket requirements. Supported sources include GitHub and GitLab issues,\n      linked Azure DevOps work items, Jira Cloud tickets, and Asana tasks.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_risk_assessment</b></td>\n    <td>If set to true, the command will add a section that rates the overall risk of the PR as low, medium or high.</td>\n  </tr>\n  <tr>\n    <td><b>require_merge_recommendation</b></td>\n    <td>If set to true, the command publishes a recommendation computed from deterministic checks. Only passing checks\n    allow no_concerns_found; needs_review means a check did not pass or could not be evaluated, and changes_required\n    reflects a model veto. The value reports the review's findings, not a guarantee about the code. See\n    <a href=\"#merge-recommendation\">Merge recommendation</a>.</td>\n  </tr>\n  <tr>\n    <td><b>publish_merge_recommendation_status</b></td>\n    <td>If set to true with <code>require_merge_recommendation</code>, publishes the verdict on the reviewed commit.\n    GitHub uses the <code>PR Agent - Review</code> check; GitLab uses a commit status. <code>needs_review</code>\n    publishes as neutral on GitHub and skipped on GitLab, so it does not block a merge; <code>changes_required</code>\n    publishes as a failure.</td>\n  </tr>\n  <tr>\n    <td><b>max_changed_lines</b></td>\n    <td>Host-only changed-line cap for <code>no_concerns_found</code>. A larger diff makes the recommendation\n    <code>needs_review</code> at best. The cap counts added and removed lines.</td>\n  </tr>\n  <tr>\n    <td><b>require_failure_modes</b></td>\n    <td>Off by default. If enabled, adds up to three concrete failure scenarios, each with what could break,\n    where, its trigger, how it could be detected, and whether a test or check in this PR covers it.\n    These scenarios guide human review; they do not gate merging or prove that the PR is safe.</td>\n  </tr>\n  <tr>\n    <td><b>require_artifact_findings</b></td>\n    <td>Off by default, and only active when a <a href=\"../../installation/github/#ci-artifact-context\">CI artifact</a> reaches /review.\n    If enabled, adds a \"CI artifact findings\" section with up to five neutral facts from the artifact: destroyed or replaced\n    resources, failed jobs (including allowed-to-fail ones), failed tests, vulnerabilities and notable warnings. Each fact\n    carries a short quote from the artifact; a quote that cannot be found in the artifact is marked, and credentials in\n    facts and quotes are redacted. The section reports what the artifact shows and leaves the decision to the reviewer.\n    Host configuration only: a repository settings file or comment cannot set it.</td>\n  </tr>\n  <tr>\n    <td><b>require_priority_files</b></td>\n    <td>If set to true, the command will add a section listing the files a human reviewer should inspect first.</td>\n  </tr>\n  <tr>\n    <td><b>structural_reach_input_file</b></td>\n    <td>Path to a JSON file with structural reach facts, written by a build-graph tool earlier in CI. When the file\n    exists, adds a deterministic change-risk row (Low, Moderate, High or Critical) with no model call. Relative to\n    <code>GITHUB_WORKSPACE</code> when that is set, otherwise to the working directory. Host configuration only: a\n    repository settings file or a comment cannot set it, because the file is read from the host. See\n    <a href=\"#structural-reach\">Structural reach</a>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_risk_checks</b></td>\n    <td>\n      If set to true, deterministically scans diff files and unfiltered PR files for sensitive paths, destructive SQL,\n      cache flushes, and authentication/secrets patterns without making model calls. Findings are rendered as a risk-checks\n      row in the review summary table. When no findings are detected, nothing is added. Default is true. See\n      <a href=\"#deterministic-risk-checks\">Deterministic risk checks</a>.\n    </td>\n  </tr>\n  <tr>\n    <td><b>sensitive_paths</b></td>\n    <td>\n      List of glob patterns identifying files considered sensitive (such as CI workflows, package manifests, lockfiles,\n      migrations, and infrastructure configurations). Changes to matching files flag a deterministic review risk finding.\n      Default includes common CI/CD, package manager, container, infrastructure, and migration paths.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_risky_shapes</b></td>\n    <td>\n      List of custom regular expression patterns to scan within added and removed lines in diff hunks. Patterns matching a\n      line flag a deterministic risk finding. Patterns longer than 200 characters, or with a quantified group that holds a\n      nested quantifier or an alternation (such as `(a+)+` or `(a|b)+`), are skipped with a logged warning. Host\n      configuration only: a repository settings file or comment cannot set it. Default is empty.\n    </td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Adding PR labels</summary>\n\nYou can enable\\disable the `review` command to add specific labels to the PR:\n\n<table>\n  <tr>\n    <td><b>enable_review_labels_security</b></td>\n    <td>If set to true, the command will publish a 'Possible security concern' label if it detects a security issue.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_labels_effort</b></td>\n    <td>If set to true, the command will publish a 'Review effort x/5' label (1–5 scale). Existing effort labels are kept when this option or effort estimation is disabled, or when the review has no valid replacement estimate. Security labels follow their own settings.</td>\n  </tr>\n</table>\n\n</details>\n\n## Usage Tips\n\n### General guidelines\n\n:::tip\n\nThe `review` command provides a collection of configurable feedbacks about a PR.\nIt is recommended to review the [Configuration options](#configuration-options) section, and choose the relevant options for your use case.\n\nSome of the features that are disabled by default are quite useful, and should be considered for enabling. For example:\n`require_score_review`, and more.\n\nOn the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases.\n:::\n\n### Automation\n\n:::tip\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened) for the `review` command is:\n```\npr_commands = [\"/review\", ...]\n```\nMeaning the `review` command will run automatically on every PR, without any additional configurations.\nEdit this field to enable/disable the command, or to change the configurations used.\n:::\n\n### Auto-generated PR labels by the Review Command\n\n:::tip\n\nThe `review` command can automatically add labels to your Pull Requests:\n\n- **`Possible security concern`**: This label is applied if the command detects a potential [security vulnerability](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L147) in the PR's code. This feedback is controlled by the 'enable_review_labels_security' flag (default is true).\n- **`Review effort 3/5`**: This label estimates the [effort](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L119) required to review the PR on a scale of 1 to 5. This feedback is controlled by the 'enable_review_labels_effort' flag (default is true).\n\nThe command matches these label names and earlier 1–5 effort formats case-insensitively.\nOther labels, such as `Review effort::high`, are left unchanged.\n\nTicket compliance is reported in the review comment, not as a PR label. It is controlled by\n`pr_reviewer.require_ticket_analysis_review` and requires available ticket context. The command does not add\nticket-compliance labels or a \"No ticket found\" label. See\n[Fetching ticket context](../core-abilities/fetching_ticket_context.md) for linking and authentication details.\n\n\n:::\n\n### Auto-blocking PRs from being merged based on the generated labels\n\n:::tip\n\nYou can configure a CI/CD Action to prevent merging PRs with specific labels. For example, implement a dedicated [GitHub Action](https://medium.com/sequra-tech/quick-tip-block-pull-request-merge-using-labels-6cc326936221).\n\nThis approach helps ensure PRs with potential security issues will not be merged without further review.\n\nSince AI may make mistakes or lack complete context, use this feature judiciously. For flexibility, users with appropriate permissions can remove generated labels when necessary. When a label is removed, this action will be automatically documented in the PR discussion, clearly indicating it was a deliberate override by an authorized user to allow the merge.\n:::\n\n### Extra instructions\n\n:::tip\n\nExtra instructions are important.\nThe `review` command can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.\n\nBe specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-command, and the relevant aspects of the PR that you want to emphasize.\n\nExamples of extra instructions:\n```\n[pr_reviewer]\nextra_instructions=\"\"\"\\\nIn the code feedback section, emphasize the following:\n- Does the code logic cover relevant edge cases?\n- Is the code logic clear and easy to understand?\n- Is the code logic efficient?\n...\n\"\"\"\n```\nUse triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.\n:::\n\n### Fixes and committable suggestions\n\nA finding can carry a fix: the model adds `existing_code` (the lines it wants to change, copied from the file) and\n`improved_code` (their replacement) when a concrete change resolves the issue. A finding without a clear fix has neither field.\n\nWhen `inline_key_issues` is on (the default) and the provider can verify inline comments (GitHub, Bitbucket Cloud, Azure DevOps,\nGitLab, Gitea), each finding is posted as an inline comment. If `pr_code_suggestions.committable_code_suggestions` is true and\n`existing_code` matches the file at the finding's lines, the fix is posted as a committable suggestion that you can apply from the\nPR page. Otherwise the fix is shown as a text block in the comment. A finding that is not posted inline (the provider cannot verify\ninline comments, `inline_key_issues` is off, or publishing failed) stays in the review summary, and its fix appears there as a text\nblock. Findings are capped by `pr_reviewer.num_max_findings` (6 by default), and chunked reviews keep the same cap.\n\nThree `pr_code_suggestions` settings are honoured: `committable_code_suggestions`, `extra_instructions`\n(added to the review's extra instructions when it differs from `pr_reviewer.extra_instructions`) and\n`suggestions_heading` (the base heading for code-suggestion comments). Other `pr_code_suggestions` keys have no effect.\n\n```\n/review --pr_code_suggestions.committable_code_suggestions=true\n```\n\n### Reviewing each commit separately\n\n:::tip\n\nProjects that keep one logical change per commit can ask for a review of every commit instead of the combined PR diff,\nin a configuration file:\n\n```\n[pr_reviewer]\nper_commit_review = true\n```\n\nEach commit is reviewed against its own parent, with its commit message in the prompt, and gets its own\nincremental review comment that names and links the commit. These comments are never the persistent\nreview comment, and they do not change the review labels.\n\nEach run reviews only the commits of the PR that were not reviewed yet, so `-i` is not needed in `pr_commands` or\n`push_commands`, and the first run reviews every commit. A commit is identified by a fingerprint of its own changes\n(file names and patch lines, without line numbers), and counts as reviewed once its review succeeds: the fingerprint\nis kept in a hidden marker in the commit's review comment or, when no comment is published for it, in one record\ncomment that is edited in place. A commit whose review failed is reviewed again on the next run; automatic runs stop\nretrying it after 3 failed attempts, while a manual `/review` always retries.\n`minimal_commits_for_incremental_review` and `minimal_minutes_for_incremental_review` do not apply to per commit\nreview, since each run picks the commits to review from these markers instead of the `-i` thresholds.\nThe commit list is read from the git provider on every run, so after a force push the review follows the rewritten\nhistory: a commit that was rebased without changing its own patch is not reviewed again, a commit that was amended or\nhad fixups folded into it (for example with `git rebase --autosquash`) is reviewed again, and fixup commits that no\nlonger exist are not reviewed. Markers count only in comments PR-Agent wrote; when the git provider cannot confirm\nthat, the whole PR is reviewed in one review with a notice instead.\nOn GitLab, a commit with a collapsed, too large or rename only file is reviewed again after a rebase, since its\nfingerprint includes its SHA.\n\nSet `publish_output_no_suggestions = false` in the `[pr_reviewer]` section\n(`--pr_reviewer.publish_output_no_suggestions=false` on the command line) to skip the comment of a commit with\nno findings and no coverage warning.\nWith `inline_key_issues = true`, each finding is published as an inline comment on the commit it was found in,\nanchored to that commit's own diff, so GitHub and GitLab show it as outdated once a later commit changes those lines.\nA finding that cannot be anchored there, for example because its line is outside that commit's diff or the provider\nrejects it, stays in that commit's review comment instead of being moved to a nearby line.\n\nMerge commits, empty commits and the root commit of a history have no diff of their own and are skipped. A commit that\nfails to review is reported like a failed review and does not stop the remaining commits. Every reviewed commit is a\nseparate model call, so the first review of a PR with many commits costs accordingly; later runs review only the new\ncommits.\nHosts that want to bound that cost can set `max_commits_per_review` (default 0, no limit): when more commits than that\nare not reviewed yet, the whole PR is reviewed in one review with a notice, and its commits count as reviewed.\nThe markers live only in PR-Agent's own comments, so if those comments are removed, the next run reviews every commit\nof the PR again, unless `max_commits_per_review` is set and the PR has more commits than that, in which case the whole\nPR gets one review.\nBoth settings belong to the operator, so a command argument such as `--pr_reviewer.per_commit_review=true` is\nrejected.\nEach commit's comment shows its own run details, while the `--json-output` file and the GitHub Action `review` output\ndescribe the last reviewed commit only.\n\nPer commit review is available on GitHub and GitLab. Other git providers fall back to a regular review of the whole PR.\nGitHub lists at most 250 commits of a PR, so a PR with more commits than that is also reviewed as a whole, with a\nnotice explaining why.\n:::\n\n### Reviewing a PR that does not fit in one call\n\n:::tip\n\nWhen a PR diff is larger than the model's token budget, the `review` command drops whole files\nuntil the diff fits, and lists the dropped files in the review coverage footer.\n\nSetting `enable_large_pr_chunking = true` changes what happens next: the diff is split into up\nto `max_number_of_calls` chunks, each chunk is reviewed on its own, and the answers are merged\ninto a single review that says how many chunks it was built from. Files that do not fit even\nafter chunking are still listed in the coverage footer. Every chunk is a separate model call,\nso a chunked review costs roughly `max_number_of_calls` times a normal one.\n\nWhile the chunks run, the temporary `Preparing review...` comment is rewritten in place with the\nnumber of chunks already analyzed, for example `Preparing review... analyzed 2 of 3 chunks`, plus\n`... 1 chunk failed` when a chunk gives up. The updates require\n`config.publish_output_progress` and a provider that supports both editing and removing a\ncomment, so plain-diff runs keep the frozen placeholder. Automatic commands publish no progress\ncomment, but while `github.publish_as_check_run` is enabled their in-progress check run shows the\nsame chunk count. The comment stays\ntemporary and is still removed before the merged review is published. A fallback model restores\nthe placeholder before it starts, so the visible count never moves backward.\n\nIf a chunk fails or returns malformed output, successful chunks are retained and fallback\nmodels retry only the pending work. Pending chunks can be split for a smaller model, within\nthe call limit; a larger model can also include previously omitted files. Chunks that still\nexceed the model's budget are not sent to it.\n\nWhen only one chunk is unfinished and all source files are already in the plan, a smaller\nfallback model can review fitting files beside oversized files. This requires a separate\nchunk for every file within the existing limit, including completed chunks. Oversized files\nremain pending for later models. If none of the recovered chunks succeeds, the original\ngrouping is restored for the next model. Non-retryable errors stop fallback even when another\nchunk exceeds the budget; this includes guardrail rejections only when reported as non-retryable.\n\nIf every fallback is exhausted, successful chunks are published as a partial review with a\nfailed-chunk coverage warning, even when `publish_output_no_suggestions = false`. Incomplete\nreviews cannot resolve absent persistent findings. If no chunk succeeds, the review fails.\nWith `config.propagate_command_errors = true`, an exhausted fallback chain still signals failure\nto the caller after publishing the partial review and removing the progress comment.\nOptional run details list all models that contributed to the merged review.\n\nEach chunk answers the same questions about a different part of the PR, so the answers are\nmerged field by field:\n\n| Field | Merge rule |\n| --- | --- |\n| `key_issues_to_review` | Union over the chunks, dropping findings that repeat the same file, header and text |\n| `security_concerns` | Every chunk that reported a concern is kept; \"No\" only when every chunk said no |\n| `todo_sections`, `review_priority_files`, `can_be_split` | Union, de-duplicated, in chunk order (`can_be_split` keeps at most 3 sub-PRs) |\n| `relevant_tests` | Yes if any chunk found tests |\n| `score` | The lowest score any chunk gave |\n| `risk_level`, `merge_recommendation` | The most conservative value any chunk gave |\n| `failure_modes` | Concatenate valid cases in chunk order, dropping exact duplicates and keeping at most three |\n| `estimated_effort_to_review_[1-5]` | The highest value any chunk gave |\n| `contribution_time_cost_estimate` | The sum over the chunks, per case |\n| `ticket_compliance_check` | One entry per ticket, with its bullet lists unioned across chunks |\n\nWhen `require_todo_scan` is enabled, the TODO union includes both located findings and prose\nsummaries. Prose without a file location is shown as text without a source link.\n\nThe merged verdict is deliberately never less alarming than the worst chunk: a clean chunk\ncannot raise a score, clear a security concern, or soften a risk level set by another chunk.\n:::\n\n### Structural reach\n\n:::tip\n\nWhen `structural_reach_input_file` points at a file that exists, the review gets one row at the top that rates how\nfar a defect in the change could spread. The row is computed from that file, not by the model, so the same input\nalways gets the same rating.\n\n```\n🔗 Structural reach: Critical\nReach: 40 projects, cross-domain\nDependents: billing-api, payments-worker, web-app, admin-app, reports (+35 more)\nSensitivity: payments\nRating driven by sensitive domain (escalates regardless of size)\n```\n\n**Rating.** Two facts from the input file set the band:\n\n- **Reach** is the number of downstream projects a defect in the change can break. Only a build-graph tool knows\n  it.\n- **Sensitivity** flags changes to areas the repository marks as high-criticality, such as authentication,\n  payments or secrets. A one-line auth change outranks a wide styling sweep.\n\nReach is narrow up to 3 projects, moderate up to 25 and wide above that. The band then follows these rules:\n\n| Condition | Band |\n| --- | --- |\n| Wide reach | At least Moderate |\n| Cross-domain change | At least Moderate |\n| Any sensitive domain | At least High |\n| Sensitive domain with wide reach | Critical |\n| Anything else | Low |\n\nThe row lists each factor and names the one that set the band. It also lists the first five names in\n`dependents`, in the order the producer wrote them.\n\nThe reach bands are defined for projects only. When `reach_unit` is `modules` or `files`, the row shows the count\nand the dependents without a band, because no threshold separates a change to a shared utility from a real spread.\nA cross-domain or sensitive change still gets a band from the rules above. The Reach line still shows the\nnumber, but it does not affect the band.\n\nChange size is not part of the rating, because\n`estimated_effort_to_review_[1-5]` already reflects it. That row and `require_risk_assessment` are the model's\njudgement; this row adds the structural and sensitivity facts the model cannot see in the diff.\n\n**Input file.** Any build-graph tool (Nx, Bazel, Gradle, Turborepo, and so on) can write the reach facts in an\nearlier CI step, so pr-agent needs no adapter per tool. Point `structural_reach_input_file` at the file in host\nconfiguration, for example the `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE` environment variable. Every field is\noptional:\n\n```json\n{\n  \"version\": 1,\n  \"reach\": 12,\n  \"reach_unit\": \"projects\",\n  \"dependents\": [\"billing-api\", \"web-app\"],\n  \"domains\": [\"billing\", \"web\"],\n  \"cross_domain\": true,\n  \"sensitive_domains\": [\"billing\"]\n}\n```\n\n| Field | Type | Meaning |\n| --- | --- | --- |\n| `version` | integer | Schema version. Only `1` is accepted. |\n| `reach` | integer, 0 or more | Number of units affected by the change, including transitive dependents. Defaults to the length of `dependents`. |\n| `reach_unit` | string | What `reach` counts: `projects` (the default), `modules` or `files`. Only `projects` gets a reach band. |\n| `dependents` | list of strings | Names of the affected units, most relevant first. |\n| `domains` | list of strings | Distinct domains or areas the affected projects belong to. |\n| `cross_domain` | boolean | Whether the change spans more than one domain. |\n| `sensitive_domains` | list of strings | Affected domains the repository treats as sensitive. |\n\nUnknown fields are ignored. Strings are limited to 200 characters and the file to 1 MB.\n\n**Trust.** The file is read from inside `GITHUB_WORKSPACE` (or the working directory), so in the GitHub Action a\ncheckout of the pull request could already contain a file at that path, written by the pull request's author.\nGenerate the file in the same job, right before the review step, and delete any existing copy first. Take the\nproject tags and graph configuration the producer reads from the base commit, not from the pull request. Treat the\nband as advisory context for reviewers, never as a merge gate.\n\n**Example producer: Nx.** `nx show projects --affected` lists every project the change affects, including\ntransitive dependents. This step writes them as `dependents`, and lists affected projects tagged `sensitive` as\n`sensitive_domains`:\n\n```bash\naffected() { npx nx show projects --affected --base=\"$BASE_SHA\" --head=\"$HEAD_SHA\" --json \"$@\"; }\naffected | jq --argjson sensitive \"$(affected -p 'tag:sensitive')\" \\\n  '{version: 1, reach_unit: \"projects\", dependents: ., sensitive_domains: $sensitive}' > structural-reach.json\n```\n\nThen set `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE=structural-reach.json` for the review step. Another tool\nneeds only a query that lists the affected projects or packages.\n\n**Example producer: tree-sitter.** For a repository without a build-graph tool,\n`scripts/structural_reach_producer.py` builds a reverse-import graph of the Python, TypeScript and JavaScript\nfiles at the base commit and follows importers from the changed files. Test files are left out of reach and\ndomains, because counting them makes most changes to a shared module read wide. It writes `reach_unit` as\n`modules` (directories) by default, so the row shows the count and the first dependents without a band. Run it as\na CI step before the review; it is not a pr-agent dependency:\n\n```bash\npip install \"tree-sitter-language-pack==1.22.1\"\npython scripts/structural_reach_producer.py --repo . --base \"$BASE_SHA\" --head \"$HEAD_SHA\" \\\n  --unit module --out structural-reach.json\n```\n\nOn this repository, the change merged in pull request 4420 gives:\n\n```\n🔗 Structural reach\nReach: 9 modules\nDependents: pr_agent/git_providers, pr_agent/commands, pr_agent/servers, pr_agent/algo, pr_agent/mosaico (+4 more)\n```\n\n`dependents` is ordered by the number of affected files in each unit. The graph does not see imports built at\nrun time, files loaded by name such as settings, or dependencies declared only in a manifest, such as a shared\n`tsconfig` package used through `extends`. In a monorepo with Nx, Turborepo or Bazel, use that tool instead.\n\n**Failure handling.** The row never blocks a review. If the setting is empty, the input file is missing or does\nnot match the schema, or anything fails while computing the row, the review is published without it.\n\n**Sources.**\n\n- Beyer, B. et al. *Site Reliability Engineering* (Google, 2016), and the AWS Well-Architected Framework: blast\n  radius as the scope of impact of a change or failure.\n- OWASP guidance on sensitive functionality: authentication, session management, cryptography and payments.\n\n:::\n\n### Deterministic risk checks\n\n:::tip\n\nWhen `enable_risk_checks` is enabled (the default), PR-Agent scans changed files and diff hunks for known risk patterns\nwithout making model calls. Incremental and per-commit reviews scope unfiltered path checks to the active incremental\nfile set unless `require_merge_recommendation` is enabled. Findings are rendered as a dedicated row in the review table:\n\n```\n⚠️ Risk checks: 3 finding(s) detected\nSensitive paths (1): .github/workflows/deploy.yml\nRisky shapes (1): `Privilege revocation` in db/migrations/002_revoke.sql\nDeleted files (1): old_auth.py\n```\n\nWhen no findings are detected, the row is omitted completely so clean reviews stay uncluttered.\n\n**Checks performed.**\n\n- **Sensitive paths**: Flags changes to files matching glob patterns in `sensitive_paths`. By default, this covers\n  CI/CD pipelines and local composite actions, package manager manifests and lockfiles, Dockerfiles, Terraform and\n  infrastructure configs, and database migrations.\n- **Risky change shapes**: Scans added and removed lines in diff hunks for destructive SQL (`DROP TABLE`, `ALTER ... RENAME`,\n  `REVOKE ... ON/FROM`, `TRUNCATE`), authentication and secrets keywords, cache invalidations, and any custom patterns\n  configured in `extra_risky_shapes`. Removed lines are also checked for removed function signatures (Python, JS/TS, Go,\n  Rust) and, in `.toml`, `.yaml`, `.yml`, `.json`, `.ini` and `.env` files, removed configuration defaults. Changes to\n  prompt files (`*prompt*.toml`, `*prompt*.yaml`, or files under a `*prompts*/` directory) are flagged as well.\n- **Deleted files**: Flags removed files.\n\n**Custom patterns.** Additional regular expressions can be configured via `extra_risky_shapes`. Because regex execution\nhas security implications, `extra_risky_shapes` must be configured through host configuration (such as environment\nvariables or host settings) and cannot be overridden by repository `.pr_agent.toml` files. Each search with a custom\npattern has a 50 ms limit, and each custom pattern has 1 s in total per review. If a pattern exceeds either one,\nPR-Agent logs a warning and skips that pattern for the rest of the review.\n\n:::\n\n### Merge recommendation\n\nWhen `require_merge_recommendation` is enabled, PR-Agent computes the published verdict from deterministic checks.\nThe model can only make the verdict more cautious: it can lower a clean verdict, or raise `needs_review` to\n`changes_required`, but it cannot override a failed deterministic check.\n\n**Checks and sources**\n\n- `CI on reviewed head` (deterministic): requires passing CI for the reviewed head. Unavailable CI status fails\n  closed.\n- `Head is current with its base` (deterministic): requires the reviewed head to be current with its base for\n  reviewed files. Unavailable staleness status fails closed.\n- `Human authors` (deterministic): requires all authors to be human. Bot/unlinked or unavailable author data fails\n  closed.\n- `No sensitive paths or risky changes` (deterministic): requires no findings from deterministic risk checks\n  (`sensitive_paths`, risky diff shapes, deleted files). Unavailable risk-check data fails closed.\n- `Changed lines within cap` (deterministic): requires total added/removed lines within\n  `pr_reviewer.max_changed_lines`. Unavailable line counts fail closed.\n- `Model merge recommendation` (model, veto only): if the model returns `needs_review` or `changes_required`, the\n  verdict cannot be `no_concerns_found`.\n- `Model risk level` (model, veto only): if the model returns `medium` or `high` risk, the verdict cannot be\n  `no_concerns_found`.\n\n`no_concerns_found` requires all deterministic checks to pass and no model veto. If any deterministic check cannot be\nevaluated, the verdict fails closed. The review includes each check and its result.\n\n**Configuration and status publishing**\n\n- `pr_reviewer.sensitive_paths`: glob patterns for files treated as sensitive by deterministic risk checks.\n  Host-only.\n- `pr_reviewer.max_changed_lines`: host-only changed-line cap for `no_concerns_found`. Counts added and removed\n  lines.\n- `pr_reviewer.extra_risky_shapes`: host-only custom regex patterns scanned in added and removed diff lines.\n- `publish_merge_recommendation_status`: publishes the verdict for the exact reviewed head SHA. GitHub uses the\n  `PR Agent - Review` check run; GitLab uses a commit status.\n\n`needs_review` publishes as neutral on GitHub and skipped on GitLab, so it does not block merges by itself.\n`changes_required` publishes as failure/failed and blocks merges when that status is required. To require it, add\n`PR Agent - Review` as a required status/check in your GitHub branch protection rule or ruleset, or require the\nPR-Agent commit status in your GitLab project's merge rules. A new commit has no PR-Agent verdict status until it is\nreviewed.\n\nThe verdict scans the complete PR diff, including ignored paths and files already reviewed by an incremental review.\nIf the full diff or a trustworthy CI timestamp is unavailable, the verdict cannot be `no_concerns_found`.\n\n### Gated auto-approval\n\n:::warning\n\nOff by default and host-only (`config.enable_auto_approval`). An approval counts toward a protected branch's\nrequired reviews, so enable it only where an automated approval of small, clean changes is acceptable. PR-Agent\nnever merges.\n\n:::\n\nWhen the host sets `config.enable_auto_approval` (for example `CONFIG__ENABLE_AUTO_APPROVAL=true`), `/review` on\nGitHub and GitLab approves the exact commit it reviewed only when all of these hold:\n\n- the computed merge recommendation is `no_concerns_found`;\n- the model returned both a merge recommendation and a risk level, so `require_merge_recommendation` and\n  `require_risk_assessment` must be enabled;\n- the review covered the whole pull request: not an incremental review, no file left out by the ignore rules or the\n  file-type filter, no file left out or cut short to fit the model's context, and no part of the diff failed;\n- the review completed and its finding state could be updated.\n\nEach `/review` run withdraws the approval PR-Agent gave when it starts, and approves again only when it ends with all\nof these holding, so a run that fails or finds a concern leaves no approval behind. On a push, the GitHub App, the\nGitHub Action, and the GitLab webhook dismiss it before any other event filter runs. A change of base branch also\ndismisses it, and on GitHub so does a reopen. On GitHub, PR-Agent only dismisses approvals it gave automatically;\nmanual approvals from the same account are left alone. On GitLab, an approval belongs to the token's account, so use\nan account reserved for PR-Agent. With `publish_output` off, nothing is approved or dismissed.\n\n`enable_auto_approval` is host-only: a repository `.pr_agent.toml` or a comment argument cannot turn it on.\n\n**Required repository settings.**\n\n- On GitHub, turn on \"Dismiss stale pull request approvals when new commits are pushed\" in the branch protection\n  rule or ruleset. PR-Agent can miss a push (a failed webhook delivery, a polling deployment, or a workflow that\n  does not listen to `synchronize`), and GitHub only removes a stale approval itself when this is on.\n- On GitLab, enable merge request approvals for the project and keep approvals reset on push in the project's\n  approval settings, so a missed webhook does not leave a stale approval behind.\n- For the GitHub Action, allow \"GitHub Actions to create and approve pull requests\" in the repository's Actions\n  settings. Pull requests from forks get a read-only token, so they cannot be approved.\n- If the rule restricts who can dismiss reviews, include PR-Agent's account; otherwise it cannot withdraw its own\n  approval, and only logs an error.\n\nGitHub does not let an account approve a pull request it opened. GitLab can also reject approval by the merge\nrequest author according to the project's approval settings. Other git providers are not supported yet.\n\n**Suggested rollout**\n\n1. Enable `require_merge_recommendation`, `require_risk_assessment`, and `publish_merge_recommendation_status` on\n   the host. Tune `sensitive_paths` and `max_changed_lines` as needed.\n2. Require the published verdict status in branch protection or merge rules, and verify verdicts on representative\n   PRs.\n3. Enable `config.enable_auto_approval` for a limited scope first (or a pilot environment), confirm approvals are\n   dismissed on push/base changes, and monitor outcomes.\n4. Expand gradually once the behavior matches your repository's review policy. Keep PR-Agent's account permissions\n   and stale-approval settings in place.\n","frontmatter":{"title":"Review","sidebar_position":3},"isInternal":false,"tokens":10908,"sizeBytes":47208},{"name":"similar_issues.md","path":"docs/docs/commands/similar_issues.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/similar_issues.md","title":"Command: /similar_issues","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Similar Issues\"\nsidebar_position: 8\n---\n\n## Overview\n\n> **Note**: `/similar_issue` is an **experimental** feature. It works only on GitHub, carries a disproportionately large share of the project's dependency and configuration surface for a single-provider command, and is therefore excluded from the v1 stability guarantees. No backend is tested against its real driver.\n\nThe similar issue command retrieves the most similar issues to the current issue.\nIt is an issue-scoped command: comment `/similar_issue` on the issue (served by the GitHub Action; the GitHub App webhook only dispatches comments on pull requests), or run it from the CLI with `--issue_url`:\n\n```\n/similar_issue\n```\n\n## Example usage\n\n<img src=\"/img/similar_issue_original_issue.png\" alt=\"similar_issue_original_issue\" width=\"768\" />\n\n<img src=\"/img/similar_issue_comment.png\" alt=\"similar_issue_comment\" width=\"768\" />\n\n<img src=\"/img/similar_issue.png\" alt=\"similar_issue\" width=\"768\" />\n\n### Indexing and re-runs\n\nTo perform retrieval, the `similar_issue` command indexes the repository's issues in the configured vector database. On every backend:\n\n- The **first run** indexes up to `max_issues_to_scan` issues (default `500`).\n- **Later runs** check the newest `max_issues_to_scan` issues and index any that are missing, so previously-indexed issues are not re-embedded.\n- `force_update_dataset = true` makes every run re-index up to `max_issues_to_scan` issues: LanceDB replaces the repository's rows, Pinecone and Qdrant upsert over the existing rows.\n- `skip_comments = true` skips issue comments and embeds only the issue title and body.\n\nEmbedding inputs are limited to **8,191 tokens** (one token below the model's\n8,192-token context). Issues or comments exceeding this limit are skipped during\nindexing; an oversized issue also excludes its comments. Long similarity queries\nare truncated to their first 8,191 tokens, so later content does not influence\nthe results.\n\nThese keys live under the `[pr_similar_issue]` section. Each backend section below describes its own configuration and re-run behaviour.\n\nIf the embedding service rejects the credentials (HTTP 401) or denies access (HTTP 403), indexing stops immediately on every vector database backend.\nCorrect the embedding API key or access permissions before running the command again; other embedding errors retain the existing batch and per-item fallback behavior.\n\n### Selecting a Vector Database\n\nConfigure your preferred database by setting the `vectordb` parameter under `[pr_similar_issue]` in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"lancedb\"  # options: \"pinecone\", \"lancedb\", \"qdrant\"\n```\n\n#### Available Options\n\nChoose from the following Vector Databases:\n\n1. LanceDB\n2. Pinecone\n3. Qdrant\n\n#### LanceDB Configuration\n\nLanceDB is the default backend (`vectordb = \"lancedb\"`) and needs no external credentials. The index is stored in a local directory given by the `[lancedb] uri` key (default `./lancedb`). A single table (`codium-ai-pr-agent-issues`) is shared by every repository indexed into the same directory; rows are tagged with the repository name in the metadata.\n\nAs described in [Indexing and re-runs](#indexing-and-re-runs), the first run creates the table and indexes up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` replaces the repository's rows with a fresh index of up to `max_issues_to_scan` issues.\n\n#### Pinecone Configuration\n\nTo use Pinecone with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[pinecone]\napi_key = \"...\"\ncloud = \"aws\"\nregion = \"us-east-1\"\n```\n\nThe `cloud` value must be one of `aws`, `gcp` or `azure`, and `region` must be an\navailability region offered by that cloud. These parameters can be obtained by\nregistering to [Pinecone](https://app.pinecone.io/?sessionType=signup/). Note that the\ncommand uses Pinecone's serverless index API; the former `environment` setting from the\ngcp-starter pod tier is no longer supported.\n\n`cloud` and `region` are only used when the index does not exist yet and needs to be\ncreated. An existing index is opened by name and is never recreated, so moving an\nexisting deployment to the new configuration does not lose the stored vectors.\n\nOn re-runs, the first run creates the index and upserts up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[No backend is tested against its real driver]\n\nThe `similar-issue` dependency group is not installed in CI, so the pinecone tests run\nagainst a faked module, the qdrant tests never construct a client, and the lancedb tests\nrun against a fake table.\n:::\n\n:::note[Default vector database]\n\n`vectordb` defaults to `lancedb`, which works with no external credentials. To use\nqdrant or pinecone, set `vectordb = \"qdrant\"` or `vectordb = \"pinecone\"` under\n`[pr_similar_issue]`.\n:::\n\n#### Qdrant Configuration\n\nTo use Qdrant with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[qdrant]\nurl = \"https://YOUR-QDRANT-URL\" # e.g., https://xxxxxxxx-xxxxxxxx.eu-central-1-0.aws.cloud.qdrant.io\napi_key = \"...\"\n```\n\nThen select Qdrant in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"qdrant\"\n```\n\nYou can get a free managed Qdrant instance from [Qdrant Cloud](https://cloud.qdrant.io/).\n\n`api_key` must be present even when the server does not enforce authentication (an empty string is accepted): the command reads both `url` and `api_key` and raises when either is absent. A re-index uploads the records from up to `max_issues_to_scan` issues.\n\nQdrant points are stored in a collection named `codium-ai-pr-agent-issues-v2`, derived by appending a `-v2` suffix to the shared index name (`codium-ai-pr-agent-issues`). The suffix is an implementation detail of the Qdrant backend only; pinecone and lancedb use the unsuffixed name.\n\nOn re-runs, the first run creates the collection and stores up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[Upgrading an index created before the point-id fix]\n\nEarlier versions derived the point id from the issue id alone, so the same issue number collided\nacross repositories. The id is now seeded with the repository name, which means points written by\nan earlier version are never rewritten or deleted - they still carry a matching `metadata.repo`\npayload, so they stay queryable and can surface alongside their replacements.\n\nThe `-v2` collection suffix sidesteps this: the new index is written to\n`codium-ai-pr-agent-issues-v2`, leaving the pre-existing `codium-ai-pr-agent-issues` collection\nuntouched. Nothing is deleted, and the first run after the upgrade re-indexes the repository into\nthe new collection. Once you are satisfied with the results, you can delete the old\n`codium-ai-pr-agent-issues` collection from Qdrant by hand to reclaim the storage.\n:::\n\n## How to use\n\n- Install the command's extra dependencies (vector databases and datasets), which a bare `uv sync` does not include:\n`uv sync --group similar-issue`\n\n- To invoke the 'similar issue' command from **CLI**, run:\n`uv run pr-agent --issue_url=... similar_issue`\n\n- To invoke the 'similar' issue command via online usage, [comment](https://github.com/the-pr-agent/pr-agent/issues/178#issuecomment-1716934893) on an issue:\n`/similar_issue`\n\n- To run automatically when an issue is opened, create a GitHub Actions workflow for the `issues: opened` event that invokes the CLI with that issue's URL. Adding `/similar_issue` to `github_app.pr_commands` does not handle issue-opened events.\n\n  With the default LanceDB backend, restore the configured `[lancedb] uri` directory (default `./lancedb`, relative to the CLI working directory) before running the CLI and save the updated directory afterward, or use a persistent remote Qdrant or Pinecone backend. On ephemeral hosted runners, an unpreserved local index is rebuilt on each run, repeating embedding costs for up to `max_issues_to_scan` issues (default `500`) and leaving previously indexed issues outside that batch unavailable for retrieval.\n","frontmatter":{"title":"Similar Issues","sidebar_position":8},"isInternal":false,"tokens":1991,"sizeBytes":8409},{"name":"update_changelog.md","path":"docs/docs/commands/update_changelog.md","rawUrl":"https://raw.githubusercontent.com/The-PR-Agent/pr-agent/HEAD/docs/docs/commands/update_changelog.md","title":"Command: /update_changelog","category":"command-prompt","format":"markdown","content":"---\ntitle: \"Update Changelog\"\nsidebar_position: 11\n---\n\n## Overview\n\nThe `update_changelog` command automatically updates a Markdown changelog with the PR changes.\nIt uses `CHANGELOG.md` at the repository root by default; `pr_update_changelog.changelog_path` selects a different file.\nIt can be invoked manually by commenting on any PR:\n\n```\n/update_changelog\n```\n\nEmpty or fence-only model responses are retried with the configured fallback models. If no model returns usable content, the command stops without writing to the changelog or publishing an update comment.\n\nHost operators can also opt in to forwarding the newly generated entry to the existing\n[push outputs](../usage-guide/push_outputs.md) destinations by selecting `update_changelog` in\n`push_outputs.commands`. These notifications contain a draft, not confirmation of a repository write.\n\n## Example usage\n\n<img src=\"/img/update_changelog_comment.png\" alt=\"update_changelog_comment\" width=\"768\" />\n\n<img src=\"/img/update_changelog.png\" alt=\"update_changelog\" width=\"768\" />\n\n## Configuration options\n\nUnder the section `pr_update_changelog`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'update changelog' command:\n\n- `changelog_path`: repository-relative path to the Markdown changelog, such as `HISTORY.md` or `docs/CHANGELOG.md`. Default is `CHANGELOG.md`. Set it in the root `.pr_agent.toml` or host configuration; comment/CLI arguments and per-directory settings cannot override it.\n- `push_changelog_changes`: whether to push the changes to the selected changelog, or just publish them as a comment. Default is false (publish as comment). Before pushing, the command requires a confirmed read of that file; a confirmed missing file is treated as empty, while other read failures skip the repository write, attempt to publish a not-pushed fallback comment, and surface the original error. If the repository write itself fails, the command makes one best-effort attempt to publish the generated changelog as a fallback and surfaces the original write error. Because a transport failure may happen after a completed remote write, this fallback reports the repository update as unconfirmed rather than promising it was not pushed.\n- `extra_instructions`: Optional extra instructions to the command. For example: \"Use the following structure: ...\"\n- `add_pr_link`: whether the model should try to add a link to the PR in the changelog. Default is true.\n- `skip_ci_on_push`: whether the commit message (when `push_changelog_changes` is true) will include the term \"[skip ci]\", preventing CI tests to be triggered on the changelog commit. Default is true.\n\n### Custom changelog location\n\nFor a changelog stored under `docs/`, add this to the repository's root `.pr_agent.toml`:\n\n```toml\n[pr_update_changelog]\nchangelog_path = \"docs/CHANGELOG.md\"\n```\n\nThen invoke `/update_changelog` as usual. The command reads that file to follow its existing structure and,\nwhen `push_changelog_changes` is enabled, prepends the new entry to the same file on the PR branch.\nComment-only output also uses the selected file as context and names it in the commit instructions.\n\nThe path must be a non-empty repository-relative file path using `/` separators, without empty,\n`.` or `..` components, Windows drive prefixes, backslashes, or control characters. Invalid values stop\nthe command before reading repository content. Spaces and Unicode names are accepted and kept exactly as written. The command updates\none Markdown changelog per command; it does not discover files, expand globs, or select a file per package.\nThe filename need not end in `.md`, but the generated content remains Markdown.\n","frontmatter":{"title":"Update Changelog","sidebar_position":11},"isInternal":false,"tokens":791,"sizeBytes":3751}],"systemPromptSnippet":"<yakaai_skills repo=\"The-PR-Agent/pr-agent\">\n<!-- File: AGENTS.md (Tokens: ~3341 | Category: root-instruction) -->\n# Repository Guidelines\n\nThis file is the shared source of repository guidance for coding agents. Tool-specific instruction files should import it instead of repeating repository-wide rules.\n\n## Dos and Don’ts\n\n- **Do** match the interpreter requirement declared in `pyproject.toml` (Python ≥ 3.12) and install dependencies with `uv sync` (runtime + dev, from `uv.lock`) before running tools.\n- **Do** run tests with `PYTHONPATH=.` set to keep imports functional (for example `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`).\n- **Do** adjust configuration through `.pr_agent.toml` or files under `pr_agent/settings/` instead of hard-coding values.\n- **Don’t** commit secrets or access tokens; rely on environment variables as shown in the health and e2e tests.\n- **Don’t** reformat or reorder files globally; match existing 120-character lines, import ordering, and docstring style.\n- **Don’t** delete or rename configuration, prompt, or workflow files without maintainer approval.\n\n## Project Structure and Module Organization\n\nPR-Agent automates AI-assisted reviews for pull requests across multiple git providers.\n\n- `pr_agent/agent/` orchestrates commands (`review`, `describe`, `improve`, etc.) via `pr_agent/agent/pr_agent.py`.\n- `pr_agent/commands/` implements individual capabilities such as reviewers, code suggestions, docs updates, and label generation.\n- `pr_agent/algo/` contains shared algorithms, model handlers, prompt/token handling, types, and utilities.\n- `pr_agent/git_providers/` handles integrations with GitHub, GitLab, Bitbucket (cloud and server), Azure DevOps, Gitea, Gerrit, CodeCommit, local checkouts, and plain diffs; `pr_agent/identity_providers/` handles identity and `pr_agent/secret_providers/` handles secrets.\n- `pr_agent/settings/` stores Dynaconf defaults (prompts, configuration templates, ignore lists) respected at runtime; `.pr_agent.toml` overrides repository-level behavior.\n- `pr_agent/servers/` contains webhook and service entrypoints.\n- `tests/unittest/`, `tests/e2e_tests/`, and `tests/health_test/` contain pytest-based unit, end-to-end, and smoke checks.\n- `docs/` holds the Docusaurus site (`docs/docusaurus.config.js` and `docs/sidebars.js` plus content under `docs/docs/`); theme overrides live in `docs/src/` and static assets in `docs/static/`.\n- `.github/workflows/` defines CI pipelines for unit tests, coverage, docs deployment, pre-commit, and PR-agent self-review.\n- `docker/` provides build targets for services (`github_app`, `gitlab_webhook`, etc.) and the `test` stage used in CI; the root `Dockerfile.github_action_dockerhub` only wraps the published `github_action` image for `action.yaml`.\n\n## Architecture and Request Flow\n\nPR-Agent is a CLI/server that runs AI-powered commands (`/review`, `/describe`, `/improve`, `/ask`, etc.) against pull requests on supported git providers or local input. The main dispatch flow is `pr_agent/agent/pr_agent.py` → `command2class` → a command class under `pr_agent/commands/`.\n\nA command generally obtains the appropriate git provider, gathers pull-request context, prepares prompt variables and templates, calls the configured model handler, and publishes or stores the result through the provider.\n\n### Prompt Building\n\nPrompt-driven commands generally construct a `self.vars` dictionary and pass it with the system/user prompt strings to `TokenHandler`. Prompt rendering uses Jinja2 with `StrictUndefined`, so variables referenced by a template should be present in the corresponding vars dictionary; define optional values explicitly and guard optional sections with Jinja conditionals.\n\nSystem/user prompt strings live as TOML files under `pr_agent/settings/` and are loaded into `global_settings` by `pr_agent/config_loader.py`. Command and prompt names normally correspond, for example:\n\n- `pr_reviewer.py` ↔ `pr_reviewer_prompts.toml`\n- `pr_description.py` ↔ `pr_description_prompts.toml`\n- `pr_questions.py` ↔ `pr_questions_prompts.toml`\n\nNew prompt files must also be registered in the `settings_files=[...]` list in `pr_agent/config_loader.py` or they will not be loaded into `global_settings`.\n\n### Settings and Runtime Configuration\n\nUse `get_settings()` from `pr_agent/config_loader.py` as the shared settings accessor. It returns the request-scoped Dynaconf object from `starlette_context` when one is present, otherwise the module-level `global_settings` object.\n\nDefaults live in `pr_agent/settings/configuration.toml`. Per-repository overrides come from the repository's `.pr_agent.toml` and are applied by `pr_agent/git_providers/utils.py::apply_repo_settings` before command dispatch. When introducing a configuration section, add its defaults and comments to `configuration.toml` and keep related prompt/config changes synchronized.\n\nWhen a key's detail belongs in a docs page, keep its `configuration.toml` comment to one line under 160 characters that states what the key does and its allowed values, then point to that page.\n\n`docs/docs/usage-guide/configuration_reference.md` is generated from `configuration.toml` by `python scripts/generate_config_reference.py [output_path]` (run from the repository root), and its header says not to edit it by hand. Write the output to a temporary path and diff it against the page before replacing anything. `tests/unittest/test_config_reference.py` checks that the page matches the generator output, lists exactly the active keys, and asserts a hard-coded active-key count, so update that count when adding or removing keys.\n\nRepository overrides are filtered by `pr_agent/config_security.py`; host-only keys must be supplied through host configuration. Configuration file merges preserve other fields in a section but replace overlapping list/dict values rather than appending or deep-merging; environment variables take precedence.\n\nSensitive values should stay in environment variables or the gitignored `.secrets.toml` files under `pr_agent/settings/` and `pr_agent/settings_prod/`. `apply_secrets_manager_config()` optionally loads values from AWS Secrets Manager.\n\n### Git Providers\n\n`pr_agent/git_providers/` contains provider implementations that share the `GitProvider` interface in `pr_agent/git_providers/git_provider.py`. Provider-dependent behavior should be selected through capability checks such as `provider.is_supported(\"feature\")` rather than concrete provider-type checks, because individual providers can stub or override capabilities. Some output is gated this way too: semantic file types and several other `/describe` sections are only emitted where `gfm_markdown` is supported.\n\n### Servers and Entrypoints\n\n`pr_agent/servers/` hosts webhook and service entrypoints that translate provider events into `PRAgent.handle_request(...)` calls. The CLI entrypoint is `pr_agent/cli.py`, registered as the `pr-agent` console script.\n\n## Build, Test, and Development Commands\n\n- Install dependencies (runtime + dev) into a project virtualenv from the lockfile with `uv sync` using a uv version that satisfies `tool.uv.required-version` in `pyproject.toml`; `uv run` auto-syncs before each command.\n- Run a single unit test (verified): `PYTHONPATH=. uv run pytest tests/unittest/test_output_models.py -q`.\n- Run the full unit suite: `PYTHONPATH=. uv run pytest tests/unittest -v`.\n- CI also runs `uv run pytest -q tests/packaging/test_help_docs_package.py`; it is outside `testpaths`, so the unit suite does not cover it. The distribution-contract test checks that the installed uv version satisfies `tool.uv.required-version` in `pyproject.toml`.\n- Execute the CLI locally once dependencies and API keys are available: `uv run pr-agent --pr_url <https://host/org/repo/pull/123> review`.\n- Build the test Docker target mirror of CI when containerizing: `docker build -f docker/Dockerfile --target test .` (loads dev dependencies and copies `tests/`).\n- Build the documentation the same way CI does (Node.js 22): `npm ci` then `npm run build` from `docs/`; `npm start` serves a live preview. After building, run `python3 scripts/check_docs_urls.py` from the repository root to check `docs/build` as CI does. The `docs-ci` workflow publishes `docs/build` to GitHub Pages.\n\n## Coding Style and Existing Tooling\n\nRuff is the single linting tool: `pyproject.toml` configures it and the pre-commit Ruff hook enforces it (Flake8 and the standalone isort hook have been removed).\n\n- Keep Python lines within the 120-character limit declared in `pyproject.toml`.\n- `pyproject.toml` configures Ruff rules `E`, `F`, `B`, `I`, `UP`, `FURB`,  `PERF` and `PLE`. Within the files touched by the task, fix lint violations rather than adding ignore entries. Remove corresponding ignore entries only when they are no longer needed, and preserve intentional exceptions.\n- Before committing, run `uv run ruff check --fix <paths>` on the Python files you touched and fix every issue it reports. Keep fixes mechanical (rename, remove unused imports, sort imports); do not alter program logic while cleaning up — if a lint fix would change behavior, surface it instead of applying it silently.\n- `.pre-commit-config.yaml` is the source of truth for enabled pre-commit hooks. Run them on the files you touched with `uvx pre-commit run --files <paths>` and review the automatic edits so unrelated changes are not included. The pre-commit GitHub Actions workflow runs on pull requests, so the hooks are enforced in CI.\n- No general-purpose Python formatter is currently enforced (`ruff format` is deliberately not adopted yet). Preserve the surrounding file's formatting and avoid unrelated rewrites or repository-wide formatting.\n- Prefer double quotes for Python strings where consistent with the surrounding file.\n- Match existing docstring and comment style—concise English comments using imperative phrasing only where necessary.\n- Configuration files in `pr_agent/settings/` are TOML; preserve formatting, section order, and comments when editing prompts or defaults.\n- Markdown in `docs/` uses Docusaurus conventions: every page starts with YAML front matter (`title`, `sidebar_position`), admonitions use `:::note` fences, collapsible sections use `<details>`, and images live in `docs/static/img/` referenced as `/img/<file>`. Pages stay `.md` (CommonMark) unless they need a JSX component, in which case they are `.mdx`. Register every new page in `docs/sidebars.js`.\n\n## Testing Guidelines\n\n- Pytest is the standard framework; keep new tests under the closest matching directory (`tests/unittest/` for unit logic, `tests/e2e_tests/` for integration flows, `tests/health_test/` for smoke coverage).\n- Pytest configuration lives in `pyproject.toml`, including `asyncio_mode = \"auto\"` and `testpaths = [\"tests/unittest\"]`. The Docker test image keeps `pyproject.toml` at `/app` (uv installs from it), so CI inherits these settings as well. Plain `PYTHONPATH=. uv run pytest` therefore defaults to the unit suite; invoke end-to-end tests explicitly.\n- Prefer focused unit tests that isolate helpers in `pr_agent/algo/`, `pr_agent/commands/`, or provider adapters; use parameterized tests where existing files already do so.\n- Set `PYTHONPATH=.` when invoking pytest from the repository root to avoid import errors.\n- End-to-end suites require provider credentials and may take several minutes; `TOKEN_GITHUB`, `TOKEN_GITLAB`, `BITBUCKET_USERNAME`, and `BITBUCKET_PASSWORD` are CI secret names, not runtime environment variables (see the mappings in `.github/workflows/e2e_tests.yaml`). These tests create remote branches and pull/merge requests and expect deployed apps/webhooks to process them; run them only when credentials and sandboxes are configured.\n- `tests/health_test/main.py` is a manual script for `/describe`, `/review`, and `/improve`; it asserts artifact headers inline, not checked-in artifact files. Update those inline assertions if prompts change meaningfully. CI provider smoke runs `tests/health_test/test_github_smoke.py` instead (`/describe` only, model stubbed, `GITHUB.USER_TOKEN`).\n\n## Review Checklist\n\n- A setting can arrive as a TOML list, a plain string, or an environment value that Dynaconf parses as TOML (`SECTION__KEY=123` arrives as an int). Code that reads it handles each form.\n- A fix in one git provider, AI handler or server usually applies to its siblings. Check the same logic in the others and fix them or name them in the PR.\n- New or changed regexes run in linear time: no nested or adjacent unbounded quantifiers that can match the same characters, and no unbounded leading quantifier in an unanchored search. User-supplied patterns and globs get a length cap before they are compiled or translated.\n- Docs and config comments describe what the branch does. A PR that changes a default or a setting's behavior updates the `configuration.toml` comment and the docs page that state it, and none documents behavior from another PR.\n\n## Commit and Pull Request Guidelines\n\n- Follow `CONTRIBUTING.md`: keep changes focused, add or update tests, and use Conventional Commit-style messages (e.g., `fix: handle missing repo settings gracefully`).\n- Target branch names follow `feature/<name>` or `fix/<issue>` patterns for substantial work.\n- Reference related issues and update README or docs when user-facing behavior shifts.\n- Before requesting review, run the relevant local checks above and make sure the corresponding CI workflows (`build-and-test`, `pre-commit`) pass; coverage is collected and uploaded by `build-and-test` except on docs-page-only PRs, which run packaging and documentation checks instead; `docs-ci` builds the documentation on every pull request that touches `docs/**` (publishing only on pushes to `main` and `add-docs-portal`). That build fails on broken links and anchors, and also runs `scripts/check_docs_urls.py` to confirm the documentation URLs hardcoded in `pr_agent/` and the README still resolve.\n- Include screenshots or terminal captures when modifying user-visible output or documentation previews.\n\n## Safety and Permissions\n\n- Ask for confirmation before adding dependencies, renaming files, or changing workflow definitions; many consumers embed these paths and prompts.\n- Stay within existing formatting and directory conventions—avoid mass refactors, re-sorting of prompts, or reformatting Markdown beyond the touched sections.\n- You may read files, list directories, and run targeted lint/test/doc commands without prior approval; coordinate before launching full Docker builds or e2e suites that rely on external credentials.\n- Never commit cached credentials, API keys, or coverage artifacts; CI already handles secrets through GitHub Actions.\n- Treat prompt and configuration files as single sources of truth—keep related defaults and prompts under `pr_agent/settings/` synchronized when behavior changes. The root `.pr_agent.toml` is intended for this repository's hosted Qodo reviews, not as a mirror of the packaged defaults; some entries have no open-source implementation.\n\n## Security and Configuration Tips\n\n- Secrets should be supplied through environment variables (see usages in `tests/e2e_tests/test_github_app.py` and `tests/health_test/main.py`); do not persist them in code or configuration files.\n- Adjust runtime behavior by overriding keys in `.pr_agent.toml` or by supplying repository-specific Dynaconf files; keep overrides minimal and documented inside the PR description.\n- Review `SECURITY.md` before disclosing vulnerabilities and follow its contact instructions for responsible reporting.\n\n<!-- File: docs/docs/commands/add_docs.md (Tokens: ~931 | Category: command-prompt) -->\n---\ntitle: \"Add Docs\"\nsidebar_position: 6\n---\n\n## Overview\n\nThe `add_docs` command scans the PR code changes and suggests documentation for any code components that are missing documentation, such as functions, classes, and methods.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/add_docs\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/add_docs` on any PR:\n\n<img src=\"/img/add_docs_comment.png\" alt=\"Add Docs\" width=\"512\" />\n\nThe command will generate documentation suggestions as inline code suggestions.\n\n### Language-specific documentation styles\n\nThe command automatically detects the programming language and generates documentation in the appropriate format:\n\n| Language | Documentation Format |\n|----------|---------------------|\n| Python | Docstrings (Sphinx, Google, Numpy styles) |\n| Java | Javadocs |\n| JavaScript/TypeScript | JSdocs |\n| C++ | Doxygen |\n| Other | Generic documentation |\n\n## Configuration options\n\nUnder the section `[pr_add_docs]`, the following options are available:\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `extra_instructions` | string | `\"\"` | Additional instructions for the AI model |\n| `docs_style` | string | `\"Sphinx\"` | Documentation style for Python. Options: `\"Sphinx\"`, `\"Google Style with Args, Returns, Attributes...etc\"`, `\"Numpy Style\"`, `\"PEP257\"`, `\"reStructuredText\"` |\n| `use_repo_context` | boolean | `true` | Apply conventions from configured repository instruction files (for example `AGENTS.md`); set to `false` to opt out |\n\n### Example configuration\n\nTo customize the documentation style, add the following to your configuration file:\n\n```toml\n[pr_add_docs]\ndocs_style = \"Google Style with Args, Returns, Attributes...etc\"\nextra_instructions = \"Focus on documenting public methods and include usage examples\"\n```\n\nBy default, `/add_docs` follows the shared `config.repo_context_files` selection (`[\"AGENTS.md\"]` by default,\nread from the repository default branch). To disable repository instructions for `/add_docs` only:\n\n```toml\n[pr_add_docs]\nuse_repo_context = false\n```\n\nStructured sibling-repository entries in `config.repo_context_files` are excluded from `/add_docs` to avoid publishing private sibling guidance in PR suggestions. Local repository entries remain in effect.\n\nSetting `config.repo_context_files = []` disables repository instructions across commands. Repository instructions\nare optional prompt context: if they do not fit the selected model's input budget, they are omitted without shortening\nthe PR diff. Explicit `extra_instructions` and `docs_style` take precedence. Repository instructions may add file\nreads and prompt tokens, but do not introduce another model call.\nRepository instructions are appended to the rendered system prompt, including with custom `[pr_add_docs_prompt]`\ntemplates. Existing template variables and diff rendering are left unchanged.\n\n### Command line options\n\nYou can pass configuration options directly in the command:\n\n```\n/add_docs --pr_add_docs.docs_style=\"Numpy Style\"\n```\n\n## How it works\n\n1. The command analyzes the PR diff to identify code components (functions, classes, methods) that lack documentation\n2. It uses AI to generate appropriate documentation based on the code context and language\n3. Documentation suggestions are published as inline code suggestions that can be applied with a single click\n\n### Model response failures\n\nEach model response is validated before it is accepted. Missing content or an\ninvalid documentation structure triggers the next model in `CONFIG.FALLBACK_MODELS`,\nif configured. An explicit empty list or `Code Documentation: null` is a valid\nempty result and does not trigger another model call.\n\nIf all model attempts fail, PR-Agent records the command as failed and removes\nthe temporary progress comment. With `CONFIG.PUBLISH_OUTPUT` enabled, it also\nattempts to post **Failed to generate code documentation for this PR.**\n\n### Publication failures\n\nSuggestions are skipped if their original source line cannot be reliably retained,\nincluding when file content is unavailable or incomplete. Valid suggestions in the\nsame response can still be published.\n\nWith `CONFIG.PUBLISH_OUTPUT` enabled, PR-Agent retries unsuccessful batch\npublication one suggestion at a time. If the batch and every individual retry\nexplicitly report failure, it attempts to post **Failed to publish code\ndocumentation for this PR.** and records the command as failed. Partial success\nor an unconfirmed provider result does not trigger this all-failed outcome.\n\n<!-- File: docs/docs/commands/ask.md (Tokens: ~2409 | Category: command-prompt) -->\n---\ntitle: \"Ask\"\nsidebar_position: 5\n---\n\n## Overview\n\nThe `ask` command answers questions about the PR, based on the PR code changes. Make sure to be specific and clear in your questions.\nIt can be invoked manually by commenting on any PR:\n\n```\n/ask \"...\"\n```\n\n## CLI JSON output\n\nThe CLI can write a single JSON file containing the question, answer, and available token usage:\n\n```bash\npython -m pr_agent.cli --pr_url https://github.com/org/repo/pull/123 \\\n    --json-output answer.json ask \"What changed?\"\n```\n\nThis also works with `ask_question` and in [Plain Diff mode](../usage-guide/plain_diff_mode.md):\n\n```bash\ngit diff | python -m pr_agent.cli --stdin --json-output answer.json ask \"What changed?\"\n```\n\nPlace `--json-output` before the command. The file is overwritten for each invocation and has\n`question`, `answer`, and `usage` fields. `usage` is an empty object when token counts are unavailable,\nincluding when the command explains that no changed files could be analyzed without calling a model.\n\nFor PR URLs, setting `config.publish_output = false` in the host configuration suppresses PR\ncomments without suppressing the requested JSON file. The existing\n[push outputs](../usage-guide/push_outputs.md) feature serves a different purpose: it delivers\nopt-in Ask records to operator-configured sinks and requires publishing to be enabled.\n\n## Example usage\n\n<img src=\"/img/ask_comment.png\" alt=\"Ask Comment\" width=\"512\" />\n\n<img src=\"/img/ask.png\" alt=\"Ask\" width=\"512\" />\n\n## Repository instructions\n\nBoth top-level `/ask` and inline `/ask_line` can use the same repository instruction files as `/review`, `/describe`, and `/improve`.\nFor example, ask whether a migration follows the rollback rules in an existing architecture decision record:\n\n```toml\n[config]\nrepo_context_files = [\"AGENTS.md\", \"docs/adr/database-migrations.md\"]\n```\n\n```text\n/ask \"Does this migration follow our rollback and compatibility rules?\"\n```\n\nLike `/review`, `/describe`, and `/improve`, both Ask modes read `AGENTS.md` from the repository root by default.\nSet `config.repo_context_files = []` in the root repository settings to disable repository instructions for all commands.\nComment arguments cannot change the configured file list.\n\nThe existing [repository context settings](../usage-guide/additional_configurations.md#bringing-per-repo-context-files-to-pr-agent)\ncontrol file selection, source branches, imports, and line limits. Files come from the repository's default branch unless\nconfigured otherwise. Providers without repository file access skip this context; missing or empty files are also skipped.\n\nThe question, selected discussion history, and packed diff keep their existing token budget. The instruction block,\nalready bounded by `repo_context_max_lines`, is included only if it fits in the remaining model context in full.\nOtherwise, the corresponding Ask mode keeps its original prompt and adds a short omission notice to the answer. It does not retry another model\njust to fit instructions. Normal model retries reconsider the original instruction block without reading the files again.\nFor `/ask_line`, the selected lines, complete diff hunk, and fitted thread history likewise take precedence over\nrepository instructions. No instruction files are read when the requested diff hunk is unavailable.\nIncluding repository instructions can add repository API reads and input tokens, but does not add a separate model request.\n\n## Ask lines\n\nYou can run `/ask` on specific lines of code in the PR from the PR's diff view. The command will answer questions based on the code changes in the selected lines.\n\nFor line comments handled by the GitHub App, GitHub Actions, or GitLab webhook, `/ask_question` is an alias of `/ask`.\nStart the comment with `/ask`, `/ask_question`, or `/ask_line` after any leading whitespace;\nthese command names are case-insensitive. Other tokens such as `/asking` are not Ask commands.\nAzure DevOps accepts lowercase `/ask_question` for the same thread and line handling as `/ask`;\nits webhook command names remain case-sensitive.\n\n- Click on the '+' sign next to the line number to select the line.\n- To select multiple lines, click on the '+' sign of the first line and then hold and drag to select the rest of the lines.\n- write `/ask \"...\"` in the comment box and press `Add single comment` button.\n\n<img src=\"/img/Ask_line.png\" alt=\"Ask Line\" width=\"512\" />\n\nIf no matching diff hunk is found for the selected lines, the command explains this without calling a model.\n\nIn the GitHub App, GitHub Actions, and GitLab webhook, a file comment whose first non-whitespace token is `/ask` or\n`/ask_question` uses that file's complete diff as context. These two command names are case-insensitive.\nThe existing file filters and input budgets still apply. If the file has no analyzable diff, or the question cannot\nbe prepared within the configured input budget, the command explains this without calling a model.\nThe answer is posted in the original file-comment thread with a link to the question.\nEarlier replies are included when `pr_questions.use_conversation_history` is enabled and the input budget allows.\nText resembling command options is treated as part of the question.\n\nIn the Azure DevOps webhook, `/ask`, `/ask_question`, or a mention of PR-Agent in a thread on a whole file also uses\nthat file's complete diff, with the same filters, input budgets, and notes. The answer is posted in that thread with a\nlink to the question, and earlier comments in the thread are included as described above.\n\nWith `pr_questions.use_conversation_history=true` (the default), line questions on GitHub, GitLab, and Azure DevOps\ncan include earlier comments from the same thread. Azure DevOps also supports history for threaded top-level questions.\nOther questions are answered independently.\n\nOn GitLab, this reads the selected discussion before answering, adding an API request and potentially more model input\ntokens, but no separate model request. Set `pr_questions.use_conversation_history=false` to answer without earlier\ncomments. Line questions still require a matching hunk in the current diff.\n\n## Ask on images\n\nYou can also ask questions about images that appear in the comment, where the entire PR code will be used as context.\n<br>\nThe basic syntax is:\n\n```\n/ask \"...\"\n\n[Image](https://real_link_to_image)\n```\n\nwhere `https://real_link_to_image` is the direct link to the image.\n\nNote that GitHub has a built-in mechanism of pasting images in comments. However, pasted image does not provide a direct link.\nTo get a direct link to an image, we recommend using the following scheme:\n\n1. First, post a comment that contains **only** the image:\n\n   <img src=\"/img/ask_images1.png\" alt=\"Ask image1\" width=\"512\" />\n\n2. Quote reply to that comment:\n\n   <img src=\"/img/ask_images2.png\" alt=\"Ask image2\" width=\"512\" />\n\n3. In the screen opened, type the question below the image:\n\n   <img src=\"/img/ask_images3.png\" alt=\"Ask image3\" width=\"512\" />\n   <img src=\"/img/ask_images4.png\" alt=\"Ask image4\" width=\"512\" />\n\n4. Post the comment, and receive the answer:\n\n   <img src=\"/img/ask_images5.png\" alt=\"Ask image5\" width=\"512\" />\n\nSee a full video tutorial [here](https://www.qodo.ai/images/pr_agent/ask_image_video.mov)\n\n## Linked ticket context\n\nEnable linked ticket context when asking how a PR satisfies an issue's requirements or acceptance criteria:\n\n```toml\n[pr_questions]\nuse_ticket_context = true\n```\n\nSet this in host or root repository configuration. PR comment/CLI arguments and per-directory files\ncannot enable it because ticket integrations use the operator's credentials.\n\nThis is disabled by default and applies to top-level `/ask` and `ask_question`, not inline `/ask_line` questions.\nIt uses the same [ticket integrations](../core-abilities/fetching_ticket_context.md), credentials, reference formats,\naccess checks and fetch limits as `/review` and `/describe`. Tickets are discovered from the PR/MR metadata;\nlinks written only in the question are not additional ticket sources. This option is independent of\n`pr_reviewer.require_ticket_analysis_review`.\n\nTicket integrations use the operator's configured access policy, not the asker's personal ticket credentials.\nFor Jira, the host-controlled `jira.project_keys` allowlist still applies (`[]` disables lookups);\nconfigure only projects whose ticket content may appear in PR answers.\n\nTicket content is fetched once per command, after an analyzable diff fits. It adds API reads and input tokens\nwhen enabled and uses the existing model request. Unavailable tickets are skipped. Each model attempt includes only\nwhole ticket records that fit after the existing question, conversation history and selected diff, so ticket\ncontext does not displace code already selected for the answer. Large tickets may be omitted, including all\ntickets when there is no room. The usual diff-based answer remains available in that case.\n\n## Configuration options\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>ask_heading</b></td>\n    <td>\n      Plain-text heading for top-level <code>/ask</code> answers. The default is <code>Ask</code>.\n      Markdown renderers escape punctuation to keep the surrounding formatting and ❓ emoji fixed,\n      while plain-text converters publish the configured text without escape characters.\n      This does not affect <code>/ask_line</code> replies or the <code>Answer</code> section heading.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10. Instead, tell the user this type of question is not allowed.\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>use_conversation_history</b></td>\n    <td>If set to true, the command will use the conversation history from the same thread when answering questions on specific code lines (GitHub, GitLab, and Azure DevOps) or threaded top-level questions (Azure DevOps only). Default is true.</td>\n  </tr>\n  <tr>\n    <td><b>use_ticket_context</b></td>\n    <td>Include linked ticket content in top-level questions using the remaining prompt budget. Default is false. See <a href=\"#linked-ticket-context\">Linked ticket context</a>.</td>\n  </tr>\n</table>\n\n</details>\n\nExample usage in a configuration file:\n\n```toml\n[pr_questions]\nask_heading = \"Architecture Question\"\nextra_instructions = \"Do not answer questions that ask to rate PR quality on a scale of 1 to 10.\"\n```\n\nThe heading above renders as `### **Architecture Question** ❓`.\n\nExample usage in a PR comment:\n\n```\n/ask \"What does this change do?\" --pr_questions.extra_instructions=\"Answer in one short paragraph.\"\n```\n\n<!-- File: docs/docs/commands/describe.md (Tokens: ~3332 | Category: command-prompt) -->\n---\ntitle: \"Describe\"\nsidebar_position: 2\n---\n\n## Overview\n\nGenerate a PR title, type, summary, code walkthrough and labels.\n\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or it can be invoked manually by commenting on any PR:\n\n```\n/describe\n```\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/describe` on any PR:\n\n<img src=\"/img/describe_comment.png\" alt=\"Describe comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a description for the PR:\n\n<img src=\"/img/describe_new.webp\" alt=\"Describe New\" width=\"512\" />\n\nWhile a large PR's chunks run, the temporary `Preparing PR description...` comment is rewritten in place, for example `Preparing PR description... analyzed 2 of 3 chunks`; once every chunk has settled, `, 1 chunk failed` is added if a chunk gave up. This needs `config.publish_output_progress` and a provider that can edit and remove comments; single-chunk runs keep the plain placeholder.\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/describe --pr_description.some_config1=... --pr_description.some_config2=...\n```\n\nFrom the CLI, save the generated description and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output describe.json describe\n```\n\nThe JSON file is written after the description is assembled. Place `--json-output` before `describe` or `describe_pr`; it works with `--pr_url` or with plain-diff input (`--stdin` or `--diff-file`).\n\n### Automatic triggering\n\nTo run the `describe` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/describe\",\n    ...\n]\n\n[pr_description]\npublish_labels = true\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_description]` section contains the configurations for the `describe` command you want to edit (if any).\n\n## File walkthrough summaries\n\nOn providers that support the HTML walkthrough, short file summaries appear on a new line after the filename.\nWhen detailed changes are available, expanding the file entry reveals them while the short summary stays visible when collapsed.\nGitLab descriptions no longer use description-list indentation for these summaries.\n\nThe description reader can extract file summaries from both the current and legacy walkthrough formats.\nIf separate PR-Agent installations generate walkthroughs and reuse their file summaries (for example, `/describe` and `/review`), upgrade them together; older readers cannot extract file summaries from the new format.\n\n## Preserving the original user description\n\nBy default, PR-Agent tries to preserve your original PR description by placing it above the generated content.\nThis requires including your description during the initial PR creation.\n\n\"PR-Agent removed the original description from the PR. Why\"?\n\nFrom our experience, there are two possible reasons:\n\n- If you edit the description _while_ the automated command is running, a race condition may occur, potentially causing your original description to be lost. Hence, create a description before launching the PR.\n\n- When _updating_ a description previously generated by PR-Agent, `/describe` preserves text after the first recognized `### **User description**` heading until the next recognized boundary heading, trimming surrounding whitespace and a trailing `___`. If no boundary heading follows, it stops at the first `___` substring, or at the end if none is present, and trims surrounding whitespace. If the generated description has no recognized `### **User description**` heading, add that heading before your manual text; otherwise that text can be lost on the next body update.\n\n  Boundary headings are lines starting with `### **PR type**`, `### **PR description**`, `### **PR labels**`, `### **Type**`, `### **Description**`, `### **Labels**`, or `### 🤖 Generated by PR Agent`, matched case-insensitively outside fenced code blocks. Manual headings with these prefixes also end preservation, even if more text follows the prefix. Keep manual edits inside these boundaries; edits to generated sections are replaced.\n\n<img src=\"/img/pr_description_user_description.png\" alt=\"Describe comment\" width=\"512\" />\n\n## Flowchart Support {#sequence-diagram-support}\nThe `/describe` command includes a Mermaid flowchart summarizing the main PR changes on providers that support `gfm_markdown`.\n\nThis option is enabled by default via the `pr_description.enable_pr_diagram` param.\n\nThe direction of the diagram adapts to its shape. A diagram whose longest chain of nodes exceeds `pr_description.pr_diagram_direction_threshold` is drawn top-down rather than left-to-right, so that wide diagrams are not scaled down until they become unreadable. Set `pr_description.pr_diagram_direction` to `LR` or `TD` to pin the direction instead.\n\n\n[//]: # (### How to enable\\disable)\n\n[//]: # ()\n[//]: # (In your configuration:)\n\n[//]: # ()\n[//]: # (```)\n\n[//]: # (toml)\n\n[//]: # ([pr_description])\n\n[//]: # (enable_pr_diagram = true)\n\n[//]: # (```)\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>Possible configurations</summary>\n\n<table>\n  <tr>\n    <td><b>publish_labels</b></td>\n    <td>If set to true, the command will publish labels to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment</b></td>\n    <td>If set to true, the command will publish the description as a comment to the PR. If false, it will overwrite the original description.</td>\n  </tr>\n  <tr>\n    <td><b>publish_description_as_comment_persistent</b></td>\n    <td>If set to true and `publish_description_as_comment` is true, the command will publish the description as a persistent comment to the PR.</td>\n  </tr>\n  <tr>\n    <td><b>add_original_user_description</b></td>\n    <td>If set to true, the command will add the original user description to the generated description.</td>\n  </tr>\n  <tr>\n    <td><b>generate_ai_title</b></td>\n    <td>If set to true, the command will also generate an AI title for the PR.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\"</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_type</b></td>\n    <td>If set to false, it will not show the `PR type` as a text value in the description content.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_description</b></td>\n    <td>If set to false, the AI-generated summary section will not be requested from the model, nor shown in the description content. The other sections (diagram, changes walkthrough) are unaffected.</td>\n  </tr>\n  <tr>\n    <td><b>final_update_message</b></td>\n    <td>If set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/the-pr-agent/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`.</td>\n  </tr>\n  <tr>\n    <td><b>enable_semantic_files_types</b></td>\n    <td>If set to true, \"Changes walkthrough\" section will be generated.</td>\n  </tr>\n  <tr>\n        <td><b>file_table_collapsible_open_by_default</b></td>\n        <td>Controls whether the file list in the \"Changes walkthrough\" section is initially open or closed.</td>\n  </tr>\n  <tr>\n    <td><b>collapsible_file_list</b></td>\n    <td>If set to true, the file list in the \"Changes walkthrough\" section will be collapsible. If set to \"adaptive\", the file list will be collapsible only when the number of files exceeds <code>collapsible_file_list_threshold</code>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_handling</b></td>\n    <td>If set to true, in case of a large PR the command will make several calls to the AI and combine them to be able to cover more files.</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_pr_diagram</b></td>\n    <td>If set to true, the command will generate a Mermaid flowchart summarizing the main pull request changes. This field remains empty if not applicable.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction</b></td>\n    <td>Direction of the generated Mermaid flowchart: <b>adaptive</b>, <b>LR</b> or <b>TD</b>. With adaptive, the direction is chosen from the shape of the diagram.</td>\n  </tr>\n  <tr>\n    <td><b>pr_diagram_direction_threshold</b></td>\n    <td>With <b>adaptive</b> direction, a diagram whose longest chain exceeds this many nodes is drawn top-down instead of left-to-right.</td>\n  </tr>\n</table>\n\n</details>\n\n## Markers template\n\nTo enable markers, set `pr_description.use_description_markers=true`.\nMarkers enable to easily integrate user's content and auto-generated content, with a template-like mechanism.\n\nFor example, if the PR original description was:\n\n```\nUser content...\n\n## PR Type:\npr_agent:type\n\n## PR Description:\npr_agent:summary\n\n## PR Walkthrough:\npr_agent:walkthrough\n\n## PR Diagram:\npr_agent:diagram\n```\n\nThe marker `pr_agent:type` will be replaced with the PR type, `pr_agent:summary` will be replaced with the PR summary, `pr_agent:walkthrough` will be replaced with the PR walkthrough, and `pr_agent:diagram` will be replaced with the flowchart (if enabled).\n\n<img src=\"/img/describe_markers_before.png\" alt=\"Describe markers before\" width=\"512\" />\n\nbecomes\n\n<img src=\"/img/describe_markers_after.webp\" alt=\"Describe markers after\" width=\"512\" />\n\n**Configuration params**:\n\n- `use_description_markers`: if set to true, the command will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false.\n- `include_generated_by_header`: only applies when `use_description_markers` is true. If true (default), the command adds a 'Generated by PR Agent at ...' header to automatic content when the provider supplies a head commit SHA, otherwise the header is 'Generated by PR Agent' (or uses `config.bot_display_name` when configured). If false, no header is added.\n- `diagram`: if present as a marker, will be replaced by the PR flowchart (if enabled).\n\n## Custom labels\n\nThe default labels of the describe command are quite generic, since they are meant to be used in any repo: [`Bug fix`, `Tests`, `Enhancement`, `Documentation`, `Other`].\n\nYou can define custom labels that are relevant for your repo and use cases.\nCustom labels can be defined in the PR-Agent host configuration, or directly in the repo's\n[labels page](#handle-custom-labels-from-the-repos-labels-page). The host configuration options cannot be set from\nthe repository's `.pr_agent.toml` or comment arguments.\n\nMake sure to provide proper title, and a detailed and well-phrased description for each label, so the command will know when to suggest it.\nEach label description should be a **conditional statement**, that indicates if to add the label to the PR or not, according to the PR content.\n\n<details open>\n<summary>Auto-remove custom label when no longer relevant</summary>\n\nIf the custom label is no longer relevant, it will be automatically removed from the PR by running the `generate_labels` command or the `describe` command.\n\n</details>\n\n\n### Handle custom labels from a configuration file\n\nExample for a custom labels configuration setup in the PR-Agent host configuration:\n\n```\n[config]\nenable_custom_labels=true\n\n\n[custom_labels.\"sql_changes\"]\ndescription = \"Use when a PR contains changes to SQL queries\"\n\n[custom_labels.\"test\"]\ndescription = \"use when a PR primarily contains new tests\"\n\n...\n```\n\n### Handle custom labels from the Repo's labels page\n\nYou can also control the custom labels that will be suggested by the `describe` command from the repo's labels page:\n\n- GitHub : go to `https://github.com/{owner}/{repo}/labels` (or click on the \"Labels\" tab in the issues or PRs page)\n- GitLab : go to `https://gitlab.com/{owner}/{repo}/-/labels` (or click on \"Manage\" -> \"Labels\" on the left menu)\n\nNow add/edit the custom labels. they should be formatted as follows:\n\n- Label name: The name of the custom label.\n- Description: Start the description of with prefix `pr_agent:`, for example: `pr_agent: Description of when AI should suggest this label`.<br>\n\nExamples for custom labels:\n\n- `Main topic:performance` -  pr_agent:The main topic of this PR is performance\n- `New endpoint` -  pr_agent:A new endpoint was added in this PR\n- `SQL query` -  pr_agent:A new SQL query was added in this PR\n- `Dockerfile changes` - pr_agent:The PR contains changes in the Dockerfile\n- ...\n\nThe description should be comprehensive and detailed, indicating when to add the desired label. For example:\n<img src=\"/img/add_native_custom_labels.webp\" alt=\"Add native custom labels\" width=\"768\" />\n\n## Usage Tips\n\n:::tip[Automation]\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app) for the describe command is:\n```\npr_commands = [\"/describe\", ...]\n```\nmeaning the `describe` command will run automatically on every PR, with the default configurations.\n:::\n\n- Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:\n\n   ```\n   pr_commands = [\"/describe --pr_description.use_description_markers=true\", ...]\n   ```\n\n   the command will replace every marker of the form `pr_agent:marker_name` in the PR description with the relevant content, where `marker_name` is one of the following:\n\n   - `type`: the PR type.\n   - `summary`: the PR summary.\n   - `walkthrough`: the PR walkthrough.\n\n- Note that when markers are enabled, if the original PR description does not contain any markers, the command will not alter the description at all.\n\n<!-- File: docs/docs/commands/generate_labels.md (Tokens: ~992 | Category: command-prompt) -->\n---\ntitle: \"Generate Labels\"\nsidebar_position: 7\n---\n\n## Overview\n\nThe `generate_labels` command scans the PR code changes and generates custom labels for the PR based on the content and context of the changes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/generate_labels\n```\n\n## Example usage\n\nInvoke the command manually by commenting `/generate_labels` on any PR.\n\nThe command will analyze the PR and add appropriate labels.\n\nFor local or CI workflows that need label suggestions without a hosting-provider token,\npass a unified diff and write the filtered labels to a JSON artifact:\n\n```bash\npython -m pr_agent.cli --diff-file changes.diff --json-output labels.json generate_labels\n```\n\nThe JSON result contains a `labels` list and a `usage` object (empty when token usage\nis unavailable). Only model-generated labels that pass the existing allowlist are included;\nlabels already on a hosted PR are not included. A PR without analyzable changes produces\nan empty list. This option does not change the normal label publication behavior.\nCheck the command's exit status before consuming the artifact: a failed run does not delete a previous JSON file.\n\n## Configuration options\n\nThe `generate_labels` command uses configurations from the `[pr_description]` section for custom labels.\n\n### Enabling custom labels\n\nTo use custom labels, you need to enable them in the configuration:\n\nSet these options in the PR-Agent host configuration. Repository `.pr_agent.toml` files and comment arguments cannot\nchange them.\n\n```toml\n[config]\nenable_custom_labels = true\n```\n\n### Defining custom labels\n\nYou can define your own custom labels in the `[custom_labels]` section. See the [custom_labels.toml](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/custom_labels.toml) file for examples.\n\nExample configuration:\n\n```toml\n[custom_labels.\"Bug fix\"]\ndescription = \"A fix for a bug in the codebase\"\n\n[custom_labels.\"Feature\"]\ndescription = \"A new feature or enhancement\"\n\n[custom_labels.\"Documentation\"]\ndescription = \"Documentation changes only\"\n\n[custom_labels.\"Tests\"]\ndescription = \"Adding or modifying tests\"\n\n[custom_labels.\"Refactoring\"]\ndescription = \"Code refactoring without functional changes\"\n```\n\n### How labels are applied\n\n1. The command analyzes the PR diff and commit messages\n2. It uses AI to determine which labels best match the PR content\n3. Labels are automatically applied to the PR (if the git provider supports it)\n4. If labels cannot be applied directly, they are published as a comment\n\nBoth `/generate_labels` and `/describe` filter model-generated labels before publishing.\nThe allowed set contains the built-in PR types (`Bug fix`, `Tests`, `Enhancement`,\n`Documentation`, `Other`) plus the configured custom label names when custom labels\nare enabled. With custom labels enabled but no custom set configured, the default\nset also includes `Bug fix with tests`. Matching ignores case, and unknown generated\nlabels are dropped with a warning. Existing human-added labels are preserved and\nare not restricted by this filter.\n\nPrompt enum keys such as `bug_fix` and `RELEASE_READY` are resolved to their\nallowed display names, ignoring case. If a nonempty model response contains only\nrejected labels, `/generate_labels` leaves the current labels unchanged. An\nexplicit `labels: []` response retains the existing behavior of clearing old\nbot-owned labels while preserving human-added labels.\n\nIf the current labels cannot be read, `/generate_labels` skips publication and\nrecords the command as failed. A known provider failure while publishing labels\nalso marks the command as failed. With `config.propagate_command_errors = true`, these\nfailures raise an error after temporary-comment cleanup.\n\nA successful provider acknowledgement means its label operation completed normally;\nit does not verify the final remote label set. Providers apply labels differently,\nand a failure can leave some changes applied. The command does not retry or roll\nback those changes. Labels generated by `/describe` and `/review` remain auxiliary\nto their primary output.\n\n## Comparison with `/describe` labels\n\nThe `/describe` command also generates labels as part of its output. The key differences are:\n\n| Feature | `/generate_labels` | `/describe` |\n|---------|-------------------|-------------|\n| Purpose | Dedicated label generation | Full PR description with labels |\n| Output | Labels only | Title, summary, walkthrough, and labels |\n| Custom labels | ✅ Supported | ✅ Supported |\n| Use case | When you only need labels | When you want a complete PR description |\n\n## Tips\n\n- Use custom labels that match your team's workflow and labeling conventions\n- Combine with automation to automatically label PRs when they are opened\n- Review the generated labels and adjust custom label descriptions if the AI consistently misclassifies PRs\n\n<!-- File: docs/docs/commands/help_docs.md (Tokens: ~1214 | Category: command-prompt) -->\n---\ntitle: \"Help Docs\"\nsidebar_position: 10\n---\n\n:::warning[`/help_docs` is currently disabled]\nAs of **v0.36.1**, the `/help_docs` command is temporarily disabled as a mitigation for a\ncredential-exposure vulnerability ([#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)):\nthe command accepted an untrusted runtime override of its git clone target, and the clone-URL\nhost validation only checked substring containment, so a host that merely *contained* the\nallowed host could receive the git provider token.\n\nThe command is not registered in `PRAgent`, so invoking it has no effect on any provider. The\npage below documents the command as it behaves once it is re-enabled.\n:::\n\n## Overview\n\nThe `help_docs` command can answer a free-text question based on a git documentation folder.\n\nIt can be invoked manually by commenting on any PR or Issue:\n\n```\n/help_docs \"...\"\n```\n\nOr configured to be triggered automatically when a [new issue is opened](../installation/github.md#run-as-a-github-action).\n\nThe command assumes by default that the documentation is located in the root of the repository, at `/docs` folder.\nHowever, this can be customized by setting the `docs_path` configuration option:\n\n```toml\n[pr_help_docs]\nrepo_url = \"\"                 # The repository to use as context\ndocs_path = \"docs\"            # The documentation folder\nrepo_default_branch = \"main\"  # The branch to use in case repo_url overwritten\n\n```\n\nSee more configuration options in the [Configuration options](#configuration-options) section.\n\n## Example usage\n\n[//]: # (#### Asking a question about this repository:)\n\n[//]: # (<img src=\"/img/help_docs_comment.png\" alt=\"help_docs on the documentation of this repository\" width=\"512\" />)\n\n**Asking a question about another repository**\n\n<img src=\"/img/help_docs_comment_explicit_git.png\" alt=\"help_docs on the documentation of another repository\" width=\"512\" />\n\n**Response**:\n\n<img src=\"/img/help_docs_response.png\" alt=\"help_docs response\" width=\"512\" />\n\n## Run automatically when a new issue is opened\n\nYou can configure PR-Agent to run `help_docs` automatically on any newly created issue.\nThis can be useful, for example, for providing immediate feedback to users who open issues with questions on open-source projects with extensive documentation.\n\nHere's how:\n\n1. Follow the steps depicted under [Run as a GitHub Action](../installation/github.md#run-as-a-github-action) to create a new workflow, such as:`.github/workflows/help_docs.yml`:\n\n2. Edit your yaml file to the following:\n\n   ```yaml\n   name: Run pr agent on every opened issue, respond to user comments on an issue\n\n   #When the action is triggered\n   on:\n     issues:\n       types: [opened] #New issue\n\n   # Read env. variables\n   env:\n     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n     GITHUB_API_URL: ${{ github.api_url }}\n     GIT_REPO_URL: ${{ github.event.repository.clone_url }}\n     ISSUE_URL: ${{ github.event.issue.html_url || github.event.comment.html_url }}\n     ISSUE_BODY: ${{ github.event.issue.body || github.event.comment.body }}\n     OPENAI_KEY: ${{ secrets.OPENAI_KEY }}\n\n   # The actual set of actions\n   jobs:\n     issue_agent:\n       runs-on: ubuntu-latest\n       if: ${{ github.event.sender.type != 'Bot' }} #Do not respond to bots\n\n       # Set required permissions\n       permissions:\n         contents: read    # For reading repository contents\n         issues: write     # For commenting on issues\n\n       steps:\n         - name: Run PR Agent on Issues\n           if: ${{ env.ISSUE_URL != '' }}\n           uses: docker://pragent/pr-agent:latest\n           with:\n             entrypoint: /bin/bash #Replace invoking cli.py directly with a shell\n             args: |\n               -c \"cd /app && \\\n               echo 'Running Issue Agent action step on ISSUE_URL=$ISSUE_URL' && \\\n               export config__git_provider='github' && \\\n                           export github__user_token=$GITHUB_TOKEN && \\\n               export github__base_url=$GITHUB_API_URL && \\\n               export openai__key=$OPENAI_KEY && \\\n               python -m pr_agent.cli --issue_url=$ISSUE_URL --pr_help_docs.repo_url=\"...\" --pr_help_docs.docs_path=\"...\" --pr_help_docs.openai_key=$OPENAI_KEY && \\\n               help_docs \"$ISSUE_BODY\"\n   ```\n\n3. Following completion of the remaining steps (such as adding secrets and relevant configurations, such as `repo_url` and `docs_path`) merge this change to your main branch.\n   When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is related to the documentation of the repository.\n\n---\n\n## Configuration options\n\nUnder the section `pr_help_docs`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'help docs' command:\n\n- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context.\n- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect.\n- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url).\n- `exclude_root_readme`:  Whether or not to exclude the root README file for querying the model.\n- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model.\n\n---\n\n<!-- File: docs/docs/commands/help.md (Tokens: ~315 | Category: command-prompt) -->\n---\ntitle: \"Help\"\nsidebar_position: 9\n---\n\n## Overview\n\nThe `help` command provides a list of all the available commands and their descriptions.\nInvoke commands by posting their slash commands. The checkboxes shown on GitHub do not execute commands when checked.\n\nOn Bitbucket Cloud, Gerrit and CodeCommit, `/help` without a question displays an unsupported-format notice instead of the command list. `/help <question>` can still answer questions from the documentation.\n\nLocal mode only displays the unsupported-format notice for `/help`. Plain-diff mode supports the command list, but `/help <question>` is currently unavailable in both local and plain-diff modes.\n\nIt can be invoked manually by commenting on any PR:\n\n```\n/help\n```\n\nCalling `/help` without a question displays the command list, where supported, without initializing an AI handler,\nso errors during that initialization do not block the list.\n`/help <question>` still uses the configured AI model.\n\nWhen answering a question, the command tries the configured fallback models if a model returns an invalid response format\nor an empty answer. If all attempts fail, no answer is published and the command records a failure.\nA response that reports no relevant information is still shown normally.\n\n## Example usage\n\nInvoke the `help` command by commenting on a PR with:\n\n<img src=\"/img/help1.png\" alt=\"Help command input\" width=\"750\" />\n\n\nResponse will include a list of available commands:\n\n<img src=\"/img/help2.webp\" alt=\"Help command output\" width=\"750\" />\n\n<!-- File: docs/docs/commands/index.md (Tokens: ~956 | Category: command-prompt) -->\n---\ntitle: \"Commands\"\nsidebar_position: 1\n---\n\nEach PR-Agent command has a dedicated page that explains its behavior and usage:\n\n| Command | Description |\n|------|-------------|\n| **[PR Description (`/describe`)](./describe.md)** | Generate a PR title, type, summary, code walkthrough and labels. |\n| **[PR Review (`/review`)](./review.md)** | Generate a PR review with feedback on possible issues, security concerns, tests and review effort. |\n| **[Code Suggestions (`/improve`)](./improve.mdx)** | Runs /review, whose findings can carry committable code fixes. |\n| **[Question Answering (`/ask ...`)](./ask.md)** | Answering free-text questions about the PR, or on specific code lines |\n| **[Add Documentation (`/add_docs`)](./add_docs.md)** | Generate documentation for code components that are missing it |\n| **[Generate Labels (`/generate_labels`)](./generate_labels.md)** | Generate custom labels for the PR based on the code changes |\n| **[Similar Issues (`/similar_issue`)](./similar_issues.md)** | Find similar issues in the repository based on the current issue |\n| **[Help (`/help`)](./help.md)** | Provides a list of all the available commands |\n| **[Help Docs (`/help_docs`)](./help_docs.md)** | **Temporarily disabled.** Answers questions about a Git repository’s documentation. |\n| **[Update Changelog (`/update_changelog`)](./update_changelog.md)** | Automatically updating the CHANGELOG.md file with the PR changes |\n\n## Usage examples\n\nEach command can be triggered in two ways:\n\n- **As a comment** — write the command (e.g. `/review`) as a comment, and PR-Agent replies. Most commands are commented on a PR; issue-scoped commands such as `similar_issue` are commented on an issue.\n- **From the [CLI](../usage-guide/automations_and_usage.md#local-repo-cli)** — run `python -m pr_agent.cli --pr_url=<PR_URL> <command>`. Issue-scoped commands take `--issue_url=<ISSUE_URL>` instead of `--pr_url`. The module form works only from an environment where the `pr_agent` package is importable (for example, the venv created by `uv sync`). If `pr-agent` is on your `PATH`, run it directly.\n\nBoth accept the same command arguments and [configuration overrides](../usage-guide/configuration_options.md).\n\n| Command                                     | Comment                          | CLI                                                             |\n|------------------------------------------|----------------------------------|----------------------------------------------------------------|\n| [Describe](./describe.md)                | `/describe`                      | `python -m pr_agent.cli --pr_url=<PR_URL> describe`             |\n| [Review](./review.md)                    | `/review`                        | `python -m pr_agent.cli --pr_url=<PR_URL> review`              |\n| [Improve](./improve.mdx)                  | `/improve`                       | `python -m pr_agent.cli --pr_url=<PR_URL> improve`             |\n| [Ask](./ask.md)                          | `/ask \"How does X work?\"`        | `python -m pr_agent.cli --pr_url=<PR_URL> ask \"How does X work?\"` |\n| [Add Docs](./add_docs.md)                | `/add_docs`                      | `python -m pr_agent.cli --pr_url=<PR_URL> add_docs`           |\n| [Generate Labels](./generate_labels.md)  | `/generate_labels`               | `python -m pr_agent.cli --pr_url=<PR_URL> generate_labels`     |\n| [Similar Issues](./similar_issues.md)    | `/similar_issue`                 | `python -m pr_agent.cli --issue_url=<ISSUE_URL> similar_issue` |\n| [Help](./help.md)                        | `/help`                          | `python -m pr_agent.cli --pr_url=<PR_URL> help`                |\n| [Update Changelog](./update_changelog.md)| `/update_changelog`              | `python -m pr_agent.cli --pr_url=<PR_URL> update_changelog`    |\n\n`/help_docs` is temporarily disabled (see [#2445](https://github.com/The-PR-Agent/pr-agent/issues/2445)) and is therefore omitted from the table above.\n\nFor screenshots, arguments, and a walkthrough of a typical use case, see the **Example usage** section on each command's page linked above.\n\n<!-- File: docs/docs/commands/review.md (Tokens: ~10908 | Category: command-prompt) -->\n---\ntitle: \"Review\"\nsidebar_position: 3\n---\n\n## Overview\n\nGenerate a PR review with feedback on possible issues, security concerns, tests and review effort.\n<br>\nThe command can be triggered automatically every time a new PR is [opened](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened), or can be invoked manually by commenting on any PR:\n\n```\n/review\n```\n\nNote that the main purpose of the `review` command is to provide the **PR reviewer** with useful feedback and insights. Findings can also carry a fix, which GitHub and the other supported providers offer as a [committable suggestion](#fixes-and-committable-suggestions).\n\n(Read more about the different personas in the PR process and how PR-Agent aims to assist them in our [blog](https://www.qodo.ai/blog/understanding-the-challenges-and-pain-points-of-the-pull-request-cycle/))\n\n:::note\n`/improve` runs `/review` as of 0.51. See [Improve](./improve.mdx).\n:::\n\n## Example usage\n\n### Manual triggering\n\nInvoke the command manually by commenting `/review` on any PR:\n\n<img src=\"/img/review_comment.png\" alt=\"review comment\" width=\"512\" />\n\nAfter ~30 seconds, the command will generate a review for the PR:\n\n<img src=\"/img/review3.png\" alt=\"review\" width=\"512\" />\n\nIf you want to edit [configurations](#configuration-options), add the relevant ones to the command:\n\n```\n/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...\n```\n\nFrom the CLI, save the parsed review and token usage as JSON for a later CI step:\n\n```bash\npr-agent --pr_url https://github.com/org/repo/pull/123 --json-output review.json review\n```\n\nThe JSON file is written after the review completes. Place `--json-output` before `review` or `review_pr`.\nIts `coverage` object lists files omitted by the token budget or chunk-call limit, as well as\ndeletions represented only by filename notices (`files_not_reviewed`), and those whose patches\nwere clipped to fit the token budget (`files_partially_reviewed`).\nFiles excluded by file-type filtering are not included in these coverage lists.\nFilename notices are optional context, not reviewed source; filtered-file notices take priority\nwhen both kinds compete for the remaining request budget.\nFilename notices supplement source changes and do not trigger a model call on their own.\nA deletion-only PR without source changes to analyze is skipped, even when deletion patches are available.\nThe JSON includes the full lists even when the Markdown footer summarizes them.\nIt also includes `total_chunks` and `failed_chunks` for the final analysis plan, after fallback recovery.\nThese count analysis chunks, not model requests or retry attempts. A nonzero `failed_chunks` means that the\nreview is partial even if both file lists are empty; findings from successful chunks are retained.\n\n### Automatic triggering\n\nTo run the `review` automatically when a PR is opened, define in a [configuration file](../usage-guide/configuration_options.md#local-configuration-file):\n\n```\n[github_app]\npr_commands = [\n    \"/review\",\n    ...\n]\n\n[pr_reviewer]\nextra_instructions = \"...\"\n...\n```\n\n- The `pr_commands` lists commands that will be executed automatically when a PR is opened.\n- The `[pr_reviewer]` section contains the configurations for the `review` command you want to edit (if any).\n\n## Configuration options\n\nThe descriptions below explain each option's behavior. See the relevant sections in\n[`configuration.toml`](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml)\nfor the authoritative default values.\n\n<details open>\n<summary>General options</summary>\n\n<table>\n  <tr>\n    <td><b>persistent_comment</b></td>\n    <td>If set to true, the review comment will be persistent, meaning that every new review request will edit the previous one.</td>\n  </tr>\n  <tr>\n    <td><b>per_commit_review</b></td>\n    <td>If set to true, each commit of the PR is reviewed on its own diff and commit message, and one review comment is published per commit. See <a href=\"#reviewing-each-commit-separately\">Reviewing each commit separately</a>. It can't be turned on from a command argument, only from a configuration file or environment variable. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_commits_per_review</b></td>\n    <td>Maximum number of commits <code>per_commit_review</code> reviews one by one. When more commits than that are not reviewed yet, the whole PR is reviewed in one review instead, with a notice. It can't be set from a command argument or a per directory configuration file. Default is 0, no limit.</td>\n  </tr>\n  <tr>\n    <td><b>publish_review_failure_comment</b></td>\n    <td>\n      Set to false to suppress the \"Failed to review PR\" comment, including when a persistent review comment\n      cannot be updated. Successful review output and the command's failure status are unchanged. Default is true.\n      On GitHub, GitLab, and Azure DevOps, when the comment author can be verified, repeated failures update one\n      comment instead of adding another, and the next review that completes removes it. If the provider rejects\n      that edit or removal, the earlier comment stays and no other is added. A review in which some chunks failed\n      keeps it; files left out for the token budget do not. With\n      <code>gitlab.reply_to_trigger_comment</code>, each failure still replies to its own command, and a persistent\n      review comment that cannot be updated gets a comment of its own each time. Those are removed the same way,\n      and so are the failure comments of earlier versions.\n    </td>\n  </tr>\n  <tr>\n    <td><b>publish_error_details</b></td>\n    <td>\n      If set to true, a failed manual review comment includes a deterministic, sanitized failure reason for known\n      provider and runtime errors. The failure formatter does not call an AI model, never publishes raw exception\n      text, and falls back to a generic internal-error message. Default is false.\n    </td>\n  </tr>\n  <tr>\n    <td><b>review_heading</b></td>\n    <td>\n      Visible base heading for review comments, without the Markdown prefix or incremental label.\n      For example, <code>review_heading = \"Guideline Compliance Check\"</code> renders\n      <code>## Guideline Compliance Check 🔍</code> for a full review and\n      <code>## Incremental Guideline Compliance Check 🔍</code> for an incremental review.\n      On GitHub, GitLab, Azure DevOps, and Bitbucket Cloud, changing this value updates the same\n      persistent review comment; it does not create a separate review channel.\n    </td>\n  </tr>\n  <tr>\n    <td><b>persistent_finding_state</b></td>\n    <td>If set to true, PR-Agent persists structured review finding state across complete review runs, so findings can be resolved and reopened. Resolved findings retain the original Markdown formatting of their description. Incremental and partial reviews do not resolve absent findings. Default is true.</td>\n\n  </tr>\n  <tr>\n    <td><b>max_previous_findings_chars</b></td>\n        <td>Character budget for the findings stored by earlier reviews (requires <code>persistent_finding_state</code>). They are given to the model so it repeats a still-valid finding with its earlier wording instead of re-raising it reworded, and does not re-raise a resolved one unless the code reintroduces it. On GitHub and GitLab, an inline key-issue thread that someone other than PR-Agent resolved is given as dismissed, with its last reply, so the model does not re-raise it unless the code makes it worse. Set to 0 to disable. Default is 8000.\n      On Azure DevOps, verified PR-Agent inline key issues with <code>wontFix</code> or <code>byDesign</code>\n      are also passed as dismissed when the status differs from <code>azure_devops.default_comment_status</code>.\n      A matching default stays an ordinary prior finding. This infers a human decision; Azure does not identify\n      the status-changing actor here, and the current default may differ from the default used at creation.\n      PR-Agent resolves its posting identity through Azure DevOps. Set\n      <code>azure_devops_server.agent_identity</code> to override it or when automatic lookup is unavailable.\n    </td>\n  </tr>\n  <tr>\n  <td><b>final_update_message</b></td>\n  <td>When set to true, updating a persistent review comment during online commenting will automatically add a short comment with a link to the updated review in the pull request.</td>\n  </tr>\n  <tr>\n    <td><b>extra_instructions</b></td>\n    <td>Optional extra instructions to the command. For example: \"focus on the changes in the file X. Ignore change in ...\".</td>\n  </tr>\n  <tr>\n    <td><b>enable_help_text</b></td>\n    <td>If set to true, the command will display a help text in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_coverage_footer</b></td>\n    <td>If set to true, the command will display a review coverage footer when source changes were not reviewed or were only partially reviewed, including deleted files represented by filename notices.\n    A review with this footer is published even when <code>publish_output_no_suggestions</code> is false.</td>\n  </tr>\n  <tr>\n    <td><b>enable_large_pr_chunking</b></td>\n    <td>If set to true, and the token budget leaves files out of the review, the diff is split into chunks, each chunk is reviewed separately, and the per-chunk results are merged into one review. See <a href=\"#reviewing-a-pr-that-does-not-fit-in-one-call\">Reviewing a PR that does not fit in one call</a>. Default is false.</td>\n  </tr>\n  <tr>\n    <td><b>max_number_of_calls</b></td>\n    <td>Maximum number of chunk review calls, used only when <code>enable_large_pr_chunking</code> is true. Default is 3.</td>\n  </tr>\n  <tr>\n    <td><b>num_max_findings</b></td>\n    <td>Maximum number of returned findings. Default is 6.</td>\n  </tr>\n  <tr>\n    <td><b>inline_key_issues</b></td>\n    <td>If set to true (the default), each key issue is published as an inline comment where the provider supports verified inline-comment publication (GitHub, Bitbucket Cloud, Azure DevOps, GitLab, Gitea). A finding leaves the review summary when a matching comment exists or the provider accepts the new comment. Findings that cannot be anchored or published stay in the summary. A finding that carries a fix is published as a committable suggestion when `pr_code_suggestions.committable_code_suggestions` is true, the fix is at most ten lines and its `existing_code` matches the file at the finding's lines; otherwise the fix appears as a code block in the comment.</td>\n  </tr>\n  <tr>\n    <td><b>min_finding_confidence</b></td>\n    <td>When above 0, the model reports an integer confidence from 0 to 10 for each finding, shown in its header in the review summary (inline comments do not show it). Findings below this value are dropped before publishing, and in a chunked review they are dropped before the <code>num_max_findings</code> cut, so they cannot displace a more confident finding. A run that dropped findings does not mark earlier findings as resolved. A missing or out-of-range confidence is treated as absent: the finding is kept. A threshold outside 0-10 is treated as 0 (disabled). Default is 0: keep all findings, and the model is not asked for a confidence.</td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Enable\\disable specific sub-sections</summary>\n\n<table>\n  <tr>\n    <td><b>require_score_review</b></td>\n    <td>If set to true, the command will add a section that scores the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_tests_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains tests.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_effort_to_review</b></td>\n    <td>If set to true, the command will add a section that estimates the effort needed to review the PR.</td>\n  </tr>\n  <tr>\n    <td><b>require_estimate_contribution_time_cost</b></td>\n    <td>If set to true, the command will add a section that estimates the time required for a senior developer to create and submit such changes.</td>\n  </tr>\n  <tr>\n    <td><b>require_can_be_split_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains several themes, and can be split into smaller PRs.</td>\n  </tr>\n  <tr>\n    <td><b>require_security_review</b></td>\n    <td>If set to true, the command will add a section that checks if the PR contains a possible security or vulnerability issue.</td>\n  </tr>\n    <tr>\n    <td><b>require_todo_scan</b></td>\n    <td>If set to true, the command will add a section that lists TODO comments found in the PR code changes.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_ticket_analysis_review</b></td>\n    <td>\n      If set to true and ticket context is available, the command adds a ticket-compliance section to the review comment\n      that checks whether the PR fulfills the ticket requirements. Supported sources include GitHub and GitLab issues,\n      linked Azure DevOps work items, Jira Cloud tickets, and Asana tasks.\n    </td>\n  </tr>\n  <tr>\n    <td><b>require_risk_assessment</b></td>\n    <td>If set to true, the command will add a section that rates the overall risk of the PR as low, medium or high.</td>\n  </tr>\n  <tr>\n    <td><b>require_merge_recommendation</b></td>\n    <td>If set to true, the command publishes a recommendation computed from deterministic checks. Only passing checks\n    allow no_concerns_found; needs_review means a check did not pass or could not be evaluated, and changes_required\n    reflects a model veto. The value reports the review's findings, not a guarantee about the code. See\n    <a href=\"#merge-recommendation\">Merge recommendation</a>.</td>\n  </tr>\n  <tr>\n    <td><b>publish_merge_recommendation_status</b></td>\n    <td>If set to true with <code>require_merge_recommendation</code>, publishes the verdict on the reviewed commit.\n    GitHub uses the <code>PR Agent - Review</code> check; GitLab uses a commit status. <code>needs_review</code>\n    publishes as neutral on GitHub and skipped on GitLab, so it does not block a merge; <code>changes_required</code>\n    publishes as a failure.</td>\n  </tr>\n  <tr>\n    <td><b>max_changed_lines</b></td>\n    <td>Host-only changed-line cap for <code>no_concerns_found</code>. A larger diff makes the recommendation\n    <code>needs_review</code> at best. The cap counts added and removed lines.</td>\n  </tr>\n  <tr>\n    <td><b>require_failure_modes</b></td>\n    <td>Off by default. If enabled, adds up to three concrete failure scenarios, each with what could break,\n    where, its trigger, how it could be detected, and whether a test or check in this PR covers it.\n    These scenarios guide human review; they do not gate merging or prove that the PR is safe.</td>\n  </tr>\n  <tr>\n    <td><b>require_artifact_findings</b></td>\n    <td>Off by default, and only active when a <a href=\"../../installation/github/#ci-artifact-context\">CI artifact</a> reaches /review.\n    If enabled, adds a \"CI artifact findings\" section with up to five neutral facts from the artifact: destroyed or replaced\n    resources, failed jobs (including allowed-to-fail ones), failed tests, vulnerabilities and notable warnings. Each fact\n    carries a short quote from the artifact; a quote that cannot be found in the artifact is marked, and credentials in\n    facts and quotes are redacted. The section reports what the artifact shows and leaves the decision to the reviewer.\n    Host configuration only: a repository settings file or comment cannot set it.</td>\n  </tr>\n  <tr>\n    <td><b>require_priority_files</b></td>\n    <td>If set to true, the command will add a section listing the files a human reviewer should inspect first.</td>\n  </tr>\n  <tr>\n    <td><b>structural_reach_input_file</b></td>\n    <td>Path to a JSON file with structural reach facts, written by a build-graph tool earlier in CI. When the file\n    exists, adds a deterministic change-risk row (Low, Moderate, High or Critical) with no model call. Relative to\n    <code>GITHUB_WORKSPACE</code> when that is set, otherwise to the working directory. Host configuration only: a\n    repository settings file or a comment cannot set it, because the file is read from the host. See\n    <a href=\"#structural-reach\">Structural reach</a>.</td>\n  </tr>\n  <tr>\n    <td><b>enable_risk_checks</b></td>\n    <td>\n      If set to true, deterministically scans diff files and unfiltered PR files for sensitive paths, destructive SQL,\n      cache flushes, and authentication/secrets patterns without making model calls. Findings are rendered as a risk-checks\n      row in the review summary table. When no findings are detected, nothing is added. Default is true. See\n      <a href=\"#deterministic-risk-checks\">Deterministic risk checks</a>.\n    </td>\n  </tr>\n  <tr>\n    <td><b>sensitive_paths</b></td>\n    <td>\n      List of glob patterns identifying files considered sensitive (such as CI workflows, package manifests, lockfiles,\n      migrations, and infrastructure configurations). Changes to matching files flag a deterministic review risk finding.\n      Default includes common CI/CD, package manager, container, infrastructure, and migration paths.\n    </td>\n  </tr>\n  <tr>\n    <td><b>extra_risky_shapes</b></td>\n    <td>\n      List of custom regular expression patterns to scan within added and removed lines in diff hunks. Patterns matching a\n      line flag a deterministic risk finding. Patterns longer than 200 characters, or with a quantified group that holds a\n      nested quantifier or an alternation (such as `(a+)+` or `(a|b)+`), are skipped with a logged warning. Host\n      configuration only: a repository settings file or comment cannot set it. Default is empty.\n    </td>\n  </tr>\n</table>\n\n</details>\n\n<details open>\n<summary>Adding PR labels</summary>\n\nYou can enable\\disable the `review` command to add specific labels to the PR:\n\n<table>\n  <tr>\n    <td><b>enable_review_labels_security</b></td>\n    <td>If set to true, the command will publish a 'Possible security concern' label if it detects a security issue.</td>\n  </tr>\n  <tr>\n    <td><b>enable_review_labels_effort</b></td>\n    <td>If set to true, the command will publish a 'Review effort x/5' label (1–5 scale). Existing effort labels are kept when this option or effort estimation is disabled, or when the review has no valid replacement estimate. Security labels follow their own settings.</td>\n  </tr>\n</table>\n\n</details>\n\n## Usage Tips\n\n### General guidelines\n\n:::tip\n\nThe `review` command provides a collection of configurable feedbacks about a PR.\nIt is recommended to review the [Configuration options](#configuration-options) section, and choose the relevant options for your use case.\n\nSome of the features that are disabled by default are quite useful, and should be considered for enabling. For example:\n`require_score_review`, and more.\n\nOn the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases.\n:::\n\n### Automation\n\n:::tip\nWhen you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app-automatic-commands-when-a-new-pr-is-opened) for the `review` command is:\n```\npr_commands = [\"/review\", ...]\n```\nMeaning the `review` command will run automatically on every PR, without any additional configurations.\nEdit this field to enable/disable the command, or to change the configurations used.\n:::\n\n### Auto-generated PR labels by the Review Command\n\n:::tip\n\nThe `review` command can automatically add labels to your Pull Requests:\n\n- **`Possible security concern`**: This label is applied if the command detects a potential [security vulnerability](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L147) in the PR's code. This feedback is controlled by the 'enable_review_labels_security' flag (default is true).\n- **`Review effort 3/5`**: This label estimates the [effort](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/pr_reviewer_prompts.toml#L119) required to review the PR on a scale of 1 to 5. This feedback is controlled by the 'enable_review_labels_effort' flag (default is true).\n\nThe command matches these label names and earlier 1–5 effort formats case-insensitively.\nOther labels, such as `Review effort::high`, are left unchanged.\n\nTicket compliance is reported in the review comment, not as a PR label. It is controlled by\n`pr_reviewer.require_ticket_analysis_review` and requires available ticket context. The command does not add\nticket-compliance labels or a \"No ticket found\" label. See\n[Fetching ticket context](../core-abilities/fetching_ticket_context.md) for linking and authentication details.\n\n\n:::\n\n### Auto-blocking PRs from being merged based on the generated labels\n\n:::tip\n\nYou can configure a CI/CD Action to prevent merging PRs with specific labels. For example, implement a dedicated [GitHub Action](https://medium.com/sequra-tech/quick-tip-block-pull-request-merge-using-labels-6cc326936221).\n\nThis approach helps ensure PRs with potential security issues will not be merged without further review.\n\nSince AI may make mistakes or lack complete context, use this feature judiciously. For flexibility, users with appropriate permissions can remove generated labels when necessary. When a label is removed, this action will be automatically documented in the PR discussion, clearly indicating it was a deliberate override by an authorized user to allow the merge.\n:::\n\n### Extra instructions\n\n:::tip\n\nExtra instructions are important.\nThe `review` command can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.\n\nBe specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-command, and the relevant aspects of the PR that you want to emphasize.\n\nExamples of extra instructions:\n```\n[pr_reviewer]\nextra_instructions=\"\"\"\\\nIn the code feedback section, emphasize the following:\n- Does the code logic cover relevant edge cases?\n- Is the code logic clear and easy to understand?\n- Is the code logic efficient?\n...\n\"\"\"\n```\nUse triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.\n:::\n\n### Fixes and committable suggestions\n\nA finding can carry a fix: the model adds `existing_code` (the lines it wants to change, copied from the file) and\n`improved_code` (their replacement) when a concrete change resolves the issue. A finding without a clear fix has neither field.\n\nWhen `inline_key_issues` is on (the default) and the provider can verify inline comments (GitHub, Bitbucket Cloud, Azure DevOps,\nGitLab, Gitea), each finding is posted as an inline comment. If `pr_code_suggestions.committable_code_suggestions` is true and\n`existing_code` matches the file at the finding's lines, the fix is posted as a committable suggestion that you can apply from the\nPR page. Otherwise the fix is shown as a text block in the comment. A finding that is not posted inline (the provider cannot verify\ninline comments, `inline_key_issues` is off, or publishing failed) stays in the review summary, and its fix appears there as a text\nblock. Findings are capped by `pr_reviewer.num_max_findings` (6 by default), and chunked reviews keep the same cap.\n\nThree `pr_code_suggestions` settings are honoured: `committable_code_suggestions`, `extra_instructions`\n(added to the review's extra instructions when it differs from `pr_reviewer.extra_instructions`) and\n`suggestions_heading` (the base heading for code-suggestion comments). Other `pr_code_suggestions` keys have no effect.\n\n```\n/review --pr_code_suggestions.committable_code_suggestions=true\n```\n\n### Reviewing each commit separately\n\n:::tip\n\nProjects that keep one logical change per commit can ask for a review of every commit instead of the combined PR diff,\nin a configuration file:\n\n```\n[pr_reviewer]\nper_commit_review = true\n```\n\nEach commit is reviewed against its own parent, with its commit message in the prompt, and gets its own\nincremental review comment that names and links the commit. These comments are never the persistent\nreview comment, and they do not change the review labels.\n\nEach run reviews only the commits of the PR that were not reviewed yet, so `-i` is not needed in `pr_commands` or\n`push_commands`, and the first run reviews every commit. A commit is identified by a fingerprint of its own changes\n(file names and patch lines, without line numbers), and counts as reviewed once its review succeeds: the fingerprint\nis kept in a hidden marker in the commit's review comment or, when no comment is published for it, in one record\ncomment that is edited in place. A commit whose review failed is reviewed again on the next run; automatic runs stop\nretrying it after 3 failed attempts, while a manual `/review` always retries.\n`minimal_commits_for_incremental_review` and `minimal_minutes_for_incremental_review` do not apply to per commit\nreview, since each run picks the commits to review from these markers instead of the `-i` thresholds.\nThe commit list is read from the git provider on every run, so after a force push the review follows the rewritten\nhistory: a commit that was rebased without changing its own patch is not reviewed again, a commit that was amended or\nhad fixups folded into it (for example with `git rebase --autosquash`) is reviewed again, and fixup commits that no\nlonger exist are not reviewed. Markers count only in comments PR-Agent wrote; when the git provider cannot confirm\nthat, the whole PR is reviewed in one review with a notice instead.\nOn GitLab, a commit with a collapsed, too large or rename only file is reviewed again after a rebase, since its\nfingerprint includes its SHA.\n\nSet `publish_output_no_suggestions = false` in the `[pr_reviewer]` section\n(`--pr_reviewer.publish_output_no_suggestions=false` on the command line) to skip the comment of a commit with\nno findings and no coverage warning.\nWith `inline_key_issues = true`, each finding is published as an inline comment on the commit it was found in,\nanchored to that commit's own diff, so GitHub and GitLab show it as outdated once a later commit changes those lines.\nA finding that cannot be anchored there, for example because its line is outside that commit's diff or the provider\nrejects it, stays in that commit's review comment instead of being moved to a nearby line.\n\nMerge commits, empty commits and the root commit of a history have no diff of their own and are skipped. A commit that\nfails to review is reported like a failed review and does not stop the remaining commits. Every reviewed commit is a\nseparate model call, so the first review of a PR with many commits costs accordingly; later runs review only the new\ncommits.\nHosts that want to bound that cost can set `max_commits_per_review` (default 0, no limit): when more commits than that\nare not reviewed yet, the whole PR is reviewed in one review with a notice, and its commits count as reviewed.\nThe markers live only in PR-Agent's own comments, so if those comments are removed, the next run reviews every commit\nof the PR again, unless `max_commits_per_review` is set and the PR has more commits than that, in which case the whole\nPR gets one review.\nBoth settings belong to the operator, so a command argument such as `--pr_reviewer.per_commit_review=true` is\nrejected.\nEach commit's comment shows its own run details, while the `--json-output` file and the GitHub Action `review` output\ndescribe the last reviewed commit only.\n\nPer commit review is available on GitHub and GitLab. Other git providers fall back to a regular review of the whole PR.\nGitHub lists at most 250 commits of a PR, so a PR with more commits than that is also reviewed as a whole, with a\nnotice explaining why.\n:::\n\n### Reviewing a PR that does not fit in one call\n\n:::tip\n\nWhen a PR diff is larger than the model's token budget, the `review` command drops whole files\nuntil the diff fits, and lists the dropped files in the review coverage footer.\n\nSetting `enable_large_pr_chunking = true` changes what happens next: the diff is split into up\nto `max_number_of_calls` chunks, each chunk is reviewed on its own, and the answers are merged\ninto a single review that says how many chunks it was built from. Files that do not fit even\nafter chunking are still listed in the coverage footer. Every chunk is a separate model call,\nso a chunked review costs roughly `max_number_of_calls` times a normal one.\n\nWhile the chunks run, the temporary `Preparing review...` comment is rewritten in place with the\nnumber of chunks already analyzed, for example `Preparing review... analyzed 2 of 3 chunks`, plus\n`... 1 chunk failed` when a chunk gives up. The updates require\n`config.publish_output_progress` and a provider that supports both editing and removing a\ncomment, so plain-diff runs keep the frozen placeholder. Automatic commands publish no progress\ncomment, but while `github.publish_as_check_run` is enabled their in-progress check run shows the\nsame chunk count. The comment stays\ntemporary and is still removed before the merged review is published. A fallback model restores\nthe placeholder before it starts, so the visible count never moves backward.\n\nIf a chunk fails or returns malformed output, successful chunks are retained and fallback\nmodels retry only the pending work. Pending chunks can be split for a smaller model, within\nthe call limit; a larger model can also include previously omitted files. Chunks that still\nexceed the model's budget are not sent to it.\n\nWhen only one chunk is unfinished and all source files are already in the plan, a smaller\nfallback model can review fitting files beside oversized files. This requires a separate\nchunk for every file within the existing limit, including completed chunks. Oversized files\nremain pending for later models. If none of the recovered chunks succeeds, the original\ngrouping is restored for the next model. Non-retryable errors stop fallback even when another\nchunk exceeds the budget; this includes guardrail rejections only when reported as non-retryable.\n\nIf every fallback is exhausted, successful chunks are published as a partial review with a\nfailed-chunk coverage warning, even when `publish_output_no_suggestions = false`. Incomplete\nreviews cannot resolve absent persistent findings. If no chunk succeeds, the review fails.\nWith `config.propagate_command_errors = true`, an exhausted fallback chain still signals failure\nto the caller after publishing the partial review and removing the progress comment.\nOptional run details list all models that contributed to the merged review.\n\nEach chunk answers the same questions about a different part of the PR, so the answers are\nmerged field by field:\n\n| Field | Merge rule |\n| --- | --- |\n| `key_issues_to_review` | Union over the chunks, dropping findings that repeat the same file, header and text |\n| `security_concerns` | Every chunk that reported a concern is kept; \"No\" only when every chunk said no |\n| `todo_sections`, `review_priority_files`, `can_be_split` | Union, de-duplicated, in chunk order (`can_be_split` keeps at most 3 sub-PRs) |\n| `relevant_tests` | Yes if any chunk found tests |\n| `score` | The lowest score any chunk gave |\n| `risk_level`, `merge_recommendation` | The most conservative value any chunk gave |\n| `failure_modes` | Concatenate valid cases in chunk order, dropping exact duplicates and keeping at most three |\n| `estimated_effort_to_review_[1-5]` | The highest value any chunk gave |\n| `contribution_time_cost_estimate` | The sum over the chunks, per case |\n| `ticket_compliance_check` | One entry per ticket, with its bullet lists unioned across chunks |\n\nWhen `require_todo_scan` is enabled, the TODO union includes both located findings and prose\nsummaries. Prose without a file location is shown as text without a source link.\n\nThe merged verdict is deliberately never less alarming than the worst chunk: a clean chunk\ncannot raise a score, clear a security concern, or soften a risk level set by another chunk.\n:::\n\n### Structural reach\n\n:::tip\n\nWhen `structural_reach_input_file` points at a file that exists, the review gets one row at the top that rates how\nfar a defect in the change could spread. The row is computed from that file, not by the model, so the same input\nalways gets the same rating.\n\n```\n🔗 Structural reach: Critical\nReach: 40 projects, cross-domain\nDependents: billing-api, payments-worker, web-app, admin-app, reports (+35 more)\nSensitivity: payments\nRating driven by sensitive domain (escalates regardless of size)\n```\n\n**Rating.** Two facts from the input file set the band:\n\n- **Reach** is the number of downstream projects a defect in the change can break. Only a build-graph tool knows\n  it.\n- **Sensitivity** flags changes to areas the repository marks as high-criticality, such as authentication,\n  payments or secrets. A one-line auth change outranks a wide styling sweep.\n\nReach is narrow up to 3 projects, moderate up to 25 and wide above that. The band then follows these rules:\n\n| Condition | Band |\n| --- | --- |\n| Wide reach | At least Moderate |\n| Cross-domain change | At least Moderate |\n| Any sensitive domain | At least High |\n| Sensitive domain with wide reach | Critical |\n| Anything else | Low |\n\nThe row lists each factor and names the one that set the band. It also lists the first five names in\n`dependents`, in the order the producer wrote them.\n\nThe reach bands are defined for projects only. When `reach_unit` is `modules` or `files`, the row shows the count\nand the dependents without a band, because no threshold separates a change to a shared utility from a real spread.\nA cross-domain or sensitive change still gets a band from the rules above. The Reach line still shows the\nnumber, but it does not affect the band.\n\nChange size is not part of the rating, because\n`estimated_effort_to_review_[1-5]` already reflects it. That row and `require_risk_assessment` are the model's\njudgement; this row adds the structural and sensitivity facts the model cannot see in the diff.\n\n**Input file.** Any build-graph tool (Nx, Bazel, Gradle, Turborepo, and so on) can write the reach facts in an\nearlier CI step, so pr-agent needs no adapter per tool. Point `structural_reach_input_file` at the file in host\nconfiguration, for example the `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE` environment variable. Every field is\noptional:\n\n```json\n{\n  \"version\": 1,\n  \"reach\": 12,\n  \"reach_unit\": \"projects\",\n  \"dependents\": [\"billing-api\", \"web-app\"],\n  \"domains\": [\"billing\", \"web\"],\n  \"cross_domain\": true,\n  \"sensitive_domains\": [\"billing\"]\n}\n```\n\n| Field | Type | Meaning |\n| --- | --- | --- |\n| `version` | integer | Schema version. Only `1` is accepted. |\n| `reach` | integer, 0 or more | Number of units affected by the change, including transitive dependents. Defaults to the length of `dependents`. |\n| `reach_unit` | string | What `reach` counts: `projects` (the default), `modules` or `files`. Only `projects` gets a reach band. |\n| `dependents` | list of strings | Names of the affected units, most relevant first. |\n| `domains` | list of strings | Distinct domains or areas the affected projects belong to. |\n| `cross_domain` | boolean | Whether the change spans more than one domain. |\n| `sensitive_domains` | list of strings | Affected domains the repository treats as sensitive. |\n\nUnknown fields are ignored. Strings are limited to 200 characters and the file to 1 MB.\n\n**Trust.** The file is read from inside `GITHUB_WORKSPACE` (or the working directory), so in the GitHub Action a\ncheckout of the pull request could already contain a file at that path, written by the pull request's author.\nGenerate the file in the same job, right before the review step, and delete any existing copy first. Take the\nproject tags and graph configuration the producer reads from the base commit, not from the pull request. Treat the\nband as advisory context for reviewers, never as a merge gate.\n\n**Example producer: Nx.** `nx show projects --affected` lists every project the change affects, including\ntransitive dependents. This step writes them as `dependents`, and lists affected projects tagged `sensitive` as\n`sensitive_domains`:\n\n```bash\naffected() { npx nx show projects --affected --base=\"$BASE_SHA\" --head=\"$HEAD_SHA\" --json \"$@\"; }\naffected | jq --argjson sensitive \"$(affected -p 'tag:sensitive')\" \\\n  '{version: 1, reach_unit: \"projects\", dependents: ., sensitive_domains: $sensitive}' > structural-reach.json\n```\n\nThen set `PR_REVIEWER__STRUCTURAL_REACH_INPUT_FILE=structural-reach.json` for the review step. Another tool\nneeds only a query that lists the affected projects or packages.\n\n**Example producer: tree-sitter.** For a repository without a build-graph tool,\n`scripts/structural_reach_producer.py` builds a reverse-import graph of the Python, TypeScript and JavaScript\nfiles at the base commit and follows importers from the changed files. Test files are left out of reach and\ndomains, because counting them makes most changes to a shared module read wide. It writes `reach_unit` as\n`modules` (directories) by default, so the row shows the count and the first dependents without a band. Run it as\na CI step before the review; it is not a pr-agent dependency:\n\n```bash\npip install \"tree-sitter-language-pack==1.22.1\"\npython scripts/structural_reach_producer.py --repo . --base \"$BASE_SHA\" --head \"$HEAD_SHA\" \\\n  --unit module --out structural-reach.json\n```\n\nOn this repository, the change merged in pull request 4420 gives:\n\n```\n🔗 Structural reach\nReach: 9 modules\nDependents: pr_agent/git_providers, pr_agent/commands, pr_agent/servers, pr_agent/algo, pr_agent/mosaico (+4 more)\n```\n\n`dependents` is ordered by the number of affected files in each unit. The graph does not see imports built at\nrun time, files loaded by name such as settings, or dependencies declared only in a manifest, such as a shared\n`tsconfig` package used through `extends`. In a monorepo with Nx, Turborepo or Bazel, use that tool instead.\n\n**Failure handling.** The row never blocks a review. If the setting is empty, the input file is missing or does\nnot match the schema, or anything fails while computing the row, the review is published without it.\n\n**Sources.**\n\n- Beyer, B. et al. *Site Reliability Engineering* (Google, 2016), and the AWS Well-Architected Framework: blast\n  radius as the scope of impact of a change or failure.\n- OWASP guidance on sensitive functionality: authentication, session management, cryptography and payments.\n\n:::\n\n### Deterministic risk checks\n\n:::tip\n\nWhen `enable_risk_checks` is enabled (the default), PR-Agent scans changed files and diff hunks for known risk patterns\nwithout making model calls. Incremental and per-commit reviews scope unfiltered path checks to the active incremental\nfile set unless `require_merge_recommendation` is enabled. Findings are rendered as a dedicated row in the review table:\n\n```\n⚠️ Risk checks: 3 finding(s) detected\nSensitive paths (1): .github/workflows/deploy.yml\nRisky shapes (1): `Privilege revocation` in db/migrations/002_revoke.sql\nDeleted files (1): old_auth.py\n```\n\nWhen no findings are detected, the row is omitted completely so clean reviews stay uncluttered.\n\n**Checks performed.**\n\n- **Sensitive paths**: Flags changes to files matching glob patterns in `sensitive_paths`. By default, this covers\n  CI/CD pipelines and local composite actions, package manager manifests and lockfiles, Dockerfiles, Terraform and\n  infrastructure configs, and database migrations.\n- **Risky change shapes**: Scans added and removed lines in diff hunks for destructive SQL (`DROP TABLE`, `ALTER ... RENAME`,\n  `REVOKE ... ON/FROM`, `TRUNCATE`), authentication and secrets keywords, cache invalidations, and any custom patterns\n  configured in `extra_risky_shapes`. Removed lines are also checked for removed function signatures (Python, JS/TS, Go,\n  Rust) and, in `.toml`, `.yaml`, `.yml`, `.json`, `.ini` and `.env` files, removed configuration defaults. Changes to\n  prompt files (`*prompt*.toml`, `*prompt*.yaml`, or files under a `*prompts*/` directory) are flagged as well.\n- **Deleted files**: Flags removed files.\n\n**Custom patterns.** Additional regular expressions can be configured via `extra_risky_shapes`. Because regex execution\nhas security implications, `extra_risky_shapes` must be configured through host configuration (such as environment\nvariables or host settings) and cannot be overridden by repository `.pr_agent.toml` files. Each search with a custom\npattern has a 50 ms limit, and each custom pattern has 1 s in total per review. If a pattern exceeds either one,\nPR-Agent logs a warning and skips that pattern for the rest of the review.\n\n:::\n\n### Merge recommendation\n\nWhen `require_merge_recommendation` is enabled, PR-Agent computes the published verdict from deterministic checks.\nThe model can only make the verdict more cautious: it can lower a clean verdict, or raise `needs_review` to\n`changes_required`, but it cannot override a failed deterministic check.\n\n**Checks and sources**\n\n- `CI on reviewed head` (deterministic): requires passing CI for the reviewed head. Unavailable CI status fails\n  closed.\n- `Head is current with its base` (deterministic): requires the reviewed head to be current with its base for\n  reviewed files. Unavailable staleness status fails closed.\n- `Human authors` (deterministic): requires all authors to be human. Bot/unlinked or unavailable author data fails\n  closed.\n- `No sensitive paths or risky changes` (deterministic): requires no findings from deterministic risk checks\n  (`sensitive_paths`, risky diff shapes, deleted files). Unavailable risk-check data fails closed.\n- `Changed lines within cap` (deterministic): requires total added/removed lines within\n  `pr_reviewer.max_changed_lines`. Unavailable line counts fail closed.\n- `Model merge recommendation` (model, veto only): if the model returns `needs_review` or `changes_required`, the\n  verdict cannot be `no_concerns_found`.\n- `Model risk level` (model, veto only): if the model returns `medium` or `high` risk, the verdict cannot be\n  `no_concerns_found`.\n\n`no_concerns_found` requires all deterministic checks to pass and no model veto. If any deterministic check cannot be\nevaluated, the verdict fails closed. The review includes each check and its result.\n\n**Configuration and status publishing**\n\n- `pr_reviewer.sensitive_paths`: glob patterns for files treated as sensitive by deterministic risk checks.\n  Host-only.\n- `pr_reviewer.max_changed_lines`: host-only changed-line cap for `no_concerns_found`. Counts added and removed\n  lines.\n- `pr_reviewer.extra_risky_shapes`: host-only custom regex patterns scanned in added and removed diff lines.\n- `publish_merge_recommendation_status`: publishes the verdict for the exact reviewed head SHA. GitHub uses the\n  `PR Agent - Review` check run; GitLab uses a commit status.\n\n`needs_review` publishes as neutral on GitHub and skipped on GitLab, so it does not block merges by itself.\n`changes_required` publishes as failure/failed and blocks merges when that status is required. To require it, add\n`PR Agent - Review` as a required status/check in your GitHub branch protection rule or ruleset, or require the\nPR-Agent commit status in your GitLab project's merge rules. A new commit has no PR-Agent verdict status until it is\nreviewed.\n\nThe verdict scans the complete PR diff, including ignored paths and files already reviewed by an incremental review.\nIf the full diff or a trustworthy CI timestamp is unavailable, the verdict cannot be `no_concerns_found`.\n\n### Gated auto-approval\n\n:::warning\n\nOff by default and host-only (`config.enable_auto_approval`). An approval counts toward a protected branch's\nrequired reviews, so enable it only where an automated approval of small, clean changes is acceptable. PR-Agent\nnever merges.\n\n:::\n\nWhen the host sets `config.enable_auto_approval` (for example `CONFIG__ENABLE_AUTO_APPROVAL=true`), `/review` on\nGitHub and GitLab approves the exact commit it reviewed only when all of these hold:\n\n- the computed merge recommendation is `no_concerns_found`;\n- the model returned both a merge recommendation and a risk level, so `require_merge_recommendation` and\n  `require_risk_assessment` must be enabled;\n- the review covered the whole pull request: not an incremental review, no file left out by the ignore rules or the\n  file-type filter, no file left out or cut short to fit the model's context, and no part of the diff failed;\n- the review completed and its finding state could be updated.\n\nEach `/review` run withdraws the approval PR-Agent gave when it starts, and approves again only when it ends with all\nof these holding, so a run that fails or finds a concern leaves no approval behind. On a push, the GitHub App, the\nGitHub Action, and the GitLab webhook dismiss it before any other event filter runs. A change of base branch also\ndismisses it, and on GitHub so does a reopen. On GitHub, PR-Agent only dismisses approvals it gave automatically;\nmanual approvals from the same account are left alone. On GitLab, an approval belongs to the token's account, so use\nan account reserved for PR-Agent. With `publish_output` off, nothing is approved or dismissed.\n\n`enable_auto_approval` is host-only: a repository `.pr_agent.toml` or a comment argument cannot turn it on.\n\n**Required repository settings.**\n\n- On GitHub, turn on \"Dismiss stale pull request approvals when new commits are pushed\" in the branch protection\n  rule or ruleset. PR-Agent can miss a push (a failed webhook delivery, a polling deployment, or a workflow that\n  does not listen to `synchronize`), and GitHub only removes a stale approval itself when this is on.\n- On GitLab, enable merge request approvals for the project and keep approvals reset on push in the project's\n  approval settings, so a missed webhook does not leave a stale approval behind.\n- For the GitHub Action, allow \"GitHub Actions to create and approve pull requests\" in the repository's Actions\n  settings. Pull requests from forks get a read-only token, so they cannot be approved.\n- If the rule restricts who can dismiss reviews, include PR-Agent's account; otherwise it cannot withdraw its own\n  approval, and only logs an error.\n\nGitHub does not let an account approve a pull request it opened. GitLab can also reject approval by the merge\nrequest author according to the project's approval settings. Other git providers are not supported yet.\n\n**Suggested rollout**\n\n1. Enable `require_merge_recommendation`, `require_risk_assessment`, and `publish_merge_recommendation_status` on\n   the host. Tune `sensitive_paths` and `max_changed_lines` as needed.\n2. Require the published verdict status in branch protection or merge rules, and verify verdicts on representative\n   PRs.\n3. Enable `config.enable_auto_approval` for a limited scope first (or a pilot environment), confirm approvals are\n   dismissed on push/base changes, and monitor outcomes.\n4. Expand gradually once the behavior matches your repository's review policy. Keep PR-Agent's account permissions\n   and stale-approval settings in place.\n\n<!-- File: docs/docs/commands/similar_issues.md (Tokens: ~1991 | Category: command-prompt) -->\n---\ntitle: \"Similar Issues\"\nsidebar_position: 8\n---\n\n## Overview\n\n> **Note**: `/similar_issue` is an **experimental** feature. It works only on GitHub, carries a disproportionately large share of the project's dependency and configuration surface for a single-provider command, and is therefore excluded from the v1 stability guarantees. No backend is tested against its real driver.\n\nThe similar issue command retrieves the most similar issues to the current issue.\nIt is an issue-scoped command: comment `/similar_issue` on the issue (served by the GitHub Action; the GitHub App webhook only dispatches comments on pull requests), or run it from the CLI with `--issue_url`:\n\n```\n/similar_issue\n```\n\n## Example usage\n\n<img src=\"/img/similar_issue_original_issue.png\" alt=\"similar_issue_original_issue\" width=\"768\" />\n\n<img src=\"/img/similar_issue_comment.png\" alt=\"similar_issue_comment\" width=\"768\" />\n\n<img src=\"/img/similar_issue.png\" alt=\"similar_issue\" width=\"768\" />\n\n### Indexing and re-runs\n\nTo perform retrieval, the `similar_issue` command indexes the repository's issues in the configured vector database. On every backend:\n\n- The **first run** indexes up to `max_issues_to_scan` issues (default `500`).\n- **Later runs** check the newest `max_issues_to_scan` issues and index any that are missing, so previously-indexed issues are not re-embedded.\n- `force_update_dataset = true` makes every run re-index up to `max_issues_to_scan` issues: LanceDB replaces the repository's rows, Pinecone and Qdrant upsert over the existing rows.\n- `skip_comments = true` skips issue comments and embeds only the issue title and body.\n\nEmbedding inputs are limited to **8,191 tokens** (one token below the model's\n8,192-token context). Issues or comments exceeding this limit are skipped during\nindexing; an oversized issue also excludes its comments. Long similarity queries\nare truncated to their first 8,191 tokens, so later content does not influence\nthe results.\n\nThese keys live under the `[pr_similar_issue]` section. Each backend section below describes its own configuration and re-run behaviour.\n\nIf the embedding service rejects the credentials (HTTP 401) or denies access (HTTP 403), indexing stops immediately on every vector database backend.\nCorrect the embedding API key or access permissions before running the command again; other embedding errors retain the existing batch and per-item fallback behavior.\n\n### Selecting a Vector Database\n\nConfigure your preferred database by setting the `vectordb` parameter under `[pr_similar_issue]` in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"lancedb\"  # options: \"pinecone\", \"lancedb\", \"qdrant\"\n```\n\n#### Available Options\n\nChoose from the following Vector Databases:\n\n1. LanceDB\n2. Pinecone\n3. Qdrant\n\n#### LanceDB Configuration\n\nLanceDB is the default backend (`vectordb = \"lancedb\"`) and needs no external credentials. The index is stored in a local directory given by the `[lancedb] uri` key (default `./lancedb`). A single table (`codium-ai-pr-agent-issues`) is shared by every repository indexed into the same directory; rows are tagged with the repository name in the metadata.\n\nAs described in [Indexing and re-runs](#indexing-and-re-runs), the first run creates the table and indexes up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` replaces the repository's rows with a fresh index of up to `max_issues_to_scan` issues.\n\n#### Pinecone Configuration\n\nTo use Pinecone with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[pinecone]\napi_key = \"...\"\ncloud = \"aws\"\nregion = \"us-east-1\"\n```\n\nThe `cloud` value must be one of `aws`, `gcp` or `azure`, and `region` must be an\navailability region offered by that cloud. These parameters can be obtained by\nregistering to [Pinecone](https://app.pinecone.io/?sessionType=signup/). Note that the\ncommand uses Pinecone's serverless index API; the former `environment` setting from the\ngcp-starter pod tier is no longer supported.\n\n`cloud` and `region` are only used when the index does not exist yet and needs to be\ncreated. An existing index is opened by name and is never recreated, so moving an\nexisting deployment to the new configuration does not lose the stored vectors.\n\nOn re-runs, the first run creates the index and upserts up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[No backend is tested against its real driver]\n\nThe `similar-issue` dependency group is not installed in CI, so the pinecone tests run\nagainst a faked module, the qdrant tests never construct a client, and the lancedb tests\nrun against a fake table.\n:::\n\n:::note[Default vector database]\n\n`vectordb` defaults to `lancedb`, which works with no external credentials. To use\nqdrant or pinecone, set `vectordb = \"qdrant\"` or `vectordb = \"pinecone\"` under\n`[pr_similar_issue]`.\n:::\n\n#### Qdrant Configuration\n\nTo use Qdrant with the `similar issue` command, add these credentials to `.secrets.toml` (or set as environment variables):\n\n```\n[qdrant]\nurl = \"https://YOUR-QDRANT-URL\" # e.g., https://xxxxxxxx-xxxxxxxx.eu-central-1-0.aws.cloud.qdrant.io\napi_key = \"...\"\n```\n\nThen select Qdrant in `configuration.toml`:\n\n```\n[pr_similar_issue]\nvectordb = \"qdrant\"\n```\n\nYou can get a free managed Qdrant instance from [Qdrant Cloud](https://cloud.qdrant.io/).\n\n`api_key` must be present even when the server does not enforce authentication (an empty string is accepted): the command reads both `url` and `api_key` and raises when either is absent. A re-index uploads the records from up to `max_issues_to_scan` issues.\n\nQdrant points are stored in a collection named `codium-ai-pr-agent-issues-v2`, derived by appending a `-v2` suffix to the shared index name (`codium-ai-pr-agent-issues`). The suffix is an implementation detail of the Qdrant backend only; pinecone and lancedb use the unsuffixed name.\n\nOn re-runs, the first run creates the collection and stores up to `max_issues_to_scan` issues; later runs index any missing issue among the newest `max_issues_to_scan`; `force_update_dataset = true` re-indexes up to `max_issues_to_scan` issues.\n\n:::note[Upgrading an index created before the point-id fix]\n\nEarlier versions derived the point id from the issue id alone, so the same issue number collided\nacross repositories. The id is now seeded with the repository name, which means points written by\nan earlier version are never rewritten or deleted - they still carry a matching `metadata.repo`\npayload, so they stay queryable and can surface alongside their replacements.\n\nThe `-v2` collection suffix sidesteps this: the new index is written to\n`codium-ai-pr-agent-issues-v2`, leaving the pre-existing `codium-ai-pr-agent-issues` collection\nuntouched. Nothing is deleted, and the first run after the upgrade re-indexes the repository into\nthe new collection. Once you are satisfied with the results, you can delete the old\n`codium-ai-pr-agent-issues` collection from Qdrant by hand to reclaim the storage.\n:::\n\n## How to use\n\n- Install the command's extra dependencies (vector databases and datasets), which a bare `uv sync` does not include:\n`uv sync --group similar-issue`\n\n- To invoke the 'similar issue' command from **CLI**, run:\n`uv run pr-agent --issue_url=... similar_issue`\n\n- To invoke the 'similar' issue command via online usage, [comment](https://github.com/the-pr-agent/pr-agent/issues/178#issuecomment-1716934893) on an issue:\n`/similar_issue`\n\n- To run automatically when an issue is opened, create a GitHub Actions workflow for the `issues: opened` event that invokes the CLI with that issue's URL. Adding `/similar_issue` to `github_app.pr_commands` does not handle issue-opened events.\n\n  With the default LanceDB backend, restore the configured `[lancedb] uri` directory (default `./lancedb`, relative to the CLI working directory) before running the CLI and save the updated directory afterward, or use a persistent remote Qdrant or Pinecone backend. On ephemeral hosted runners, an unpreserved local index is rebuilt on each run, repeating embedding costs for up to `max_issues_to_scan` issues (default `500`) and leaving previously indexed issues outside that batch unavailable for retrieval.\n\n<!-- File: docs/docs/commands/update_changelog.md (Tokens: ~791 | Category: command-prompt) -->\n---\ntitle: \"Update Changelog\"\nsidebar_position: 11\n---\n\n## Overview\n\nThe `update_changelog` command automatically updates a Markdown changelog with the PR changes.\nIt uses `CHANGELOG.md` at the repository root by default; `pr_update_changelog.changelog_path` selects a different file.\nIt can be invoked manually by commenting on any PR:\n\n```\n/update_changelog\n```\n\nEmpty or fence-only model responses are retried with the configured fallback models. If no model returns usable content, the command stops without writing to the changelog or publishing an update comment.\n\nHost operators can also opt in to forwarding the newly generated entry to the existing\n[push outputs](../usage-guide/push_outputs.md) destinations by selecting `update_changelog` in\n`push_outputs.commands`. These notifications contain a draft, not confirmation of a repository write.\n\n## Example usage\n\n<img src=\"/img/update_changelog_comment.png\" alt=\"update_changelog_comment\" width=\"768\" />\n\n<img src=\"/img/update_changelog.png\" alt=\"update_changelog\" width=\"768\" />\n\n## Configuration options\n\nUnder the section `pr_update_changelog`, the [configuration file](https://github.com/the-pr-agent/pr-agent/blob/main/pr_agent/settings/configuration.toml) contains options to customize the 'update changelog' command:\n\n- `changelog_path`: repository-relative path to the Markdown changelog, such as `HISTORY.md` or `docs/CHANGELOG.md`. Default is `CHANGELOG.md`. Set it in the root `.pr_agent.toml` or host configuration; comment/CLI arguments and per-directory settings cannot override it.\n- `push_changelog_changes`: whether to push the changes to the selected changelog, or just publish them as a comment. Default is false (publish as comment). Before pushing, the command requires a confirmed read of that file; a confirmed missing file is treated as empty, while other read failures skip the repository write, attempt to publish a not-pushed fallback comment, and surface the original error. If the repository write itself fails, the command makes one best-effort attempt to publish the generated changelog as a fallback and surfaces the original write error. Because a transport failure may happen after a completed remote write, this fallback reports the repository update as unconfirmed rather than promising it was not pushed.\n- `extra_instructions`: Optional extra instructions to the command. For example: \"Use the following structure: ...\"\n- `add_pr_link`: whether the model should try to add a link to the PR in the changelog. Default is true.\n- `skip_ci_on_push`: whether the commit message (when `push_changelog_changes` is true) will include the term \"[skip ci]\", preventing CI tests to be triggered on the changelog commit. Default is true.\n\n### Custom changelog location\n\nFor a changelog stored under `docs/`, add this to the repository's root `.pr_agent.toml`:\n\n```toml\n[pr_update_changelog]\nchangelog_path = \"docs/CHANGELOG.md\"\n```\n\nThen invoke `/update_changelog` as usual. The command reads that file to follow its existing structure and,\nwhen `push_changelog_changes` is enabled, prepends the new entry to the same file on the PR branch.\nComment-only output also uses the selected file as context and names it in the commit instructions.\n\nThe path must be a non-empty repository-relative file path using `/` separators, without empty,\n`.` or `..` components, Windows drive prefixes, backslashes, or control characters. Invalid values stop\nthe command before reading repository content. Spaces and Unicode names are accepted and kept exactly as written. The command updates\none Markdown changelog per command; it does not discover files, expand globs, or select a file per package.\nThe filename need not end in `.md`, but the generated content remains Markdown.\n</yakaai_skills>"}