AI PR review setup question #2853
pim opened 3 weeks ago

A while back we had no workspaces in onedev. We had an AI user that reviewed PR's for us. After updating onedev, this user wants/needs to spin up a workspace. I set up an OpenCode workspace (from the template). It now reviews but it also commits on my PR's and then merges them automatically... The user has code reader and issue reporter roles on the project:

image.png

I also have a test project. The AI user has NO roles or authorizations for this project but it still managed to commit on a PR and merged it instantly after.

The workspace config:

image_2.png

System prompt for AI (that does get send to workspace):

You are an expert Senior Software Engineer reviewing a Pull Request. Your primary goal is to ensure code quality, performance, and security.
If you already approved the PR and there are no changes or new comments, stop trying to respond.

### INSTRUCTIONS:
1. FOCUS on logic flaws, security vulnerabilities, performance bottlenecks, and architectural issues.
2. IGNORE minor naming conventions, and auto-generated files (e.g., package-lock.json).
3. BE CONCISE. Do not summarize the PR unless explaining a broader architectural flaw. 
4. BE ACTIONABLE. If you identify an issue, provide a brief explanation of the problem and a specific code suggestion to fix it.
5. TONE: Professional, objective, and constructive.

### OUTPUT FORMAT:
If there are issues, format your response strictly using Markdown with the following sections:
- **Critical Issues:** (Bugs, security risks, crashes)
- **Suggestions:** (Performance improvements, refactoring)
- **Questions:** (Ambiguous logic that needs clarification)

Always include line numbers from the source when showing code.

If there are no issues that require changing, reply ONLY with: "LGTM: No critical issues found." and approve the pull request

My question

I want PR reviews, with code comments if possible. I want no commits or PR state changes by AI. Can you explain what I did wrong and how I can set up permissions to achieve this?

  • Robin Shen commented 3 weeks ago

    How did you request the AI user to review?

  • pim commented 3 weeks ago

    How did you request the AI user to review?

    The AI user is put on the PR's by a branch protection rule.

  • Robin Shen commented 3 weeks ago

    Just tested with 16.0.7 and it works fine at my side. Using same model and system prompt. Please upgrade to this version to see if solves the problem.

  • Robin Shen commented 3 weeks ago

    Also make sure to pull 1dev/opencode to get latest image

  • pim commented 3 weeks ago

    I have updated onedev to version 16.0.8.

    The workspace image gets pulled automatically on each run. With the latest image however there is a version mismatch:

    pencode@c43f07553cf0:/onedev-workspace/work$ tod check-version && ( opencode run "$TASK_PROMPT" )
    this tod requires OneDev server version >= 16.1.0 (current: 16.0.8), please upgrade your OneDev server
    

    Should I set it to pull 1dev/opencode:1.0.0 instead? (That tag is 3 months old)

    EDIT: I just saw this pages version number increment so I guess I should just wait for the new release...

  • Robin Shen commented 3 weeks ago

    @pim 16.1.0 is available now.

  • Robin Shen commented 1 week ago

    Reopen if there is more info

  • Robin Shen changed state to 'Closed' 1 week ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2853
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover