Skip to content

Commit

Permalink
fix(issue_definitions, issue-success-check.jinja): pass git-patch to …
Browse files Browse the repository at this point in the history
…issue-success-check (#6243)

Co-authored-by: Graham Neubig <[email protected]>
  • Loading branch information
oconnorjoseph and neubig authored Jan 13, 2025
1 parent 5a809c9 commit 295c6fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions openhands/resolver/issue_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def guess_success(

class IssueHandler(IssueHandlerInterface):
issue_type: ClassVar[str] = 'issue'
default_git_patch: ClassVar[str] = 'No changes made yet'

def __init__(self, owner: str, repo: str, token: str, llm_config: LLMConfig):
self.download_url = 'https://api.github.com/repos/{}/{}/issues'
Expand Down Expand Up @@ -276,7 +277,11 @@ def guess_success(
'r',
) as f:
template = jinja2.Template(f.read())
prompt = template.render(issue_context=issue_context, last_message=last_message)
prompt = template.render(
issue_context=issue_context,
last_message=last_message,
git_patch=git_patch or self.default_git_patch,
)

# Get the LLM response and check for 'success' and 'explanation' in the answer
response = self.llm.completion(messages=[{'role': 'user', 'content': prompt}])
Expand Down Expand Up @@ -685,7 +690,7 @@ def _check_review_thread(
feedback=review_thread.comment,
files_context=files_context,
last_message=last_message,
git_patch=git_patch or 'No changes made yet',
git_patch=git_patch or self.default_git_patch,
)

return self._check_feedback_with_llm(prompt)
Expand All @@ -712,7 +717,7 @@ def _check_thread_comments(
issue_context=issues_context,
thread_context=thread_context,
last_message=last_message,
git_patch=git_patch or 'No changes made yet',
git_patch=git_patch or self.default_git_patch,
)

return self._check_feedback_with_llm(prompt)
Expand All @@ -739,7 +744,7 @@ def _check_review_comments(
issue_context=issues_context,
review_context=review_context,
last_message=last_message,
git_patch=git_patch or 'No changes made yet',
git_patch=git_patch or self.default_git_patch,
)

return self._check_feedback_with_llm(prompt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Given the following issue description and the last message from an AI agent atte
Issue description:
{{ issue_context }}

Changes made (git patch):
{{ git_patch }}

Last message from AI agent:
{{ last_message }}

Expand Down

0 comments on commit 295c6fd

Please sign in to comment.