artistic title image
Home | All News Posts

Your Tireless Reviewer in the Helmholtz Codebase

Allow us to introduce the extra pair of eyes that never gets tired of reviewing merge requests: the Helmholtz Codebase AI Assistant.

Based on the open-source PR-Agent, the assistant can spot issues and suggest code improvements, evaluate the effort to review and describe your MRs. It runs on HZDR infrastructure, with both the assistant and its language models operating locally.

The integration is currently in alpha testing, but you can already try it in your own projects. Follow the setup instructions to enable it in your project.

What can it do?

Once configured, the assistant automatically reviews new merge requests and suggests improvements. You can also interact with it directly by posting commands in the MR discussion:

  • /review — Get an overview of potential issues and areas worth reviewing.
  • /improve — Receive suggestions for improving the code.
  • /describe — Generate a description of the changes.
  • /ask "your question" — Ask a specific question about the merge request.

A few first tricks

Working with limited permissions

In the project building this HIFIS.net page, we deliberately gave the assistant only Reporter permissions. These restricted access rights let it provide feedback without allowing it to push changes to the repository.

This comes with the caveat that the assistant cannot directly update the merge request description with these permissions. Fortunately, you can ask it to publish the generated description as a comment instead:

1
/describe --pr_description.publish_description_as_comment=true --pr_description.publish_description_as_comment_persistent=true

The right use of resources

AI-assisted reviews consume computing resources. For routine reviews, we recommend starting with a relatively conservative configuration. You can customize the assistant through a .pr_agent.toml file in the root of your repository.

By default we provide a conservative configuration:

1
2
3
[pr_code_suggestions]
suggestions_score_threshold = 7
focus_only_on_problems = true

This prioritizes potentially important problems and filters out lower-scoring suggestions.

When you’d like a more thorough review, you can override these settings for a specific MR:

1
/improve --pr_code_suggestions.suggestions_score_threshold=3 --pr_code_suggestions.focus_only_on_problems=false

Want suggestions you can apply directly?

Enable committable_code_suggestions. And when combined with publish_code_suggestions_as_review, the assistant will bundle these in a single review, avoiding flooding the discussion with notifications.

1
/improve --pr_code_suggestions.committable_code_suggestions=true --gitlab.publish_code_suggestions_as_review=true

Tailoring the assistant to your project

One particularly useful feature is the ability to give the assistant project-specific instructions. For example, on HIFIS.net, we want it to help authors choose appropriate tags for their blog posts from our existing list, rather than inventing new ones.

We can add instructions for /improve to our repository’s .pr_agent.toml:

1
2
3
4
5
6
[pr_code_suggestions]
extra_instructions = """
When reviewing a blog post, check its front matter tags.
Suggest relevant tags from the existing list of HIFIS.net tags.
Do not invent new tags, and avoid unnecessary suggestions.
"""

This is just one example of how the assistant can go beyond generic code reviews and help enforce project conventions.

Give it a try!

The assistant won’t replace human reviewers, but it can be a useful extra pair of eyes — especially when used thoughtfully.

Check out the documentation to get started, and join the Helmholtz Codebase Agent Matrix channel to share your experiences and feedback.