From e39bf80239855a5f60d54a05ce4dc9358683f819 Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Wed, 13 Aug 2025 14:44:06 -0400 Subject: [PATCH] fix(prompt): Add explicit GitHub/GitLab/Slack push instructions to templates (#10290) Co-authored-by: openhands --- .../github/issue_comment_conversation_instructions.j2 | 11 ++++++++--- .../github/issue_labeled_conversation_instructions.j2 | 10 ++++++++-- .../github/pr_update_conversation_instructions.j2 | 5 +++-- .../gitlab/issue_comment_conversation_instructions.j2 | 11 ++++++++--- .../gitlab/issue_labeled_conversation_instructions.j2 | 10 ++++++++-- .../gitlab/mr_update_conversation_instructions.j2 | 5 +++-- .../slack/user_message_conversation_instructions.j2 | 10 ++++++++++ 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/openhands/integrations/templates/resolver/github/issue_comment_conversation_instructions.j2 b/openhands/integrations/templates/resolver/github/issue_comment_conversation_instructions.j2 index 2007b490e4..cba8892e33 100644 --- a/openhands/integrations/templates/resolver/github/issue_comment_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/github/issue_comment_conversation_instructions.j2 @@ -12,6 +12,11 @@ A comment on the issue has been addressed to you. When you're done, make sure to 1. Re-read the issue title, body, and comments and make sure that you have successfully implemented all requirements. -2. Use the `create_pr` tool to open a new PR -3. Name the branch using `openhands/` as a prefix (e.g `openhands/update-readme`) -4. The PR description should mention that it "fixes" or "closes" the issue number +2. Create a new branch using `openhands/` as a prefix (e.g `openhands/update-readme`) +3. Commit your changes with a clear commit message +4. Push the branch to GitHub +5. Use the `create_pr` tool to open a new PR +6. The PR description should: + - Follow the repository's PR template (check `.github/pull_request_template.md` if it exists) + - Mention that it "fixes" or "closes" the issue number + - Include all required sections from the template diff --git a/openhands/integrations/templates/resolver/github/issue_labeled_conversation_instructions.j2 b/openhands/integrations/templates/resolver/github/issue_labeled_conversation_instructions.j2 index 37af2552e6..3e2457598c 100644 --- a/openhands/integrations/templates/resolver/github/issue_labeled_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/github/issue_labeled_conversation_instructions.j2 @@ -7,5 +7,11 @@ Your tasking is to fix an issue in your repository. Do the following When you're done, make sure to -1. Use the `create_pr` tool to open a new PR -2. The PR description should mention that it "fixes" or "closes" the issue number +1. Create a new branch with a descriptive name (e.g., `openhands/fix-issue-123`) +2. Commit your changes with a clear commit message +3. Push the branch to GitHub +4. Use the `create_pr` tool to open a new PR +5. The PR description should: + - Follow the repository's PR template (check `.github/pull_request_template.md` if it exists) + - Mention that it "fixes" or "closes" the issue number + - Include all required sections from the template diff --git a/openhands/integrations/templates/resolver/github/pr_update_conversation_instructions.j2 b/openhands/integrations/templates/resolver/github/pr_update_conversation_instructions.j2 index 95ee50e962..c6e26ff26a 100644 --- a/openhands/integrations/templates/resolver/github/pr_update_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/github/pr_update_conversation_instructions.j2 @@ -17,5 +17,6 @@ If it's a question: If it requests a code update: 1. Modify the code accordingly in the current branch - 2. Push the changes to update the PR - 3. DO NOT leave any comments on the PR + 2. Commit your changes with a clear commit message + 3. Push the changes to GitHub to update the PR + 4. DO NOT leave any comments on the PR diff --git a/openhands/integrations/templates/resolver/gitlab/issue_comment_conversation_instructions.j2 b/openhands/integrations/templates/resolver/gitlab/issue_comment_conversation_instructions.j2 index 0b6d90b65f..e5738add56 100644 --- a/openhands/integrations/templates/resolver/gitlab/issue_comment_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/gitlab/issue_comment_conversation_instructions.j2 @@ -12,6 +12,11 @@ A comment on the issue has been addressed to you. When you're done, make sure to 1. Re-read the issue title, body, and comments and make sure that you have successfully implemented all requirements. -2. Use the `create_mr` tool to open a new MR -3. Name the branch using `openhands/` as a prefix (e.g `openhands/update-readme`) -4. The MR description should mention that it "fixes" or "closes" the issue number +2. Create a new branch using `openhands/` as a prefix (e.g `openhands/update-readme`) +3. Commit your changes with a clear commit message +4. Push the branch to GitLab +5. Use the `create_mr` tool to open a new MR +6. The MR description should: + - Follow the repository's MR template (check `.gitlab/merge_request_templates/` or `.github/pull_request_template.md` if it exists) + - Mention that it "fixes" or "closes" the issue number + - Include all required sections from the template diff --git a/openhands/integrations/templates/resolver/gitlab/issue_labeled_conversation_instructions.j2 b/openhands/integrations/templates/resolver/gitlab/issue_labeled_conversation_instructions.j2 index 583b04a2e8..24b957d862 100644 --- a/openhands/integrations/templates/resolver/gitlab/issue_labeled_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/gitlab/issue_labeled_conversation_instructions.j2 @@ -7,5 +7,11 @@ Your tasking is to fix an issue in your repository. Do the following When you're done, make sure to -1. Use the `create_mr` tool to open a new MR -2. The MR description should mention that it "fixes" or "closes" the issue number +1. Create a new branch with a descriptive name (e.g., `openhands/fix-issue-123`) +2. Commit your changes with a clear commit message +3. Push the branch to GitLab +4. Use the `create_mr` tool to open a new MR +5. The MR description should: + - Follow the repository's MR template (check `.gitlab/merge_request_templates/` or `.github/pull_request_template.md` if it exists) + - Mention that it "fixes" or "closes" the issue number + - Include all required sections from the template diff --git a/openhands/integrations/templates/resolver/gitlab/mr_update_conversation_instructions.j2 b/openhands/integrations/templates/resolver/gitlab/mr_update_conversation_instructions.j2 index 7c2c47fa0b..c6735e1cf9 100644 --- a/openhands/integrations/templates/resolver/gitlab/mr_update_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/gitlab/mr_update_conversation_instructions.j2 @@ -17,5 +17,6 @@ If it's a question: If it requests a code update: 1. Modify the code accordingly in the current branch - 2. Push the changes to update the MR - 3. DO NOT leave any comments on the MR + 2. Commit your changes with a clear commit message + 3. Push the changes to GitLab to update the MR + 4. DO NOT leave any comments on the MR diff --git a/openhands/integrations/templates/resolver/slack/user_message_conversation_instructions.j2 b/openhands/integrations/templates/resolver/slack/user_message_conversation_instructions.j2 index 3fa0e5bb8d..cef1453491 100644 --- a/openhands/integrations/templates/resolver/slack/user_message_conversation_instructions.j2 +++ b/openhands/integrations/templates/resolver/slack/user_message_conversation_instructions.j2 @@ -5,3 +5,13 @@ These are a list of text messages attached in order of most recent. {{ message }} {% if not loop.last %}\n\n{% endif %} {% endfor %} + +If you made code changes, when you're done make sure to: + +1. Commit your changes with a clear commit message +2. **Ask the user in your summary** whether they want you to: + - Push the changes to a new branch and create a pull request (following the repository's PR template if it exists) + - Just keep the changes local for now + - Any other specific Git workflow they prefer + +Do NOT automatically push or create pull requests without explicit user confirmation.