Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/installation/locally.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
To run PR-Agent locally, you first need to acquire two keys:

1. An OpenAI key from [here](https://platform.openai.com/api-keys){:target="_blank"}, with access to GPT-4 and o4-mini (or a key for other [language models](../usage-guide/changing_a_model.md), if you prefer).
2. A personal access token from your Git platform (GitHub, GitLab, BitBucket,Gitea) with repo scope. GitHub token, for example, can be issued from [here](https://github.com/settings/tokens){:target="_blank"}
2. A personal access token from your Git platform (GitHub, GitLab, BitBucket, Gitea) with repo scope. GitHub token, for example, can be issued from [here](https://github.com/settings/tokens){:target="_blank"}

## Using Docker image

Expand Down
2 changes: 1 addition & 1 deletion pr_agent/algo/git_patch_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _calc_context_limits(patch_lines_before):
found_header = True
section_header = ''
else:
pass # its ok to be here. We cant apply dynamic context if the lines are different if 'old' and 'new' hunks
pass # its ok to be here. We can't apply dynamic context if the lines are different if 'old' and 'new' hunks
break

if not found_header:
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/algo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ def process_description(description_full: str) -> Tuple[str, List]:
pattern_back = r'<details>\s*<summary><strong>(.*?)</strong><dd><code>(.*?)</code>.*?</summary>\s*<hr>\s*(.*?)\n\n\s*(.*?)</details>'
res = re.search(pattern_back, file_data, re.DOTALL)
if not res or res.lastindex != 4:
pattern_back = r'<details>\s*<summary><strong>(.*?)</strong>\s*<dd><code>(.*?)</code>.*?</summary>\s*<hr>\s*(.*?)\s*-\s*(.*?)\s*</details>' # looking for hypen ('- ')
pattern_back = r'<details>\s*<summary><strong>(.*?)</strong>\s*<dd><code>(.*?)</code>.*?</summary>\s*<hr>\s*(.*?)\s*-\s*(.*?)\s*</details>' # looking for hyphen ('- ')
res = re.search(pattern_back, file_data, re.DOTALL)
if res and res.lastindex == 4:
short_filename = res.group(1).strip()
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/custom_merge_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def load(obj, env=None, silent=True, key=None, filename=None):
None
"""

MAX_TOML_SIZE_IN_BYTES = 100 * 1024 * 1024 # Prevent out of mem. exceptions by limiting to 100 MBs which is sufficient for upto 1M lines
MAX_TOML_SIZE_IN_BYTES = 100 * 1024 * 1024 # Prevent out of mem. exceptions by limiting to 100 MBs which is sufficient for up to 1M lines

# Get the list of files to load
# TODO: hasattr(obj, 'settings_files') for some reason returns False. Need to use 'settings_file'
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/servers/github_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async def polling_loop():
break
task_queue.clear()

# Dont wait for all processes to complete. Move on to the next iteration
# Don't wait for all processes to complete. Move on to the next iteration
# for p in processes:
# p.join()

Expand Down
2 changes: 1 addition & 1 deletion pr_agent/settings/.secrets_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pat = ""

[azure_devops_server]
# For Azure devops Server basic auth - configured in the webhook creation
# Optional, uncomment if you want to use Azure devops webhooks. Value assinged when you create the webhook
# Optional, uncomment if you want to use Azure devops webhooks. Value assigned when you create the webhook
# webhook_username = "<basic auth user>"
# webhook_password = "<basic auth password>"

Expand Down
4 changes: 2 additions & 2 deletions pr_agent/settings/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use_wiki_settings_file=true
use_repo_settings_file=true
use_global_settings_file=true
disable_auto_feedback = false
ai_timeout=120 # 2minutes
ai_timeout=120 # 2 minutes
skip_keys = []
custom_reasoning_model = false # when true, disables system messages and temperature controls for models that don't support chat-style inputs
response_language="en-US" # Language locales code for PR responses in ISO 3166 and ISO 639 format (e.g., "en-US", "it-IT", "zh-CN", ...)
Expand Down Expand Up @@ -130,7 +130,7 @@ use_conversation_history=true

[pr_code_suggestions] # /improve #
commitable_code_suggestions = false
dual_publishing_score_threshold=-1 # -1 to disable, [0-10] to set the threshold (>=) for publishing a code suggestion both in a table and as commitable
dual_publishing_score_threshold=-1 # -1 to disable, [0-10] to set the threshold (>=) for publishing a code suggestion both in a table and as committable
focus_only_on_problems=true
#
extra_instructions = ""
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/settings/pr_help_docs_headings_prompts.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[pr_help_docs_headings_prompts]
system="""You are Doc-helper, a language model that ranks documentation files based on their relevance to user questions.
You will receive a question, a repository url and file names along with optional groups of headings extracted from such files from that repository (either as markdown or as restructred text).
You will receive a question, a repository url and file names along with optional groups of headings extracted from such files from that repository (either as markdown or as restructured text).
Your task is to rank file paths based on how likely they contain the answer to a user's question, using only the headings from each such file and the file name.

======
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/settings/pr_help_docs_prompts.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[pr_help_docs_prompts]
system="""You are Doc-helper, a language model designed to answer questions about a documentation website for a given repository.
You will receive a question, a repository url and the full documentation content for that repository (either as markdown or as restructred text).
You will receive a question, a repository url and the full documentation content for that repository (either as markdown or as restructured text).
Your goal is to provide the best answer to the question using the documentation provided.

Additional instructions:
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/settings/pr_help_prompts.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pr_help_prompts]
system="""You are Doc-helper, a language models designed to answer questions about a documentation website for an open-soure project called "PR-Agent" (recently renamed to "Qodo Merge").
system="""You are Doc-helper, a language model designed to answer questions about a documentation website for an open-source project called "PR-Agent" (recently renamed to "Qodo Merge").
You will receive a question, and the full documentation website content.
Your goal is to provide the best answer to the question using the documentation provided.

Expand Down
8 changes: 4 additions & 4 deletions pr_agent/settings/pr_reviewer_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Review(BaseModel):
ticket_compliance_check: List[TicketCompliance] = Field(description="A list of compliance checks for the related tickets")
{%- endif %}
{%- if require_estimate_effort_to_review %}
estimated_effort_to_review_[1-5]: int = Field(description="Estimate, on a scale of 1-5 (inclusive), the time and effort required to review this PR by an experienced and knowledgeable developer. 1 means short and easy review , 5 means long and hard review. Take into account the size, complexity, quality, and the needed changes of the PR code diff.")
estimated_effort_to_review_[1-5]: int = Field(description="Estimate, on a scale of 1-5 (inclusive), the time and effort required to review this PR by an experienced and knowledgeable developer. 1 means short and easy review, 5 means long and hard review. Take into account the size, complexity, quality, and the needed changes of the PR code diff.")
{%- endif %}
{%- if require_estimate_contribution_time_cost %}
contribution_time_cost_estimate: ContributionTimeCostEstimate = Field(description="An estimate of the time required to implement the changes, based on the quantity, quality, and complexity of the contribution, as well as the context from the PR description and commit messages.")
Expand All @@ -124,20 +124,20 @@ class Review(BaseModel):
score: str = Field(description="Rate this PR on a scale of 0-100 (inclusive), where 0 means the worst possible PR code, and 100 means PR code of the highest quality, without any bugs or performance issues, that is ready to be merged immediately and run in production at scale.")
{%- endif %}
{%- if require_tests %}
relevant_tests: str = Field(description="yes/no question: does this PR have relevant tests added or updated ?")
relevant_tests: str = Field(description="yes/no question: does this PR have relevant tests added or updated?")
{%- endif %}
{%- if question_str %}
insights_from_user_answers: str = Field(description="shortly summarize the insights you gained from the user's answers to the questions")
{%- endif %}
key_issues_to_review: List[KeyIssuesComponentLink] = Field("A concise list (0-{{ num_max_findings }} issues) of bugs, security vulnerabilities, or significant performance concerns introduced in this PR. Only include issues you are confident about. If confidence is limited but the potential impact is high (e.g., data loss, security), you may include it only if you explicitly note what remains uncertain. Each issue must identify a concrete problem with a realistic trigger scenario. An empty list is acceptable if no clear issues are found.")
{%- if require_security_review %}
security_concerns: str = Field(description="Does this PR code introduce vulnerabilities such as exposure of sensitive information (e.g., API keys, secrets, passwords), or security concerns like SQL injection, XSS, CSRF, and others ? Answer 'No' (without explaining why) if there are no possible issues. If there are security concerns or issues, start your answer with a short header, such as: 'Sensitive information exposure: ...', 'SQL injection: ...', etc. Explain your answer. Be specific and give examples if possible")
security_concerns: str = Field(description="Does this PR code introduce vulnerabilities such as exposure of sensitive information (e.g., API keys, secrets, passwords), or security concerns like SQL injection, XSS, CSRF, and others? Answer 'No' (without explaining why) if there are no possible issues. If there are security concerns or issues, start your answer with a short header, such as: 'Sensitive information exposure: ...', 'SQL injection: ...', etc. Explain your answer. Be specific and give examples if possible")
{%- endif %}
{%- if require_todo_scan %}
todo_sections: Union[List[TodoSection], str] = Field(description="A list of TODO comments found in the PR code. Return 'No' (as a string) if there are no TODO comments in the PR")
{%- endif %}
{%- if require_can_be_split_review %}
can_be_split: List[SubPR] = Field(min_items=0, max_items=3, description="Can this PR, which contains {{ num_pr_files }} changed files in total, be divided into smaller sub-PRs with distinct tasks that can be reviewed and merged independently, regardless of the order ? Make sure that the sub-PRs are indeed independent, with no code dependencies between them, and that each sub-PR represent a meaningful independent task. Output an empty list if the PR code does not need to be split.")
can_be_split: List[SubPR] = Field(min_items=0, max_items=3, description="Can this PR, which contains {{ num_pr_files }} changed files in total, be divided into smaller sub-PRs with distinct tasks that can be reviewed and merged independently, regardless of the order? Make sure that the sub-PRs are indeed independent, with no code dependencies between them, and that each sub-PR represents a meaningful independent task. Output an empty list if the PR code does not need to be split.")
{%- endif %}

class PRReview(BaseModel):
Expand Down
Loading