Add Bitbucket microagent and backend implementation (#9021)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
Co-authored-by: Rohit Malhotra <rohitvinodmalhotra@gmail.com>
This commit is contained in:
Graham Neubig
2025-06-18 00:04:29 -04:00
committed by GitHub
parent b7efeb11d9
commit e074b2d36f
47 changed files with 2174 additions and 115 deletions

View File

@@ -1,9 +1,9 @@
# OpenHands Github & Gitlab Issue Resolver 🙌
# OpenHands GitHub, GitLab & Bitbucket Issue Resolver 🙌
Need help resolving a GitHub issue but don't have the time to do it yourself? Let an AI agent help you out!
Need help resolving a GitHub, GitLab, or Bitbucket issue but don't have the time to do it yourself? Let an AI agent help you out!
This tool allows you to use open-source AI agents based on [OpenHands](https://github.com/all-hands-ai/openhands)
to attempt to resolve GitHub issues automatically. While it can handle multiple issues, it's primarily designed
to attempt to resolve GitHub, GitLab, and Bitbucket issues automatically. While it can handle multiple issues, it's primarily designed
to help you resolve one issue at a time with high quality.
Getting started is simple - just follow the instructions below.
@@ -74,8 +74,8 @@ If you prefer to run the resolver programmatically instead of using GitHub Actio
pip install openhands-ai
```
2. Create a GitHub or GitLab access token:
- Create a GitHub acces token
2. Create a GitHub, GitLab, or Bitbucket access token:
- Create a GitHub access token
- Visit [GitHub's token settings](https://github.com/settings/personal-access-tokens/new)
- Create a fine-grained token with these scopes:
- "Content"
@@ -84,7 +84,7 @@ pip install openhands-ai
- "Workflows"
- If you don't have push access to the target repo, you can fork it first
- Create a GitLab acces token
- Create a GitLab access token
- Visit [GitLab's token settings](https://gitlab.com/-/user_settings/personal_access_tokens)
- Create a fine-grained token with these scopes:
- 'api'
@@ -93,6 +93,16 @@ pip install openhands-ai
- 'read_repository'
- 'write_repository'
- Create a Bitbucket access token
- Visit [Bitbucket's app passwords settings](https://bitbucket.org/account/settings/app-passwords/)
- Create an app password with these scopes:
- 'Repositories: Read'
- 'Repositories: Write'
- 'Pull requests: Read'
- 'Pull requests: Write'
- 'Issues: Read'
- 'Issues: Write'
3. Set up environment variables:
```bash
@@ -107,6 +117,11 @@ export GIT_USERNAME="your-github-username" # Optional, defaults to token owner
export GITLAB_TOKEN="your-gitlab-token"
export GIT_USERNAME="your-gitlab-username" # Optional, defaults to token owner
# Bitbucket credentials if you're using Bitbucket repo
export BITBUCKET_TOKEN="your-bitbucket-token"
export GIT_USERNAME="your-bitbucket-username" # Optional, defaults to token owner
# LLM configuration
export LLM_MODEL="anthropic/claude-sonnet-4-20250514" # Recommended
@@ -172,13 +187,13 @@ There are three ways you can upload:
3. `ready` - create a non-draft PR that's ready for review
```bash
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --username YOUR_GITHUB_OR_GITLAB_USERNAME --pr-type draft
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --username YOUR_GIT_USERNAME --pr-type draft
```
If you want to upload to a fork, you can do so by specifying the `fork-owner`:
```bash
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --username YOUR_GITHUB_OR_GITLAB_USERNAME --pr-type draft --fork-owner YOUR_GITHUB_OR_GITLAB_USERNAME
python -m openhands.resolver.send_pull_request --issue-number ISSUE_NUMBER --username YOUR_GIT_USERNAME --pr-type draft --fork-owner YOUR_GIT_USERNAME
```
## Providing Custom Instructions
@@ -187,5 +202,5 @@ You can customize how the AI agent approaches issue resolution by adding a repos
## Troubleshooting
If you have any issues, please open an issue on this github or gitlab repo, we're happy to help!
If you have any issues, please open an issue on this GitHub, GitLab, or Bitbucket repo, we're happy to help!
Alternatively, you can [email us](mailto:contact@all-hands.dev) or join the OpenHands Slack workspace (see [the README](/README.md) for an invite link).