Skip to main content

What Harness creates during onboarding

Last updated on

Turning on AI Code Review creates real, named resources in your Harness account. This page lists every one of them so an administrator can account for what appeared, and so a security reviewer can see exactly what the agent is allowed to do.

Onboarding is idempotent. Resources that already exist are reused rather than duplicated.


Account-level identity

The first onboarding in an account creates a dedicated identity for the review agent. The agent never runs as the person who opened the pull request.

ResourceIdentifierName
Service accountaicr_service_accountAI Code Review
Custom roleaicr_agent_roleAI Code Review Agent
API keyaicr_api_keyAI Code Review API Key
Tokenaicr_tokenAI Code Review Token
Secretaicr_token_secretAI Code Review Token

The service account email is aicr_service_account@service.harness.io.

The token is created with a validity of 15 years and stored as an inline secret in the Harness built-in secret manager. The pipeline reads it as the HARNESS_TOKEN stage variable.

The token is long lived

A 15 year token is not rotated automatically. Treat aicr_token_secret as a standing credential in your account and include it in whatever credential review process you already run.


Agent permissions

aicr_agent_role grants exactly four permissions:

PermissionWhat it allows
code_repo_viewRead AI Code Review settings, list and read status checks, and clone the repository.
code_repo_reviewAdd pull request comments, assign labels, and add pull request reviewers.
code_repo_reportCommitCheckReport and update status checks.
core_user_viewResolve users, such as reviewers and authors.

code_repo_push is deliberately excluded. The agent cannot write to your branches.

The role is bound to the service account through a resource group matching the onboarding scope:

Onboarding scopeResource group
Project_all_project_level_resources
Organization_all_organization_level_resources
Account_all_account_level_resources

A second, account-level binding grants the service account the built-in _llm_gateway_user role against _all_resources_including_child_scopes, which is what lets the agent call a model.


The review pipeline

One pipeline is created per target project.

PropertyValue
Identifieraicr
NameAI Code Review
Stage typeCI
InfrastructureHarness Cloud, Linux, Amd64
Clone codebaseEnabled
CachingDisabled
Build intelligenceDisabled
StepOne step of type Agent, named AI Code Review Agent, running agent aiCodeReviewAgent

The stage declares the permissions the agent step needs:

permissions:
code_repository: view|push|review
user: view
ai_llm_gateway: access

The repository name and build are runtime inputs supplied by the trigger, so the same pipeline serves every repository in the project.

The pipeline is created inline

The pipeline is stored in Harness, not in your repository. The pipeline record carries a config path of .harness/aicr.yaml, but nothing reads or writes that file. Do not treat it as a configuration-as-code hook.


The pull request trigger

One trigger is created per repository, per target project.

PropertyValue
Identifier and nameaicr_pr_trigger_<repository>
Source typeWebhook, Harness
EventPull request
ActionsCreate, Update, Reopen
Auto abort previous executionsEnabled
Payload and header conditionsNone

The identifier is derived from the repository name. Characters outside 0-9, a-z, A-Z, _, and $ are replaced with an underscore, and the result is truncated to 64 characters.

Because the trigger has no payload or header conditions, every pull request in the repository is reviewed. There is no branch or author filtering.

Re-running onboarding updates an existing trigger rather than failing, so a connector change is picked up on the next onboard call.


Per-repository records

For each onboarded repository, Harness also creates:

  • A pipeline record scoped to the repository, identifier aicr, config path .harness/aicr.yaml.
  • An AI Code Review setting anchored to the repository path, with empty criteria and an empty MCP server map. This setting is the installation record. Without it, the repository does not appear in pull request listings.
  • The repository-level AI pull request review flag, set to enabled.

For GitHub repositories, a linked Harness Code repository is created and its connector reference is stored alongside the provider path.


What offboarding removes

Offboarding a repository removes two things:

  • The pull request trigger for that repository.
  • The repository-level AI pull request review flag, which is set back to disabled.

Everything else is left in place:

  • The aicr pipeline in each project.
  • The service account, role, and both role bindings.
  • The API key, token, and secret.
  • The repository pipeline record.
  • The AI Code Review setting for the repository, including its criteria.
  • The linked repository and its connector metadata, for GitHub repositories.
Offboarding does not fan out

Onboarding at an organization or account scope creates triggers across every project. Offboarding removes the trigger only in the project derived from the repository path. If you onboarded broadly, remove the remaining triggers yourself.