From d497c33c7411569ca7e64cd53e476041fe98d18e Mon Sep 17 00:00:00 2001 From: Mr_Jing Date: Sun, 3 Aug 2025 08:46:41 +0800 Subject: [PATCH 01/24] fix: support private_token authentication for GitLab private deployments - Add intelligent authentication method detection based on GitLab URL - Support explicit configuration override via GITLAB.AUTH_TYPE - Maintain backward compatibility with existing oauth_token usage - Fix 401 Unauthorized errors for private GitLab deployments Fixes authentication issues where private GitLab instances require private_token instead of oauth_token for API access. --- pr_agent/git_providers/gitlab_provider.py | 40 ++++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index 8cfe05f6..ac889b62 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -35,10 +35,20 @@ class GitLabProvider(GitProvider): gitlab_access_token = get_settings().get("GITLAB.PERSONAL_ACCESS_TOKEN", None) if not gitlab_access_token: raise ValueError("GitLab personal access token is not set in the config file") - self.gl = gitlab.Gitlab( - url=gitlab_url, - oauth_token=gitlab_access_token - ) + # Use encapsulated method to determine authentication method + auth_method = self._get_auth_method(gitlab_url) + + # Create GitLab instance based on authentication method + if auth_method == "oauth_token": + self.gl = gitlab.Gitlab( + url=gitlab_url, + oauth_token=gitlab_access_token + ) + else: # private_token + self.gl = gitlab.Gitlab( + url=gitlab_url, + private_token=gitlab_access_token + ) self.max_comment_chars = 65000 self.id_project = None self.id_mr = None @@ -52,6 +62,26 @@ class GitLabProvider(GitProvider): r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@[ ]?(.*)") self.incremental = incremental + def _get_auth_method(self, gitlab_url: str) -> str: + """ + Determine the authentication method for a GitLab instance. + + Args: + gitlab_url: URL of the GitLab instance + + Returns: + Authentication method: "oauth_token" or "private_token" + """ + # Check for explicit configuration override first + explicit_auth_type = get_settings().get("GITLAB.AUTH_TYPE", None) + if explicit_auth_type: + return explicit_auth_type + + # Default strategy: gitlab.com and gitlab.io use oauth_token, others use private_token + if "gitlab.com" in gitlab_url or "gitlab.io" in gitlab_url: + return "oauth_token" + return "private_token" + def is_supported(self, capability: str) -> bool: if capability in ['get_issue_comments', 'create_inline_comment', 'publish_inline_comments', 'publish_file_comments']: # gfm_markdown is supported in gitlab ! @@ -677,7 +707,7 @@ class GitLabProvider(GitProvider): get_logger().error(f"Repo URL: {repo_url_to_clone} is not a valid gitlab URL.") return None (scheme, base_url) = repo_url_to_clone.split("gitlab.") - access_token = self.gl.oauth_token + access_token = self.gl.oauth_token or self.gl.private_token if not all([scheme, access_token, base_url]): get_logger().error(f"Either no access token found, or repo URL: {repo_url_to_clone} " f"is missing prefix: {scheme} and/or base URL: {base_url}.") From 2d858a43be41be4a08dde95669cbfc017dcd9a72 Mon Sep 17 00:00:00 2001 From: Mr_Jing Date: Sun, 3 Aug 2025 09:58:59 +0800 Subject: [PATCH 02/24] refactor: improve GitLab authentication method detection Address code review feedback from PR #1969: 1. Improve URL matching precision: - Use urlparse for robust hostname validation - Prevent false positives with URL substring matching - Add support for gitlab.com/gitlab.io subdomains 2. Add authentication type validation: - Validate explicit GITLAB.AUTH_TYPE configuration - Provide clear error messages for invalid auth types - Prevent silent failures from user configuration errors This enhances code reliability and user experience while maintaining backward compatibility. --- pr_agent/git_providers/gitlab_provider.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index ac889b62..82287fcf 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -75,11 +75,23 @@ class GitLabProvider(GitProvider): # Check for explicit configuration override first explicit_auth_type = get_settings().get("GITLAB.AUTH_TYPE", None) if explicit_auth_type: + # Validate the explicit authentication type + if explicit_auth_type not in ["oauth_token", "private_token"]: + raise ValueError(f"Unsupported GITLAB.AUTH_TYPE: '{explicit_auth_type}'. " + f"Must be 'oauth_token' or 'private_token'.") return explicit_auth_type - # Default strategy: gitlab.com and gitlab.io use oauth_token, others use private_token - if "gitlab.com" in gitlab_url or "gitlab.io" in gitlab_url: - return "oauth_token" + # Default strategy: Use precise hostname matching for gitlab.com and gitlab.io + try: + parsed_url = urlparse(gitlab_url) + hostname = parsed_url.hostname + if hostname and (hostname == "gitlab.com" or hostname == "gitlab.io" or + hostname.endswith(".gitlab.com") or hostname.endswith(".gitlab.io")): + return "oauth_token" + except Exception: + # If URL parsing fails, fall back to private_token for safety + pass + return "private_token" def is_supported(self, capability: str) -> bool: From b81b671ab1f584adaacc703367426650e066882e Mon Sep 17 00:00:00 2001 From: huangyoje Date: Sun, 3 Aug 2025 11:50:38 +0800 Subject: [PATCH 03/24] Fix: defer file sorting until after token calculation --- pr_agent/algo/pr_processing.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index 55098b59..dda0d9a2 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -398,11 +398,6 @@ def get_pr_multi_diffs(git_provider: GitProvider, # Sort files by main language pr_languages = sort_files_by_main_languages(git_provider.get_languages(), diff_files) - # Sort files within each language group by tokens in descending order - sorted_files = [] - for lang in pr_languages: - sorted_files.extend(sorted(lang['files'], key=lambda x: x.tokens, reverse=True)) - # Get the maximum number of extra lines before and after the patch PATCH_EXTRA_LINES_BEFORE = get_settings().config.patch_extra_lines_before PATCH_EXTRA_LINES_AFTER = get_settings().config.patch_extra_lines_after @@ -420,6 +415,11 @@ def get_pr_multi_diffs(git_provider: GitProvider, if total_tokens + OUTPUT_BUFFER_TOKENS_SOFT_THRESHOLD < get_max_tokens(model): return ["\n".join(patches_extended)] if patches_extended else [] + # Sort files within each language group by tokens in descending order + sorted_files = [] + for lang in pr_languages: + sorted_files.extend(sorted(lang['files'], key=lambda x: x.tokens, reverse=True)) + patches = [] final_diff_list = [] total_tokens = token_handler.prompt_tokens From fdd91c66631aa340b5a0a68625e63af98fd9f807 Mon Sep 17 00:00:00 2001 From: ofir-frd Date: Sun, 3 Aug 2025 15:42:09 +0300 Subject: [PATCH 04/24] docs: add compliance tool to RAG context enrichment documentation and adjust image widths --- .../core-abilities/rag_context_enrichment.md | 23 ++++++++++++------- docs/docs/tools/compliance.md | 4 ++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/docs/core-abilities/rag_context_enrichment.md b/docs/docs/core-abilities/rag_context_enrichment.md index 0fc64620..3113bbd6 100644 --- a/docs/docs/core-abilities/rag_context_enrichment.md +++ b/docs/docs/core-abilities/rag_context_enrichment.md @@ -44,11 +44,18 @@ enable_rag=true RAG capability is exclusively available in the following tools: -=== "`/review`" - The [`/review`](https://qodo-merge-docs.qodo.ai/tools/review/) tool offers the _Focus area from RAG data_ which contains feedback based on the RAG references analysis. - The complete list of references found relevant to the PR will be shown in the _References_ section, helping developers understand the broader context by exploring the provided references. +=== "`/ask`" + The [`/ask`](https://qodo-merge-docs.qodo.ai/tools/ask/) tool can access broader repository context through the RAG feature when answering questions that go beyond the PR scope alone. + The _References_ section displays the additional repository content consulted to formulate the answer. - ![RAGed review tool](https://codium.ai/images/pr_agent/rag_review.png){width=640} + ![RAGed ask tool](https://codium.ai/images/pr_agent/rag_ask.png){width=640} + + +=== "`/compliance`" + The [`/compliance`](https://qodo-merge-docs.qodo.ai/tools/compliance/) tool offers the _Codebase Code Duplication Compliance_ section which contains feedback based on the RAG references. + This section highlights possible code duplication issues in the PR, providing developers with insights into potential code quality concerns. + + ![RAGed compliance tool](https://codium.ai/images/pr_agent/rag_compliance.png){width=640} === "`/implement`" The [`/implement`](https://qodo-merge-docs.qodo.ai/tools/implement/) tool utilizes the RAG feature to provide comprehensive context of the repository codebase, allowing it to generate more refined code output. @@ -56,11 +63,11 @@ RAG capability is exclusively available in the following tools: ![RAGed implement tool](https://codium.ai/images/pr_agent/rag_implement.png){width=640} -=== "`/ask`" - The [`/ask`](https://qodo-merge-docs.qodo.ai/tools/ask/) tool can access broader repository context through the RAG feature when answering questions that go beyond the PR scope alone. - The _References_ section displays the additional repository content consulted to formulate the answer. +=== "`/review`" + The [`/review`](https://qodo-merge-docs.qodo.ai/tools/review/) tool offers the _Focus area from RAG data_ which contains feedback based on the RAG references analysis. + The complete list of references found relevant to the PR will be shown in the _References_ section, helping developers understand the broader context by exploring the provided references. - ![RAGed ask tool](https://codium.ai/images/pr_agent/rag_ask.png){width=640} + ![RAGed review tool](https://codium.ai/images/pr_agent/rag_review.png){width=640} ## Limitations diff --git a/docs/docs/tools/compliance.md b/docs/docs/tools/compliance.md index b4e43ba7..3c951dda 100644 --- a/docs/docs/tools/compliance.md +++ b/docs/docs/tools/compliance.md @@ -5,10 +5,10 @@ The `compliance` tool performs comprehensive compliance checks on PR code changes, validating them against security standards, ticket requirements, and custom organizational compliance checklists, thereby helping teams, enterprises, and agents maintain consistent code quality and security practices while ensuring that development work aligns with business requirements. === "Fully Compliant" - ![compliance_overview](https://codium.ai/images/pr_agent/compliance_full.png){width=256} + ![compliance_overview](https://codium.ai/images/pr_agent/compliance_full.png){width=512} === "Partially Compliant" - ![compliance_overview](https://codium.ai/images/pr_agent/compliance_partial.png){width=256} + ![compliance_overview](https://codium.ai/images/pr_agent/compliance_partial.png){width=512} ___ From 54ffb2d0a178d946b14a6c664cfe49760799604a Mon Sep 17 00:00:00 2001 From: Seokjae Lee Date: Mon, 4 Aug 2025 11:05:29 +0900 Subject: [PATCH 05/24] docs: add interactive Q&A feature documentation for review comments - Add section explaining how to enable interactive Q&A on PR Agent review comments - Include configuration for PR_CODE_SUGGESTIONS.COMMITABLE_CODE_SUGGESTIONS - Add GitHub Actions workflow example for issue_comment events - Document /ask command usage for contextual responses --- docs/docs/usage-guide/automations_and_usage.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/docs/usage-guide/automations_and_usage.md b/docs/docs/usage-guide/automations_and_usage.md index 5359d9d7..10583061 100644 --- a/docs/docs/usage-guide/automations_and_usage.md +++ b/docs/docs/usage-guide/automations_and_usage.md @@ -202,6 +202,23 @@ publish_labels = false to prevent Qodo Merge from publishing labels when running the `describe` tool. +#### Interactive Q&A on Review Comments + +PR Agent can also engage in interactive question-and-answer sessions based on its review comments. To enable this feature: + +1. Set `PR_CODE_SUGGESTIONS.COMMITABLE_CODE_SUGGESTIONS: true` in your configuration +2. Configure your GitHub Actions workflow to trigger on `issue_comment` [events](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#issue_comment) (`created` and `edited`) + +Example GitHub Actions workflow configuration: + +```yaml +on: + issue_comment: + types: [created, edited] +``` + +When this is configured, users can ask questions about PR Agent's review comments using the `/ask` command, and receive contextual responses based on the review context. + #### Quick Reference: Model Configuration in GitHub Actions For detailed step-by-step examples of configuring different models (Gemini, Claude, Azure OpenAI, etc.) in GitHub Actions, see the [Configuration Examples](../installation/github.md#configuration-examples) section in the installation guide. From dd6f56915bf7f5f6dbb6b196a6f15260185fa796 Mon Sep 17 00:00:00 2001 From: Mr_Jing Date: Mon, 4 Aug 2025 10:35:52 +0800 Subject: [PATCH 06/24] improve: enhance GitLab provider error handling and attribute access safety - Add try-catch block around GitLab instance creation for better error handling - Use getattr() for safer attribute access in _prepare_clone_url_with_token method - Improve authentication failure debugging with clearer error messages --- pr_agent/git_providers/gitlab_provider.py | 26 +++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index 82287fcf..e172106f 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -39,16 +39,20 @@ class GitLabProvider(GitProvider): auth_method = self._get_auth_method(gitlab_url) # Create GitLab instance based on authentication method - if auth_method == "oauth_token": - self.gl = gitlab.Gitlab( - url=gitlab_url, - oauth_token=gitlab_access_token - ) - else: # private_token - self.gl = gitlab.Gitlab( - url=gitlab_url, - private_token=gitlab_access_token - ) + try: + if auth_method == "oauth_token": + self.gl = gitlab.Gitlab( + url=gitlab_url, + oauth_token=gitlab_access_token + ) + else: # private_token + self.gl = gitlab.Gitlab( + url=gitlab_url, + private_token=gitlab_access_token + ) + except Exception as e: + get_logger().error(f"Failed to create GitLab instance: {e}") + raise ValueError(f"Unable to authenticate with GitLab: {e}") self.max_comment_chars = 65000 self.id_project = None self.id_mr = None @@ -719,7 +723,7 @@ class GitLabProvider(GitProvider): get_logger().error(f"Repo URL: {repo_url_to_clone} is not a valid gitlab URL.") return None (scheme, base_url) = repo_url_to_clone.split("gitlab.") - access_token = self.gl.oauth_token or self.gl.private_token + access_token = getattr(self.gl, 'oauth_token', None) or getattr(self.gl, 'private_token', None) if not all([scheme, access_token, base_url]): get_logger().error(f"Either no access token found, or repo URL: {repo_url_to_clone} " f"is missing prefix: {scheme} and/or base URL: {base_url}.") From 9383cdd520ae100250f14a93b5fb55455138c154 Mon Sep 17 00:00:00 2001 From: Seokjae Lee Date: Tue, 5 Aug 2025 16:30:07 +0900 Subject: [PATCH 07/24] docs: apply code review --- docs/docs/usage-guide/automations_and_usage.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/docs/usage-guide/automations_and_usage.md b/docs/docs/usage-guide/automations_and_usage.md index 10583061..4dabb87a 100644 --- a/docs/docs/usage-guide/automations_and_usage.md +++ b/docs/docs/usage-guide/automations_and_usage.md @@ -202,12 +202,9 @@ publish_labels = false to prevent Qodo Merge from publishing labels when running the `describe` tool. -#### Interactive Q&A on Review Comments +#### Enable using commands in PR -PR Agent can also engage in interactive question-and-answer sessions based on its review comments. To enable this feature: - -1. Set `PR_CODE_SUGGESTIONS.COMMITABLE_CODE_SUGGESTIONS: true` in your configuration -2. Configure your GitHub Actions workflow to trigger on `issue_comment` [events](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#issue_comment) (`created` and `edited`) +You can configure your GitHub Actions workflow to trigger on `issue_comment` [events](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#issue_comment) (`created` and `edited`). Example GitHub Actions workflow configuration: @@ -217,7 +214,7 @@ on: types: [created, edited] ``` -When this is configured, users can ask questions about PR Agent's review comments using the `/ask` command, and receive contextual responses based on the review context. +When this is configured, Qodo merge can be invoked by commenting on the PR. #### Quick Reference: Model Configuration in GitHub Actions From 06bb64a0a2662030bf7eb17d2b7808d13208d147 Mon Sep 17 00:00:00 2001 From: Seokjae Lee Date: Mon, 4 Aug 2025 11:05:29 +0900 Subject: [PATCH 08/24] docs: improve document for enable using commands in PR comments the GitHub Actions Closes #1968 --- docs/docs/usage-guide/automations_and_usage.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/docs/usage-guide/automations_and_usage.md b/docs/docs/usage-guide/automations_and_usage.md index 5359d9d7..4dabb87a 100644 --- a/docs/docs/usage-guide/automations_and_usage.md +++ b/docs/docs/usage-guide/automations_and_usage.md @@ -202,6 +202,20 @@ publish_labels = false to prevent Qodo Merge from publishing labels when running the `describe` tool. +#### Enable using commands in PR + +You can configure your GitHub Actions workflow to trigger on `issue_comment` [events](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#issue_comment) (`created` and `edited`). + +Example GitHub Actions workflow configuration: + +```yaml +on: + issue_comment: + types: [created, edited] +``` + +When this is configured, Qodo merge can be invoked by commenting on the PR. + #### Quick Reference: Model Configuration in GitHub Actions For detailed step-by-step examples of configuring different models (Gemini, Claude, Azure OpenAI, etc.) in GitHub Actions, see the [Configuration Examples](../installation/github.md#configuration-examples) section in the installation guide. From 0b00812269168e855fc2950424865095f8bb6db9 Mon Sep 17 00:00:00 2001 From: marc0777 Date: Tue, 5 Aug 2025 11:55:01 +0200 Subject: [PATCH 09/24] feat: allow configuring gitlab ssl verification --- docs/docs/installation/gitlab.md | 3 +++ pr_agent/git_providers/gitlab_provider.py | 4 +++- pr_agent/settings/configuration.toml | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/docs/installation/gitlab.md b/docs/docs/installation/gitlab.md index 7e587617..69ea715a 100644 --- a/docs/docs/installation/gitlab.md +++ b/docs/docs/installation/gitlab.md @@ -42,6 +42,9 @@ Note that if your base branches are not protected, don't set the variables as `p > **Note**: The `$CI_SERVER_FQDN` variable is available starting from GitLab version 16.10. If you're using an earlier version, this variable will not be available. However, you can combine `$CI_SERVER_HOST` and `$CI_SERVER_PORT` to achieve the same result. Please ensure you're using a compatible version or adjust your configuration. +> **Note**: The `gitlab__SSL_VERIFY` environment variable can be used to specify the path to a custom CA certificate bundle for SSL verification. GitLab exposes the `$CI_SERVER_TLS_CA_FILE` variable, which points to the custom CA certificate file configured in your GitLab instance. +> Alternatively, SSL verification can be disabled entirely by setting `gitlab__SSL_VERIFY=false`, although this is not recommended. + ## Run a GitLab webhook server 1. In GitLab create a new user and give it "Reporter" role ("Developer" if using Pro version of the agent) for the intended group or project. diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index e8eb2c97..84e7707d 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -32,12 +32,14 @@ class GitLabProvider(GitProvider): if not gitlab_url: raise ValueError("GitLab URL is not set in the config file") self.gitlab_url = gitlab_url + ssl_verify = get_settings().get("GITLAB.SSL_VERIFY", True) gitlab_access_token = get_settings().get("GITLAB.PERSONAL_ACCESS_TOKEN", None) if not gitlab_access_token: raise ValueError("GitLab personal access token is not set in the config file") self.gl = gitlab.Gitlab( url=gitlab_url, - oauth_token=gitlab_access_token + oauth_token=gitlab_access_token, + ssl_verify=ssl_verify ) self.max_comment_chars = 65000 self.id_project = None diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 80bfc639..d1963f01 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -284,6 +284,8 @@ push_commands = [ "/describe", "/review", ] +# Configure SSL validation for GitLab. Can be either set to the path of a custom CA or disabled entirely. +# ssl_verify = true [gitea_app] url = "https://gitea.com" From 39add8d78a02736cc9870fa98f582fb532589959 Mon Sep 17 00:00:00 2001 From: huangyoje Date: Wed, 6 Aug 2025 10:14:33 +0800 Subject: [PATCH 10/24] Fix comment_id name in handle_ask_line --- pr_agent/servers/gitlab_webhook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/servers/gitlab_webhook.py b/pr_agent/servers/gitlab_webhook.py index 37e95f66..868756d7 100644 --- a/pr_agent/servers/gitlab_webhook.py +++ b/pr_agent/servers/gitlab_webhook.py @@ -287,7 +287,7 @@ def handle_ask_line(body, data): question = body.replace('/ask', '').strip() path = data['object_attributes']['position']['new_path'] side = 'RIGHT' # if line_range_['start']['type'] == 'new' else 'LEFT' - _id = data['object_attributes']["discussion_id"] + comment_id = data['object_attributes']["discussion_id"] get_logger().info("Handling line ") body = f"/ask_line --line_start={start_line} --line_end={end_line} --side={side} --file_name={path} --comment_id={comment_id} {question}" except Exception as e: From fb73eb75f900718adb5af82017fb89b14e1185e9 Mon Sep 17 00:00:00 2001 From: Mr_Jing Date: Wed, 6 Aug 2025 12:03:53 +0800 Subject: [PATCH 11/24] refactor: simplify GitLab authentication configuration --- docs/docs/installation/gitlab.md | 2 ++ pr_agent/git_providers/gitlab_provider.py | 40 ++++------------------- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/docs/docs/installation/gitlab.md b/docs/docs/installation/gitlab.md index 7e587617..da54848e 100644 --- a/docs/docs/installation/gitlab.md +++ b/docs/docs/installation/gitlab.md @@ -67,6 +67,7 @@ git clone https://github.com/qodo-ai/pr-agent.git 2. In the secrets file/variables: - Set your AI model key in the respective section - In the [gitlab] section, set `personal_access_token` (with token from step 2) and `shared_secret` (with secret from step 3) + - **Authentication type**: Set `auth_type` to `"private_token"` for older GitLab versions (e.g., 11.x) or private deployments. Default is `"oauth_token"` for gitlab.com and newer versions. 6. Build a Docker image for the app and optionally push it to a Docker repository. We'll use Dockerhub as an example: @@ -82,6 +83,7 @@ CONFIG__GIT_PROVIDER=gitlab GITLAB__PERSONAL_ACCESS_TOKEN= GITLAB__SHARED_SECRET= GITLAB__URL=https://gitlab.com +GITLAB__AUTH_TYPE=oauth_token # Use "private_token" for older GitLab versions OPENAI__KEY= ``` diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index e172106f..c75e2a8a 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -35,8 +35,13 @@ class GitLabProvider(GitProvider): gitlab_access_token = get_settings().get("GITLAB.PERSONAL_ACCESS_TOKEN", None) if not gitlab_access_token: raise ValueError("GitLab personal access token is not set in the config file") - # Use encapsulated method to determine authentication method - auth_method = self._get_auth_method(gitlab_url) + # Authentication method selection via configuration + auth_method = get_settings().get("GITLAB.AUTH_TYPE", "oauth_token") + + # Basic validation of authentication type + if auth_method not in ["oauth_token", "private_token"]: + raise ValueError(f"Unsupported GITLAB.AUTH_TYPE: '{auth_method}'. " + f"Must be 'oauth_token' or 'private_token'.") # Create GitLab instance based on authentication method try: @@ -66,37 +71,6 @@ class GitLabProvider(GitProvider): r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@[ ]?(.*)") self.incremental = incremental - def _get_auth_method(self, gitlab_url: str) -> str: - """ - Determine the authentication method for a GitLab instance. - - Args: - gitlab_url: URL of the GitLab instance - - Returns: - Authentication method: "oauth_token" or "private_token" - """ - # Check for explicit configuration override first - explicit_auth_type = get_settings().get("GITLAB.AUTH_TYPE", None) - if explicit_auth_type: - # Validate the explicit authentication type - if explicit_auth_type not in ["oauth_token", "private_token"]: - raise ValueError(f"Unsupported GITLAB.AUTH_TYPE: '{explicit_auth_type}'. " - f"Must be 'oauth_token' or 'private_token'.") - return explicit_auth_type - - # Default strategy: Use precise hostname matching for gitlab.com and gitlab.io - try: - parsed_url = urlparse(gitlab_url) - hostname = parsed_url.hostname - if hostname and (hostname == "gitlab.com" or hostname == "gitlab.io" or - hostname.endswith(".gitlab.com") or hostname.endswith(".gitlab.io")): - return "oauth_token" - except Exception: - # If URL parsing fails, fall back to private_token for safety - pass - - return "private_token" def is_supported(self, capability: str) -> bool: if capability in ['get_issue_comments', 'create_inline_comment', 'publish_inline_comments', From 807ce6ec6568ea42288566b9d56822aea8722c91 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Tue, 5 Aug 2025 23:38:12 -0700 Subject: [PATCH 12/24] Fix issue in the GitLab provider Signed-off-by: Emmanuel Ferdman --- pr_agent/git_providers/gitlab_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index 0ee035f1..831052e4 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -49,7 +49,7 @@ class GitLabProvider(GitProvider): if auth_method == "oauth_token": self.gl = gitlab.Gitlab( url=gitlab_url, - oauth_token=gitlab_access_token + oauth_token=gitlab_access_token, ssl_verify=ssl_verify ) else: # private_token From 4fb22beb3a9b997477de4ced5eede1dc461b8de7 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 7 Aug 2025 08:01:31 +0300 Subject: [PATCH 13/24] docs: add GPT-5 performance metrics to index documentation --- docs/docs/pr_benchmark/index.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/docs/pr_benchmark/index.md b/docs/docs/pr_benchmark/index.md index 6d8cf33a..0c6ca6a9 100644 --- a/docs/docs/pr_benchmark/index.md +++ b/docs/docs/pr_benchmark/index.md @@ -34,6 +34,24 @@ A list of the models used for generating the baseline suggestions, and example r + + GPT-5 + 2025-08-07 + medium + 72.2 + + + GPT-5 + 2025-08-07 + low + 67.8 + + + GPT-5 + 2025-08-07 + minimal + 62.7 + o3 2025-04-16 From df9cb3f6358d1e60174630bdcc9326eab1c88bae Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 7 Aug 2025 08:25:17 +0300 Subject: [PATCH 14/24] docs: improve JSON formatting examples and clarify Docker build note --- docs/docs/installation/github.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/docs/installation/github.md b/docs/docs/installation/github.md index 928409b4..896696de 100644 --- a/docs/docs/installation/github.md +++ b/docs/docs/installation/github.md @@ -435,13 +435,16 @@ If you encounter rate limiting: ``` **Error: "Invalid JSON format"** + - **Solution**: Check that arrays are properly formatted as JSON strings: - ```yaml - # Correct + +```yaml + +Correct: config.fallback_models: '["model1", "model2"]' -# Incorrect (interpreted as a YAML list, not a string) +Incorrect (interpreted as a YAML list, not a string): config.fallback_models: ["model1", "model2"] - ``` +``` #### Debugging Tips @@ -611,9 +614,10 @@ For example: `GITHUB.WEBHOOK_SECRET` --> `GITHUB__WEBHOOK_SECRET` 2. Build a docker image that can be used as a lambda function ```shell - # Note: --target github_lambda is optional as it's the default target docker buildx build --platform=linux/amd64 . -t codiumai/pr-agent:github_lambda --target github_lambda -f docker/Dockerfile.lambda ``` + (Note: --target github_lambda is optional as it's the default target) + 3. Push image to ECR From fd7f8f25967e14c50233157c5454e0e0af40404f Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 7 Aug 2025 08:39:17 +0300 Subject: [PATCH 15/24] docs: enhance GitHub configuration documentation with clearer structure and examples --- docs/docs/installation/github.md | 66 ++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/docs/docs/installation/github.md b/docs/docs/installation/github.md index 896696de..ddfc0fd3 100644 --- a/docs/docs/installation/github.md +++ b/docs/docs/installation/github.md @@ -1,3 +1,5 @@ +In this page we will cover how to install and run PR-Agent as a GitHub Action or GitHub App, and how to configure it for your needs. + ## Run as a GitHub Action You can use our pre-built Github Action Docker image to run PR-Agent as a Github Action. @@ -51,13 +53,13 @@ When you open your next PR, you should see a comment from `github-actions` bot w See detailed usage instructions in the [USAGE GUIDE](https://qodo-merge-docs.qodo.ai/usage-guide/automations_and_usage/#github-action) -## Configuration Examples +### Configuration Examples This section provides detailed, step-by-step examples for configuring PR-Agent with different models and advanced options in GitHub Actions. -### Quick Start Examples +#### Quick Start Examples -#### Basic Setup (OpenAI Default) +##### Basic Setup (OpenAI Default) Copy this minimal workflow to get started with the default OpenAI models: @@ -83,7 +85,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -#### Gemini Setup +##### Gemini Setup Ready-to-use workflow for Gemini models: @@ -145,7 +147,7 @@ jobs: github_action_config.auto_improve: "true" ``` -### Basic Configuration with Tool Controls +#### Basic Configuration with Tool Controls Start with this enhanced workflow that includes tool configuration: @@ -178,9 +180,9 @@ jobs: github_action_config.pr_actions: '["opened", "reopened", "ready_for_review", "review_requested"]' ``` -### Switching Models +#### Switching Models -#### Using Gemini (Google AI Studio) +##### Using Gemini (Google AI Studio) To use Gemini models instead of the default OpenAI models: @@ -199,11 +201,12 @@ To use Gemini models instead of the default OpenAI models: ``` **Required Secrets:** + - Add `GEMINI_API_KEY` to your repository secrets (get it from [Google AI Studio](https://aistudio.google.com/)) **Note:** When using non-OpenAI models like Gemini, you don't need to set `OPENAI_KEY` - only the model-specific API key is required. -#### Using Claude (Anthropic) +##### Using Claude (Anthropic) To use Claude models: @@ -222,11 +225,12 @@ To use Claude models: ``` **Required Secrets:** + - Add `ANTHROPIC_KEY` to your repository secrets (get it from [Anthropic Console](https://console.anthropic.com/)) **Note:** When using non-OpenAI models like Claude, you don't need to set `OPENAI_KEY` - only the model-specific API key is required. -#### Using Azure OpenAI +##### Using Azure OpenAI To use Azure OpenAI services: @@ -249,11 +253,12 @@ To use Azure OpenAI services: ``` **Required Secrets:** + - `AZURE_OPENAI_KEY`: Your Azure OpenAI API key - `AZURE_OPENAI_ENDPOINT`: Your Azure OpenAI endpoint URL - `AZURE_OPENAI_DEPLOYMENT`: Your deployment name -#### Using Local Models (Ollama) +##### Using Local Models (Ollama) To use local models via Ollama: @@ -275,9 +280,9 @@ To use local models via Ollama: **Note:** For local models, you'll need to use a self-hosted runner with Ollama installed, as GitHub Actions hosted runners cannot access localhost services. -### Advanced Configuration Options +#### Advanced Configuration Options -#### Custom Review Instructions +##### Custom Review Instructions Add specific instructions for the review process: @@ -293,7 +298,7 @@ Add specific instructions for the review process: github_action_config.auto_improve: "true" ``` -#### Language-Specific Configuration +##### Language-Specific Configuration Configure for specific programming languages: @@ -311,7 +316,7 @@ Configure for specific programming languages: github_action_config.auto_improve: "true" ``` -#### Selective Tool Execution +##### Selective Tool Execution Run only specific tools automatically: @@ -327,7 +332,7 @@ Run only specific tools automatically: github_action_config.pr_actions: '["opened", "reopened"]' ``` -### Using Configuration Files +#### Using Configuration Files Instead of setting all options via environment variables, you can use a `.pr_agent.toml` file in your repository root: @@ -375,9 +380,9 @@ jobs: github_action_config.auto_improve: "true" ``` -### Troubleshooting Common Issues +#### Troubleshooting Common Issues -#### Model Not Found Errors +##### Model Not Found Errors If you get model not found errors: @@ -387,7 +392,7 @@ If you get model not found errors: 3. **Check model availability**: Some models may not be available in all regions or may require specific access -#### Environment Variable Format +##### Environment Variable Format Remember these key points about environment variables: @@ -396,7 +401,7 @@ Remember these key points about environment variables: - Arrays should be JSON strings: `'["item1", "item2"]'` - Model names are case-sensitive -#### Rate Limiting +##### Rate Limiting If you encounter rate limiting: @@ -413,7 +418,7 @@ If you encounter rate limiting: github_action_config.auto_improve: "true" ``` -#### Common Error Messages and Solutions +##### Common Error Messages and Solutions **Error: "Model not found"** - **Solution**: Check the model name format and ensure it matches the exact identifier. See the [Changing a model in PR-Agent](../usage-guide/changing_a_model.md) guide for supported models and their correct identifiers. @@ -446,14 +451,14 @@ Incorrect (interpreted as a YAML list, not a string): config.fallback_models: ["model1", "model2"] ``` -#### Debugging Tips +##### Debugging Tips 1. **Enable verbose logging**: Add `config.verbosity_level: "2"` to see detailed logs 2. **Check GitHub Actions logs**: Look at the step output for specific error messages 3. **Test with minimal configuration**: Start with just the basic setup and add options one by one 4. **Verify secrets**: Double-check that all required secrets are set in your repository settings -#### Performance Optimization +##### Performance Optimization For better performance with large repositories: @@ -471,9 +476,10 @@ For better performance with large repositories: github_action_config.auto_improve: "true" ``` -### Reference +#### Reference For more detailed configuration options, see: + - [Changing a model in PR-Agent](../usage-guide/changing_a_model.md) - [Configuration options](../usage-guide/configuration_options.md) - [Automations and usage](../usage-guide/automations_and_usage.md#github-action) @@ -605,7 +611,9 @@ cp pr_agent/settings/.secrets_template.toml pr_agent/settings/.secrets.toml > For more information please check out the [USAGE GUIDE](../usage-guide/automations_and_usage.md#github-app) --- -## Deploy as a Lambda Function +## Additional deployment methods + +### Deploy as a Lambda Function Note that since AWS Lambda env vars cannot have "." in the name, you can replace each "." in an env variable with "__".
For example: `GITHUB.WEBHOOK_SECRET` --> `GITHUB__WEBHOOK_SECRET` @@ -632,7 +640,7 @@ For example: `GITHUB.WEBHOOK_SECRET` --> `GITHUB__WEBHOOK_SECRET` 7. Go back to steps 8-9 of [Method 5](#run-as-a-github-app) with the function url as your Webhook URL. The Webhook URL would look like `https:///api/v1/github_webhooks` -### Using AWS Secrets Manager +#### Using AWS Secrets Manager For production Lambda deployments, use AWS Secrets Manager instead of environment variables: @@ -656,7 +664,7 @@ CONFIG__SECRET_PROVIDER=aws_secrets_manager --- -## AWS CodeCommit Setup +### AWS CodeCommit Setup Not all features have been added to CodeCommit yet. As of right now, CodeCommit has been implemented to run the Qodo Merge CLI on the command line, using AWS credentials stored in environment variables. (More features will be added in the future.) The following is a set of instructions to have Qodo Merge do a review of your CodeCommit pull request from the command line: @@ -673,7 +681,7 @@ Not all features have been added to CodeCommit yet. As of right now, CodeCommit --- -#### AWS CodeCommit IAM Role Example +##### AWS CodeCommit IAM Role Example Example IAM permissions to that user to allow access to CodeCommit: @@ -705,7 +713,7 @@ Example IAM permissions to that user to allow access to CodeCommit: } ``` -#### AWS CodeCommit Access Key and Secret +##### AWS CodeCommit Access Key and Secret Example setting the Access Key and Secret using environment variables @@ -715,7 +723,7 @@ export AWS_SECRET_ACCESS_KEY="XXXXXXXXXXXXXXXX" export AWS_DEFAULT_REGION="us-east-1" ``` -#### AWS CodeCommit CLI Example +##### AWS CodeCommit CLI Example After you set up AWS CodeCommit using the instructions above, here is an example CLI run that tells pr-agent to **review** a given pull request. (Replace your specific PYTHONPATH and PR URL in the example) From 406ef6a934945e361c47dd5e29c554a816fc44a0 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Thu, 7 Aug 2025 18:54:04 -0400 Subject: [PATCH 16/24] Update GitHub marketplace link --- docs/docs/installation/qodo_merge.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/installation/qodo_merge.md b/docs/docs/installation/qodo_merge.md index ebf1e68a..9f902877 100644 --- a/docs/docs/installation/qodo_merge.md +++ b/docs/docs/installation/qodo_merge.md @@ -33,7 +33,7 @@ To use Qodo Merge on your private GitHub Enterprise Server, you will need to [co ### GitHub Open Source Projects -For open-source projects, Qodo Merge is available for free usage. To install Qodo Merge for your open-source repositories, use the following marketplace [link](https://github.com/apps/qodo-merge-pro-for-open-source). +For open-source projects, Qodo Merge is available for free usage. To install Qodo Merge for your open-source repositories, use the following marketplace [link](https://github.com/marketplace/qodo-merge-pro-for-open-source). ## Install Qodo Merge for Bitbucket From 5162d847b378cdc7f6c1fb38a5b0df0b471a3d90 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 08:28:42 +0300 Subject: [PATCH 17/24] feat: add support for gpt-5 model and update configuration --- pr_agent/algo/__init__.py | 2 ++ .../algo/ai_handlers/litellm_ai_handler.py | 20 +++++++++++++++++++ pr_agent/settings/configuration.toml | 4 ++-- requirements.txt | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index 0de83548..db2da0eb 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -28,6 +28,8 @@ MAX_TOKENS = { 'gpt-4.1-mini-2025-04-14': 1047576, 'gpt-4.1-nano': 1047576, 'gpt-4.1-nano-2025-04-14': 1047576, + 'gpt-5': 200000, + 'gpt-5-2025-08-07': 200000, 'o1-mini': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-mini-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-preview': 128000, # 128K, but may be limited by config.max_model_tokens diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index ed77daf6..84911937 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -288,6 +288,21 @@ class LiteLLMAIHandler(BaseAiHandler): messages[1]["content"] = [{"type": "text", "text": messages[1]["content"]}, {"type": "image_url", "image_url": {"url": img_path}}] + thinking_kwargs_gpt5 = None + if model.startswith('gpt-5'): + if model.endswith('_thinking'): + thinking_kwargs_gpt5 = { + "reasoning_effort": 'low', + "allowed_openai_params": ["reasoning_effort"], + } + else: + thinking_kwargs_gpt5 = { + "reasoning_effort": 'minimal', + "allowed_openai_params": ["reasoning_effort"], + } + model = model.replace('_thinking', '') # remove _thinking suffix + + # Currently, some models do not support a separate system and user prompts if model in self.user_message_only_models or get_settings().config.custom_reasoning_model: user = f"{system}\n\n\n{user}" @@ -310,6 +325,11 @@ class LiteLLMAIHandler(BaseAiHandler): "api_base": self.api_base, } + if thinking_kwargs_gpt5: + kwargs.update(thinking_kwargs_gpt5) + if 'temperature' in kwargs: + del kwargs['temperature'] + # Add temperature only if model supports it if model not in self.no_support_temperature_models and not get_settings().config.custom_reasoning_model: # get_logger().info(f"Adding temperature with value {temperature} to model {model}.") diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index d1963f01..ab04f463 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -6,8 +6,8 @@ [config] # models -model="o4-mini" -fallback_models=["gpt-4.1"] +model="gpt-5-2025-08-07" +fallback_models=["o4-mini"] #model_reasoning="o4-mini" # dedicated reasoning model for self-reflection #model_weak="gpt-4o" # optional, a weaker model to use for some easier tasks # CLI diff --git a/requirements.txt b/requirements.txt index 18f6e383..6e3f6f60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ google-cloud-aiplatform==1.38.0 google-generativeai==0.8.3 google-cloud-storage==2.10.0 Jinja2==3.1.2 -litellm==1.70.4 +litellm==1.75.2 loguru==0.7.2 msrest==0.7.1 openai>=1.55.3 From 1c25420fb31299a3e195670e7fd8e44fba7b02f5 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 08:32:28 +0300 Subject: [PATCH 18/24] docs: update references to GPT-5 in documentation --- README.md | 2 +- docs/docs/chrome-extension/index.md | 2 +- docs/docs/faq/index.md | 2 +- docs/docs/overview/pr_agent_pro.md | 2 +- docs/docs/usage-guide/changing_a_model.md | 2 +- docs/docs/usage-guide/qodo_merge_models.md | 11 +++++------ 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 450d91df..82cb3ada 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ ___ ## Try It Now -Try the Claude Sonnet powered PR-Agent instantly on _your public GitHub repository_. Just mention `@CodiumAI-Agent` and add the desired command in any PR comment. The agent will generate a response based on your command. +Try the GPT-5 powered PR-Agent instantly on _your public GitHub repository_. Just mention `@CodiumAI-Agent` and add the desired command in any PR comment. The agent will generate a response based on your command. For example, add a comment to any pull request with the following text: ``` diff --git a/docs/docs/chrome-extension/index.md b/docs/docs/chrome-extension/index.md index a6bdd60a..c55e803f 100644 --- a/docs/docs/chrome-extension/index.md +++ b/docs/docs/chrome-extension/index.md @@ -2,7 +2,7 @@ With a single-click installation you will gain access to a context-aware chat on your pull requests code, a toolbar extension with multiple AI feedbacks, Qodo Merge filters, and additional abilities. -The extension is powered by top code models like Claude 3.7 Sonnet and o4-mini. All the extension's features are free to use on public repositories. +The extension is powered by top code models like GPT-5. All the extension's features are free to use on public repositories. For private repositories, you will need to install [Qodo Merge](https://github.com/apps/qodo-merge-pro){:target="_blank"} in addition to the extension. For a demonstration of how to install Qodo Merge and use it with the Chrome extension, please refer to the tutorial video at the provided [link](https://codium.ai/images/pr_agent/private_repos.mp4){:target="_blank"}. diff --git a/docs/docs/faq/index.md b/docs/docs/faq/index.md index 3acb1e68..ce47d9a9 100644 --- a/docs/docs/faq/index.md +++ b/docs/docs/faq/index.md @@ -26,7 +26,7 @@ ___ #### Answer:2 - - Modern AI models, like Claude Sonnet and GPT-4, are improving rapidly but remain imperfect. Users should critically evaluate all suggestions rather than accepting them automatically. + - Modern AI models, like Claude Sonnet and GPT-5, are improving rapidly but remain imperfect. Users should critically evaluate all suggestions rather than accepting them automatically. - AI errors are rare, but possible. A main value from reviewing the code suggestions lies in their high probability of catching **mistakes or bugs made by the PR author**. We believe it's worth spending 30-60 seconds reviewing suggestions, even if some aren't relevant, as this practice can enhance code quality and prevent bugs in production. diff --git a/docs/docs/overview/pr_agent_pro.md b/docs/docs/overview/pr_agent_pro.md index 0d35d971..3b6968d5 100644 --- a/docs/docs/overview/pr_agent_pro.md +++ b/docs/docs/overview/pr_agent_pro.md @@ -24,7 +24,7 @@ Here are some of the additional features and capabilities that Qodo Merge offers | Feature | Description | | -------------------------------------------------------------------------------------------------------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------| -| [**Model selection**](https://qodo-merge-docs.qodo.ai/usage-guide/PR_agent_pro_models/) | Choose the model that best fits your needs, among top models like `Claude Sonnet`, `o4-mini` | +| [**Model selection**](https://qodo-merge-docs.qodo.ai/usage-guide/PR_agent_pro_models/) | Choose the model that best fits your needs | | [**Global and wiki configuration**](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/) | Control configurations for many repositories from a single location;
Edit configuration of a single repo without committing code | | [**Apply suggestions**](https://qodo-merge-docs.qodo.ai/tools/improve/#overview) | Generate committable code from the relevant suggestions interactively by clicking on a checkbox | | [**Suggestions impact**](https://qodo-merge-docs.qodo.ai/tools/improve/#assessing-impact) | Automatically mark suggestions that were implemented by the user (either directly in GitHub, or indirectly in the IDE) to enable tracking of the impact of the suggestions | diff --git a/docs/docs/usage-guide/changing_a_model.md b/docs/docs/usage-guide/changing_a_model.md index fe369410..f5d9b333 100644 --- a/docs/docs/usage-guide/changing_a_model.md +++ b/docs/docs/usage-guide/changing_a_model.md @@ -107,7 +107,7 @@ Please note that the `custom_model_max_tokens` setting should be configured in a !!! note "Local models vs commercial models" Qodo Merge is compatible with almost any AI model, but analyzing complex code repositories and pull requests requires a model specifically optimized for code analysis. - Commercial models such as GPT-4, Claude Sonnet, and Gemini have demonstrated robust capabilities in generating structured output for code analysis tasks with large input. In contrast, most open-source models currently available (as of January 2025) face challenges with these complex tasks. + Commercial models such as GPT-5, Claude Sonnet, and Gemini have demonstrated robust capabilities in generating structured output for code analysis tasks with large input. In contrast, most open-source models currently available (as of January 2025) face challenges with these complex tasks. Based on our testing, local open-source models are suitable for experimentation and learning purposes (mainly for the `ask` command), but they are not suitable for production-level code analysis tasks. diff --git a/docs/docs/usage-guide/qodo_merge_models.md b/docs/docs/usage-guide/qodo_merge_models.md index be37fde3..56cac82b 100644 --- a/docs/docs/usage-guide/qodo_merge_models.md +++ b/docs/docs/usage-guide/qodo_merge_models.md @@ -1,5 +1,5 @@ -The default models used by Qodo Merge (June 2025) are a combination of Claude Sonnet 4 and Gemini 2.5 Pro. +The default models used by Qodo Merge (June 2025) are a combination of GPT-5 and Gemini 2.5 Pro. ### Selecting a Specific Model @@ -19,11 +19,11 @@ To restrict Qodo Merge to using only `o4-mini`, add this setting: model="o4-mini" ``` -To restrict Qodo Merge to using only `GPT-4.1`, add this setting: +To restrict Qodo Merge to using only `GPT-5`, add this setting: ```toml [config] -model="gpt-4.1" +model="gpt-5" ``` To restrict Qodo Merge to using only `gemini-2.5-pro`, add this setting: @@ -33,10 +33,9 @@ To restrict Qodo Merge to using only `gemini-2.5-pro`, add this setting: model="gemini-2.5-pro" ``` - -To restrict Qodo Merge to using only `deepseek-r1` us-hosted, add this setting: +To restrict Qodo Merge to using only `claude-4-sonnet`, add this setting: ```toml [config] -model="deepseek/r1" +model="claude-4-sonnet" ``` From de5c1adaa0d135e1926b5e7aee90003124288231 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 08:37:28 +0300 Subject: [PATCH 19/24] fix: update temperature handling for GPT-5 and upgrade aiohttp version --- pr_agent/algo/ai_handlers/litellm_ai_handler.py | 10 +++++----- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index 84911937..78d12ffe 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -325,16 +325,16 @@ class LiteLLMAIHandler(BaseAiHandler): "api_base": self.api_base, } - if thinking_kwargs_gpt5: - kwargs.update(thinking_kwargs_gpt5) - if 'temperature' in kwargs: - del kwargs['temperature'] - # Add temperature only if model supports it if model not in self.no_support_temperature_models and not get_settings().config.custom_reasoning_model: # get_logger().info(f"Adding temperature with value {temperature} to model {model}.") kwargs["temperature"] = temperature + if thinking_kwargs_gpt5: + kwargs.update(thinking_kwargs_gpt5) + if 'temperature' in kwargs: + del kwargs['temperature'] + # Add reasoning_effort if model supports it if (model in self.support_reasoning_models): supported_reasoning_efforts = [ReasoningEffort.HIGH.value, ReasoningEffort.MEDIUM.value, ReasoningEffort.LOW.value] diff --git a/requirements.txt b/requirements.txt index 6e3f6f60..28633c7d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.9.5 +aiohttp==3.10.2 anthropic>=0.52.0 #anthropic[vertex]==0.47.1 atlassian-python-api==3.41.4 From c927d20b5e7d907feb81d7f122e7ad0cd4c3e06a Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 08:53:34 +0300 Subject: [PATCH 20/24] fix: update litellm dependency to include proxy support and clean up requirements --- requirements.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 28633c7d..9c138ad9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,16 @@ -aiohttp==3.10.2 anthropic>=0.52.0 #anthropic[vertex]==0.47.1 atlassian-python-api==3.41.4 azure-devops==7.1.0b3 azure-identity==1.15.0 -boto3==1.33.6 certifi==2024.8.30 dynaconf==3.2.4 -fastapi==0.111.0 GitPython==3.1.41 google-cloud-aiplatform==1.38.0 google-generativeai==0.8.3 google-cloud-storage==2.10.0 Jinja2==3.1.2 -litellm==1.75.2 +litellm[proxy]==1.75.2 loguru==0.7.2 msrest==0.7.1 openai>=1.55.3 @@ -25,9 +22,7 @@ retry==0.9.2 starlette-context==0.3.6 tiktoken==0.8.0 ujson==5.8.0 -uvicorn==0.22.0 tenacity==8.2.3 -gunicorn==22.0.0 pytest-cov==5.0.0 pydantic==2.8.2 html2text==2024.2.26 From 9a2ba2d88194134e96d734ecd2d3fdc1a59939a2 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 09:02:54 +0300 Subject: [PATCH 21/24] fix: handle empty changes summary in file label dict based on configuration --- pr_agent/tools/pr_description.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 5abea388..a6387a92 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -641,7 +641,7 @@ class PRDescription: continue filename = file['filename'].replace("'", "`").replace('"', '`') changes_summary = file.get('changes_summary', "") - if not changes_summary: + if not changes_summary and self.vars.get('include_file_summary_changes', True): get_logger().warning(f"Empty changes summary in file label dict, skipping file", artifact={"file": file}) continue From f3287a9f673c6962b5b28627b8ae80d702a8be3e Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 09:34:31 +0300 Subject: [PATCH 22/24] fix: update model prefix in litellm_ai_handler and adjust dependencies in requirements.txt --- pr_agent/algo/ai_handlers/litellm_ai_handler.py | 2 +- requirements.txt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index 78d12ffe..31e3d12b 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -300,7 +300,7 @@ class LiteLLMAIHandler(BaseAiHandler): "reasoning_effort": 'minimal', "allowed_openai_params": ["reasoning_effort"], } - model = model.replace('_thinking', '') # remove _thinking suffix + model = 'openai/'+model.replace('_thinking', '') # remove _thinking suffix # Currently, some models do not support a separate system and user prompts diff --git a/requirements.txt b/requirements.txt index 9c138ad9..ec9f3451 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,19 @@ +aiohttp==3.10.2 anthropic>=0.52.0 #anthropic[vertex]==0.47.1 atlassian-python-api==3.41.4 azure-devops==7.1.0b3 azure-identity==1.15.0 +boto3==1.33.6 certifi==2024.8.30 dynaconf==3.2.4 +fastapi==0.115.6 GitPython==3.1.41 google-cloud-aiplatform==1.38.0 google-generativeai==0.8.3 google-cloud-storage==2.10.0 Jinja2==3.1.2 -litellm[proxy]==1.75.2 +litellm==1.73.6 loguru==0.7.2 msrest==0.7.1 openai>=1.55.3 @@ -22,7 +25,9 @@ retry==0.9.2 starlette-context==0.3.6 tiktoken==0.8.0 ujson==5.8.0 +uvicorn==0.22.0 tenacity==8.2.3 +gunicorn==23.0.0 pytest-cov==5.0.0 pydantic==2.8.2 html2text==2024.2.26 From bb115432f27acab6c905534b3e132412363b4c38 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 8 Aug 2025 09:39:24 +0300 Subject: [PATCH 23/24] feat: add support for new GPT-5 models and update documentation --- README.md | 4 ++++ pr_agent/algo/__init__.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 82cb3ada..35183d6a 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,10 @@ You can receive automatic feedback from Qodo Merge on your local IDE after each ## News and Updates +## Aug 8, 2025 + +Added full support for GPT-5 models. View the [benchmark results](https://qodo-merge-docs.qodo.ai/pr_benchmark/#pr-benchmark-results) for details on the performance of GPT-5 models in PR-Agent. + ## Jul 1, 2025 You can now receive automatic feedback from Qodo Merge in your local IDE after each commit. Read more about it [here](https://github.com/qodo-ai/agents/tree/main/agents/qodo-merge-post-commit). diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index db2da0eb..4e82521c 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -28,6 +28,8 @@ MAX_TOKENS = { 'gpt-4.1-mini-2025-04-14': 1047576, 'gpt-4.1-nano': 1047576, 'gpt-4.1-nano-2025-04-14': 1047576, + 'gpt-5-nano': 200000, # 200K, but may be limited by config.max_model_tokens + 'gpt-5-mini': 200000, # 200K, but may be limited by config.max_model_tokens 'gpt-5': 200000, 'gpt-5-2025-08-07': 200000, 'o1-mini': 128000, # 128K, but may be limited by config.max_model_tokens From a60b91e85d796a60d6225982e8783ef6524ae39f Mon Sep 17 00:00:00 2001 From: CxyFreedom Date: Fri, 8 Aug 2025 19:55:18 +0800 Subject: [PATCH 24/24] docs: fix typo in OpenAI model parameter name to search - Fix spelling error: `reasoning_efffort` -> `reasoning_effort` --- docs/docs/usage-guide/changing_a_model.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/usage-guide/changing_a_model.md b/docs/docs/usage-guide/changing_a_model.md index f5d9b333..e6926a99 100644 --- a/docs/docs/usage-guide/changing_a_model.md +++ b/docs/docs/usage-guide/changing_a_model.md @@ -379,7 +379,7 @@ To bypass chat templates and temperature controls, set `config.custom_reasoning_ ```toml [config] -reasoning_efffort = "medium" # "low", "medium", "high" +reasoning_effort = "medium" # "low", "medium", "high" ``` With the OpenAI models that support reasoning effort (eg: o4-mini), you can specify its reasoning effort via `config` section. The default value is `medium`. You can change it to `high` or `low` based on your usage.