BLOG-79 AI review bot #83

Merged
squid merged 1 commits from BLOG-79_ai_review_bot into main 2025-07-26 07:01:51 +08:00
Owner

Description

  • Use Qudo Merge as self-hosted PR agent
  • Add a workflow that auto comment /improve command to start the agent

Pod Configuration

    - name: pr-agent
      image: registry.squidspirit.com/squid/pr-agent:gitea_app
      env:
        - name: CONFIG__GIT_PROVIDER
          value: gitea
        - name: GITEA__PERSONAL_ACCESS_TOKEN
          valueFrom:
            secretKeyRef:
              name: gitea-secret
              key: PR_AGENT_PAT
        - name: GITEA__WEBHOOK_SECRET
          valueFrom:
            secretKeyRef:
              name: gitea-secret
              key: PR_AGENT_SECRET
        - name: GITEA__URL
          value: https://git.squidspirit.com
        - name: GOOGLE_AI_STUDIO__GEMINI_API_KEY
          valueFrom:
            secretKeyRef:
              name: gitea-secret
              key: PR_AGENT_GEMINI_KEY
        - name: CONFIG__MODEL
          value: gemini/gemini-2.5-flash
        - name: CONFIG__FALLBACK_MODELS
          value: '["gemini/gemini-2.5-flash"]'

Package Changes

No response

Screenshots

No response

Reference

Resolves #79

Checklist

  • A milestone is set
  • The related issuse has been linked to this branch
### Description - Use Qudo Merge as self-hosted PR agent - Add a workflow that auto comment /improve command to start the agent #### Pod Configuration ```yaml - name: pr-agent image: registry.squidspirit.com/squid/pr-agent:gitea_app env: - name: CONFIG__GIT_PROVIDER value: gitea - name: GITEA__PERSONAL_ACCESS_TOKEN valueFrom: secretKeyRef: name: gitea-secret key: PR_AGENT_PAT - name: GITEA__WEBHOOK_SECRET valueFrom: secretKeyRef: name: gitea-secret key: PR_AGENT_SECRET - name: GITEA__URL value: https://git.squidspirit.com - name: GOOGLE_AI_STUDIO__GEMINI_API_KEY valueFrom: secretKeyRef: name: gitea-secret key: PR_AGENT_GEMINI_KEY - name: CONFIG__MODEL value: gemini/gemini-2.5-flash - name: CONFIG__FALLBACK_MODELS value: '["gemini/gemini-2.5-flash"]' ``` ### Package Changes _No response_ ### Screenshots _No response_ ### Reference Resolves #79 ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch
squid added this to the 0.3 milestone 2025-07-26 06:59:35 +08:00
squid added 1 commit 2025-07-26 06:59:35 +08:00
BLOG-79 build: auto comment /improve command
All checks were successful
Auto Comment On PR / add_improve_comment (pull_request) Successful in 13s
Frontend CI / build (push) Successful in 1m8s
PR Title Check / pr-title-check (pull_request) Successful in 16s
1849458b71
Collaborator

/improve

/improve
Collaborator

PR Code Suggestions

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix incorrect PR number in API call

The gitea.ref_name variable provides the full Git reference (e.g.,
refs/pull/123/head), which is not the correct pull request number for the Gitea API.
To correctly target the pull request for adding a comment, you should use
gitea.event.pull_request.number. This will ensure the API call is made to the
correct issue index.

.gitea/workflows/pr_agent.yaml [20]

-"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.ref_name }}/comments"
+"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments"
Suggestion importance[1-10]: 10

__

Why: The suggestion correctly identifies a critical bug where gitea.ref_name is used instead of gitea.event.pull_request.number to identify the pull request number for the Gitea API. This fix is essential for the workflow to correctly add comments to the intended pull request.

High
## PR Code Suggestions ✨ <!-- --> <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Fix incorrect PR number in API call</summary> ___ **The <code>gitea.ref_name</code> variable provides the full Git reference (e.g., <br><code>refs/pull/123/head</code>), which is not the correct pull request number for the Gitea API. <br>To correctly target the pull request for adding a comment, you should use <br><code>gitea.event.pull_request.number</code>. This will ensure the API call is made to the <br>correct issue index.** [.gitea/workflows/pr_agent.yaml [20]](https://git.squidspirit.com/squid/blog/src/branch/BLOG-79_ai_review_bot/.gitea/workflows/pr_agent.yaml#L20-L20) ```diff -"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.ref_name }}/comments" +"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments" ``` <details><summary>Suggestion importance[1-10]: 10</summary> __ Why: The suggestion correctly identifies a critical bug where `gitea.ref_name` is used instead of `gitea.event.pull_request.number` to identify the pull request number for the Gitea API. This fix is essential for the workflow to correctly add comments to the intended pull request. </details></details></td><td align=center>High </td></tr></tr></tbody></table>
squid changed title from BLOG-79 build: auto comment `/improve` command to BLOG-79 AI review bot 2025-07-26 07:00:48 +08:00
Author
Owner

PR Code Suggestions

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix incorrect PR number in API call

The gitea.ref_name variable provides the full Git reference (e.g.,
refs/pull/123/head), which is not the correct pull request number for the Gitea API.
To correctly target the pull request for adding a comment, you should use
gitea.event.pull_request.number. This will ensure the API call is made to the
correct issue index.

.gitea/workflows/pr_agent.yaml [20]

-"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.ref_name }}/comments"
+"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments"
Suggestion importance[1-10]: 10

__

Why: The suggestion correctly identifies a critical bug where gitea.ref_name is used instead of gitea.event.pull_request.number to identify the pull request number for the Gitea API. This fix is essential for the workflow to correctly add comments to the intended pull request.

High

gitea.ref_name is the correct.

> ## PR Code Suggestions ✨ > > <!-- --> > > <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> > <td> > > > > <details><summary>Fix incorrect PR number in API call</summary> > > ___ > > > **The <code>gitea.ref_name</code> variable provides the full Git reference (e.g., <br><code>refs/pull/123/head</code>), which is not the correct pull request number for the Gitea API. <br>To correctly target the pull request for adding a comment, you should use <br><code>gitea.event.pull_request.number</code>. This will ensure the API call is made to the <br>correct issue index.** > > [.gitea/workflows/pr_agent.yaml [20]](https://git.squidspirit.com/squid/blog/src/branch/BLOG-79_ai_review_bot/.gitea/workflows/pr_agent.yaml#L20-L20) > > ```diff > -"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.ref_name }}/comments" > +"${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments" > ``` > <details><summary>Suggestion importance[1-10]: 10</summary> > > __ > > Why: The suggestion correctly identifies a critical bug where `gitea.ref_name` is used instead of `gitea.event.pull_request.number` to identify the pull request number for the Gitea API. This fix is essential for the workflow to correctly add comments to the intended pull request. > > > </details></details></td><td align=center>High > > </td></tr></tr></tbody></table> > > `gitea.ref_name` is the correct.
squid merged commit f400bcf486 into main 2025-07-26 07:01:51 +08:00
squid deleted branch BLOG-79_ai_review_bot 2025-07-26 07:01:51 +08:00
squid referenced this issue from a commit 2025-07-26 07:01:52 +08:00
Sign in to join this conversation.
No description provided.