Skip to content

Commit

Permalink
More comprehensive messages (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
neubig authored Aug 30, 2024
1 parent eac0348 commit 4132a6a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion github_resolver/resolve_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ def guess_success(issue: GithubIssue, history: ShortTermHistory, llm_config: LLM
Last message from AI agent:
{last_message}
Has the issue been successfully resolved? Answer in JSON in the format {{success: bool, explanation: str}}."""
(1) has the issue been successfully resolved?
(2) If the issue has been resolved, please provide an explanation of what was done in the PR that can be sent to a human reviewer on github. If the issue has not been resolved, please provide an explanation of why.
Answer in JSON in the format {{success: bool, explanation: str}}."""

response = completion(
model=llm_config.model,
Expand Down
11 changes: 7 additions & 4 deletions github_resolver/send_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def send_pull_request(
patch_dir: str,
pr_type: str,
fork_owner: str | None = None,
additional_message: str | None = None,
) -> str:
if pr_type not in ["branch", "draft", "ready"]:
raise ValueError(f"Invalid pr_type: {pr_type}")
Expand Down Expand Up @@ -169,10 +170,11 @@ def send_pull_request(
raise RuntimeError("Failed to push changes to the remote repository")

pr_title = f"Fix issue #{github_issue.number}: {github_issue.title}"
pr_body = (
f"This pull request fixes #{github_issue.number}."
"\n\nAutomatic fix generated by [OpenHands](https://github.com/All-Hands-AI/OpenHands/)."
)
pr_body = f"This pull request fixes #{github_issue.number}."
if additional_message:
pr_body += f"\n\n{additional_message}"
pr_body += "\n\nAutomatic fix generated by [OpenHands](https://github.com/All-Hands-AI/OpenHands/)."


# If we are not sending a PR, we can finish early and return the
# URL for the user to open a PR manually
Expand Down Expand Up @@ -231,6 +233,7 @@ def process_single_issue(
patch_dir=patched_repo_dir,
pr_type=pr_type,
fork_owner=fork_owner,
additional_message=resolver_output.success_explanation,
)


Expand Down
1 change: 1 addition & 0 deletions tests/test_send_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def test_process_single_issue(
patch_dir=f"{mock_output_dir}/patches/issue_1",
pr_type=pr_type,
fork_owner=None,
additional_message=resolver_output.success_explanation,
)


Expand Down

0 comments on commit 4132a6a

Please sign in to comment.