For OpenHands Cloud, see GitLab Integration.
This page covers the OAuth application and resolver configuration for OpenHands Enterprise.
Overview
A self-hosted installation needs its own GitLab OAuth application so GitLab can send events to your domain. Setup has three parts:- Create a GitLab Application for the installation.
- Enable GitLab in the OpenHands Enterprise configuration and deploy.
- Have each user sign in to OpenHands with GitLab before they invoke
@openhands.
Prerequisites
Before you start, confirm:- OpenHands Enterprise is reachable at
https://app.<your-base-domain>. - The authentication service is reachable at
https://auth.<your-base-domain>when using the default Simple hostname mode. - Both hostnames use publicly trusted TLS certificates.
- You can create a GitLab Application under a GitLab Group or user account.
- Users who will trigger OpenHands have access to the GitLab projects they want to use.
- Network access from OpenHands to GitLab for API calls, and from GitLab back to the OpenHands app URL for webhook delivery.
- If you are using self-managed GitLab with an internal or self-signed certificate, upload the issuing CA in the OpenHands Enterprise Admin Console under Additional Trusted CA Certificates before deploying.
Step 1: Create a GitLab Application
Create an OAuth application in GitLab so OpenHands can authenticate users and access repositories.- Go to your GitLab Group (or user account).
- Navigate to Settings > Applications.
-
Set the Redirect URI to:
Replace
<your-auth-hostname>with your installation’s Authentication hostname (auth.<your-openhands-domain>by default), for example:Replace only the hostname. Leave the rest of the path unchanged. -
Select the following scopes:
api,read_user,write_repository,openid,email,profile. - Save the application.
- Note the Client ID and Client Secret provided by GitLab.
The
api scope is required so OpenHands can list repositories, install
webhooks, and post comments. The write_repository scope is required for Git
operations such as branch creation.Step 2: Configure OpenHands Enterprise
Pick the path that matches how OpenHands Enterprise is deployed.- Replicated
- Standalone Helm
Open the Replicated Admin Console for your OpenHands Enterprise installation
and go to the application configuration page.In GitLab Authentication:
- Enable GitLab Authentication.
- Enter the GitLab Host. Leave it at
gitlab.comfor GitLab SaaS, or enter the hostname of your self-managed GitLab instance. - Enter the GitLab Client ID.
- Enter the GitLab Client Secret.
- Save and deploy the updated configuration.
Step 3: Sign In with GitLab
After the deployment is completed, users choose Sign in with GitLab on your app’s login page. On first sign-in, users may be asked to accept OpenHands terms and complete an offline access flow. After sign-in, OpenHands stores the user’s GitLab token so it can list repositories and run resolver jobs as that user.Install Repository Webhooks
To trigger OpenHands on GitLab repositories, repository administrators can install the OpenHands webhook from Settings > Integrations within the OpenHands app. For each project or group that should support@openhands
comments, click Install. If a webhook already exists, click Reinstall to
refresh it.
Group webhooks require a GitLab
Premium or Ultimate tier subscription.
For personal projects, project-level webhooks are used.
Use the Built-In Resolver
Mention@openhands in an issue, merge request comment, or inline merge request
review comment. You can also add the openhands label to an issue. Include the
task after the mention, for example:
- The repository webhook is installed and active.
- The mentioning GitLab user has signed in to OpenHands with GitLab.
- The mentioning user has access to the repository.
- Comments on the issue or merge request to let you know it is working on it, with a link to track progress.
- Creates an OpenHands conversation with the issue or merge request context.
- Runs the task using the triggering user’s GitLab authorization.
- For issues, opens a merge request if it determines that the issue has been resolved.
- Comments with a summary of the performed tasks and a link to the conversation.
Working with Issues
On your repository, label an issue withopenhands or add a message starting
with @openhands. OpenHands will:
- Comment on the issue to let you know it is working on it.
- Open a merge request if it determines that the issue has been resolved.
- Comment on the issue with a summary of the performed tasks and a link to the merge request.
Working with Merge Requests
To get OpenHands to work on merge requests, mention@openhands in the comments
to:
- Ask questions
- Request updates
- Get code explanations

