Compare commits

...

2 Commits

3 changed files with 99 additions and 1 deletions

View File

@@ -285,7 +285,7 @@ async def process_issue(
success=success,
comment_success=comment_success,
success_explanation=success_explanation,
error=last_error,
error=last_error if not (comment_success and any(comment_success)) else None,
)
return output

View File

@@ -18,3 +18,7 @@ class ResolverOutput(BaseModel):
comment_success: list[bool] | None
success_explanation: str
error: str | None
@property
def has_partial_success(self) -> bool:
return bool(self.comment_success and any(self.comment_success))

View File

@@ -0,0 +1,94 @@
from openhands.resolver.github_issue import GithubIssue
from openhands.resolver.resolver_output import ResolverOutput
def test_resolver_output_has_partial_success():
# Test case 1: No comment_success
output = ResolverOutput(
issue=GithubIssue(
owner='test', repo='test', number=1, title='test', body='test'
),
issue_type='pr',
instruction='test',
base_commit='test',
git_patch='test',
history=[],
metrics=None,
success=False,
comment_success=None,
success_explanation='test',
error=None,
)
assert not output.has_partial_success
# Test case 2: Empty comment_success list
output = ResolverOutput(
issue=GithubIssue(
owner='test', repo='test', number=1, title='test', body='test'
),
issue_type='pr',
instruction='test',
base_commit='test',
git_patch='test',
history=[],
metrics=None,
success=False,
comment_success=[],
success_explanation='test',
error=None,
)
assert not output.has_partial_success
# Test case 3: All comments failed
output = ResolverOutput(
issue=GithubIssue(
owner='test', repo='test', number=1, title='test', body='test'
),
issue_type='pr',
instruction='test',
base_commit='test',
git_patch='test',
history=[],
metrics=None,
success=False,
comment_success=[False, False],
success_explanation='test',
error=None,
)
assert not output.has_partial_success
# Test case 4: Some comments succeeded
output = ResolverOutput(
issue=GithubIssue(
owner='test', repo='test', number=1, title='test', body='test'
),
issue_type='pr',
instruction='test',
base_commit='test',
git_patch='test',
history=[],
metrics=None,
success=False,
comment_success=[True, False],
success_explanation='test',
error=None,
)
assert output.has_partial_success
# Test case 5: All comments succeeded
output = ResolverOutput(
issue=GithubIssue(
owner='test', repo='test', number=1, title='test', body='test'
),
issue_type='pr',
instruction='test',
base_commit='test',
git_patch='test',
history=[],
metrics=None,
success=False,
comment_success=[True, True],
success_explanation='test',
error=None,
)
assert output.has_partial_success