|
1 |
| -# OpenHands Github Issue Resolver 🙌 |
| 1 | +# OpenHands Resolver Has Moved |
2 | 2 |
|
3 |
| -Need help resolving a GitHub issue but don't have the time to do it yourself? Let an AI agent help you out! |
4 |
| - |
5 |
| -This tool allows you to use open-source AI agents based on [OpenHands](https://github.com/all-hands-ai/openhands) |
6 |
| -to attempt to resolve GitHub issues automatically. While it can handle multiple issues, it's primarily designed |
7 |
| -to help you resolve one issue at a time with high quality. |
8 |
| - |
9 |
| -Getting started is simple - just follow the instructions below. |
10 |
| - |
11 |
| -## Using the GitHub Actions Workflow |
12 |
| - |
13 |
| -This repository includes a GitHub Actions workflow that can automatically attempt to fix individual issues labeled with 'fix-me'. |
14 |
| -Follow these steps to use this workflow in your own repository: |
15 |
| - |
16 |
| -1. [Create a personal access token](https://github.com/settings/tokens?type=beta) with read/write scope for "contents", "issues", "pull requests", and "workflows" |
17 |
| - |
18 |
| -2. Create an API key for the [Claude API](https://www.anthropic.com/api) (recommended) or another supported LLM service |
19 |
| - |
20 |
| -3. Copy `examples/openhands-resolver.yml` to your repository's `.github/workflows/` directory |
21 |
| - |
22 |
| -4. Configure repository permissions: |
23 |
| - - Go to `Settings -> Actions -> General -> Workflow permissions` |
24 |
| - - Select "Read and write permissions" |
25 |
| - - Enable "Allow Github Actions to create and approve pull requests" |
26 |
| - |
27 |
| - Note: If the "Read and write permissions" option is greyed out: |
28 |
| - - First check if permissions need to be set at the organization level |
29 |
| - - If still greyed out at the organization level, permissions need to be set in the [Enterprise policy settings](https://docs.github.com/en/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#enforcing-a-policy-for-workflow-permissions-in-your-enterprise) |
30 |
| - |
31 |
| -5. Set up [GitHub secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions): |
32 |
| - - Required: |
33 |
| - - `PAT_USERNAME`: GitHub username for the personal access token |
34 |
| - - `PAT_TOKEN`: The personal access token |
35 |
| - - `LLM_MODEL`: LLM model to use (e.g., "anthropic/claude-3-5-sonnet-20241022") |
36 |
| - - `LLM_API_KEY`: Your LLM API key |
37 |
| - - Optional: |
38 |
| - - `LLM_BASE_URL`: Base URL for LLM API (only if using a proxy) |
39 |
| - |
40 |
| - Note: You can set these secrets at the organization level to use across multiple repositories. |
41 |
| - |
42 |
| -6. Usage: |
43 |
| - There are two ways to trigger the OpenHands agent: |
44 |
| - |
45 |
| - a. Using the 'fix-me' label: |
46 |
| - - Add the 'fix-me' label to any issue you want the AI to resolve |
47 |
| - - The agent will consider all comments in the issue thread when resolving |
48 |
| - - The workflow will: |
49 |
| - 1. Attempt to resolve the issue using OpenHands |
50 |
| - 2. Create a draft PR if successful, or push a branch if unsuccessful |
51 |
| - 3. Comment on the issue with the results |
52 |
| - 4. Remove the 'fix-me' label once processed |
53 |
| - |
54 |
| - b. Using `@openhands-agent` mention: |
55 |
| - - Create a new comment containing `@openhands-agent` in any issue |
56 |
| - - The agent will only consider the comment where it's mentioned |
57 |
| - - The workflow will: |
58 |
| - 1. Attempt to resolve the issue based on the specific comment |
59 |
| - 2. Create a draft PR if successful, or push a branch if unsuccessful |
60 |
| - 3. Comment on the issue with the results |
61 |
| - |
62 |
| -Need help? Feel free to [open an issue ](https://github.com/all-hands-ai/openhands-resolver/issues) or email us at [[email protected]](mailto:[email protected]). |
63 |
| - |
64 |
| -## Manual Installation |
65 |
| - |
66 |
| -If you prefer to run the resolver programmatically instead of using GitHub Actions, follow these steps: |
67 |
| - |
68 |
| -1. Install the package: |
69 |
| - |
70 |
| -```bash |
71 |
| -pip install openhands-resolver |
72 |
| -``` |
73 |
| - |
74 |
| -2. Create a GitHub access token: |
75 |
| - - Visit [GitHub's token settings](https://github.com/settings/personal-access-tokens/new) |
76 |
| - - Create a fine-grained token with these scopes: |
77 |
| - - "Content" |
78 |
| - - "Pull requests" |
79 |
| - - "Issues" |
80 |
| - - "Workflows" |
81 |
| - - If you don't have push access to the target repo, you can fork it first |
82 |
| - |
83 |
| -3. Set up environment variables: |
84 |
| - |
85 |
| -```bash |
86 |
| -# GitHub credentials |
87 |
| -export GITHUB_TOKEN="your-github-token" |
88 |
| -export GITHUB_USERNAME="your-github-username" # Optional, defaults to token owner |
89 |
| - |
90 |
| -# LLM configuration |
91 |
| -export LLM_MODEL="anthropic/claude-3-5-sonnet-20241022" # Recommended |
92 |
| -export LLM_API_KEY="your-llm-api-key" |
93 |
| -export LLM_BASE_URL="your-api-url" # Optional, for API proxies |
94 |
| -``` |
95 |
| - |
96 |
| -Note: OpenHands works best with powerful models like Anthropic's Claude or OpenAI's GPT-4. While other models are supported, they may not perform as well for complex issue resolution. |
97 |
| - |
98 |
| -## Resolving Issues |
99 |
| - |
100 |
| -The resolver can automatically attempt to fix a single issue in your repository using the following command: |
101 |
| - |
102 |
| -```bash |
103 |
| -python -m openhands_resolver.resolve_issue --repo [OWNER]/[REPO] --issue-number [NUMBER] |
104 |
| -``` |
105 |
| - |
106 |
| -For instance, if you want to resolve issue #100 in this repo, you would run: |
107 |
| - |
108 |
| -```bash |
109 |
| -python -m openhands_resolver.resolve_issue --repo all-hands-ai/openhands-resolver --issue-number 100 |
110 |
| -``` |
111 |
| - |
112 |
| -The output will be written to the `output/` directory. |
113 |
| - |
114 |
| -If you've installed the package from source using poetry, you can use: |
115 |
| - |
116 |
| -```bash |
117 |
| -poetry run python openhands_resolver/resolve_issue.py --repo all-hands-ai/openhands-resolver --issue-number 100 |
118 |
| -``` |
119 |
| - |
120 |
| -For resolving multiple issues at once (e.g., in a batch process), you can use the `resolve_all_issues` command: |
121 |
| - |
122 |
| -```bash |
123 |
| -python -m openhands_resolver.resolve_all_issues --repo [OWNER]/[REPO] --issue-numbers [NUMBERS] |
124 |
| -``` |
125 |
| - |
126 |
| -For example: |
127 |
| - |
128 |
| -```bash |
129 |
| -python -m openhands_resolver.resolve_all_issues --repo all-hands-ai/openhands-resolver --issue-numbers 100,101,102 |
130 |
| -``` |
131 |
| - |
132 |
| -## Responding to PR Comments |
133 |
| - |
134 |
| -The resolver can also respond to comments on pull requests using: |
135 |
| - |
136 |
| -```bash |
137 |
| -python -m openhands_resolver.send_pull_request --issue-number PR_NUMBER --issue-type pr |
138 |
| -``` |
139 |
| - |
140 |
| -This functionality is available both through the GitHub Actions workflow and when running the resolver locally. |
141 |
| - |
142 |
| -## Visualizing successful PRs |
143 |
| - |
144 |
| -To find successful PRs, you can run the following command: |
145 |
| - |
146 |
| -```bash |
147 |
| -grep '"success":true' output/output.jsonl | sed 's/.*\("number":[0-9]*\).*/\1/g' |
148 |
| -``` |
149 |
| - |
150 |
| -Then you can go through and visualize the ones you'd like. |
151 |
| - |
152 |
| -```bash |
153 |
| -python -m openhands_resolver.visualize_resolver_output --issue-number ISSUE_NUMBER --vis-method json |
154 |
| -``` |
155 |
| - |
156 |
| -## Uploading PRs |
157 |
| - |
158 |
| -If you find any PRs that were successful, you can upload them. |
159 |
| -There are three ways you can upload: |
160 |
| - |
161 |
| -1. `branch` - upload a branch without creating a PR |
162 |
| -2. `draft` - create a draft PR |
163 |
| -3. `ready` - create a non-draft PR that's ready for review |
164 |
| - |
165 |
| -```bash |
166 |
| -python -m openhands_resolver.send_pull_request --issue-number ISSUE_NUMBER --github-username YOUR_GITHUB_USERNAME --pr-type draft |
167 |
| -``` |
168 |
| - |
169 |
| -If you want to upload to a fork, you can do so by specifying the `fork-owner`: |
170 |
| - |
171 |
| -```bash |
172 |
| -python -m openhands_resolver.send_pull_request --issue-number ISSUE_NUMBER --github-username YOUR_GITHUB_USERNAME --pr-type draft --fork-owner YOUR_GITHUB_USERNAME |
173 |
| -``` |
174 |
| - |
175 |
| -## Providing Custom Instructions |
176 |
| - |
177 |
| -You can customize how the AI agent approaches issue resolution by adding a `.openhands_instructions` file to the root of your repository. If present, this file's contents will be injected into the prompt for openhands edits. |
178 |
| - |
179 |
| -## Troubleshooting |
180 |
| - |
181 |
| -If you have any issues, please open an issue on this github repo, we're happy to help! |
182 |
| -Alternatively, you can [email us ](mailto:[email protected]) or join the [OpenHands Slack workspace ](https://join.slack.com/t/opendevin/shared_invite/zt-2oikve2hu-UDxHeo8nsE69y6T7yFX_BA) and ask there. |
| 3 | +The OpenHands resolver has been moved to: |
| 4 | +https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/resolver |
0 commit comments