Skip to main content

Define your first review criteria

Last updated on

Onboarding creates an empty setting for a repository. Until you add a criterion, reviews run and produce nothing. This page covers creating your first two criteria and confirming they reach a pull request.


Before you begin


Choose the scope first

Where you define a criterion matters more than what it says, because criteria are combined down the hierarchy and never replaced.

Define a criterion at a space when every repository beneath it should be held to the same standard. Define it on a repository when it only makes sense for that codebase. A criterion added at organization level lands on every pull request in the organization on the next push, so treat it as a production change.


Create a criterion

  1. In Harness, navigate to the space or repository that should own the criterion.
  2. Select AI Code Review, then select Settings.
  3. Select Add criterion.
  4. Enter a Title. This names the criterion and forms the identifier of the status check it produces.
  5. Enter a Description. This is the instruction the agent evaluates against.
  6. Select Enabled. A criterion that is not enabled does not run.
  7. Click Save.
Saving replaces the whole criteria set

An update replaces every criterion in that scope rather than patching one. If you are editing through the UI while someone else is, the last save wins and their criteria are gone.


Write a description the agent can act on

A criterion description is an instruction, not a topic. The difference shows up immediately in the findings.

DescriptionWhat you get
Check error handling.Generic observations on most pull requests, which reviewers learn to ignore.
Flag any new function under src/handlers/ that calls an external service without a timeout, and name the call site.A specific finding a reviewer can act on or dismiss in seconds.

Three things make the difference:

  • Name the failure, not the subject. Say what is wrong, not what area to look at.
  • Bound the scope. Naming a path or a file type stops the criterion firing on unrelated changes.
  • Ask for the location. A finding that names the call site is checked in seconds; one that does not is checked in minutes.

Verify the criterion runs

A criterion that saves cleanly can still fail to run, so confirm it reaches a pull request before you write any more.

  1. Push a commit to an open pull request in the repository, or open a new one.
  2. Confirm the aicr pipeline execution starts.
  3. On the pull request, confirm a status check appears named aicr_<your-criterion-title>_<id>.
  4. Read the summary on the check. If it is generic, the description is too broad rather than the agent being wrong.

Start with two criteria and let them run for a week before adding more. Every criterion adds a check to every pull request, and a reviewer facing twenty checks reads none of them.


Troubleshooting

A new Harness AI Code Review criterion does not produce a status check on a pull request

Confirm the criterion is enabled. The enabled field defaults to false when it is omitted from an update, so a criterion saved through the API without it is created disabled.

Review criteria disappeared after updating Harness AI Code Review settings

An update replaces the entire criteria set for that scope. Criteria present on the setting but absent from the update payload are deleted. Read the setting, modify it, and write the whole object back.

The same Harness AI Code Review criterion appears twice on a pull request

Criteria are combined across scopes and are not deduplicated. A criterion with the same title defined at both project and repository level runs twice and produces two checks. Remove it from one scope.


Next steps