Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: Adding endpoint for suggested tasks Openhands could tackle #6844

Merged
merged 9 commits into from
Feb 26, 2025

Conversation

malhotra5
Copy link
Contributor

@malhotra5 malhotra5 commented Feb 19, 2025

End-user friendly description of the problem this fixes or functionality that this introduces

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions

This PR only adds an endpoint in our backend for "suggested tasks" we could display on the frontend. Suggested tasks are those we'd like to proactively request permission from the user to resolve using Openhands. The UI for this is still undecided.

We use graphql here because we want to make the fetching process as efficient as possible (minimize number of requests).

I had Openhands test this endpoint and a sample output is included below

--------------------------------------------------

Type: TaskType.FAILING_CHECKS
Repo: All-Hands-AI/OpenHands
Number: #6418
Title: [NO MERGE] Test AWS changes
--------------------------------------------------

Type: TaskType.UNRESOLVED_COMMENTS
Repo: All-Hands-AI/OpenHands
Number: #6441
Title: Container snapshots/restore feature and other critical bug fixes
--------------------------------------------------

Type: TaskType.FAILING_CHECKS
Repo: All-Hands-AI/OpenHands
Number: #6456
Title: feat(resolver): Add support for extracting and processing text file attachments in GitHub issues
--------------------------------------------------

Type: TaskType.UNRESOLVED_COMMENTS
Repo: All-Hands-AI/OpenHands
Number: #6460
Title: Bug fixes
--------------------------------------------------

Type: TaskType.FAILING_CHECKS
Repo: All-Hands-AI/OpenHands
Number: #6511
Title: Add deprecation notices for legacy agent skills
--------------------------------------------------

Type: TaskType.FAILING_CHECKS
Repo: All-Hands-AI/OpenHands
Number: #6526
Title: Move PromptManager to agent controller level
--------------------------------------------------

Type: TaskType.UNRESOLVED_COMMENTS
Repo: All-Hands-AI/OpenHands
Number: #6526
Title: Move PromptManager to agent controller level
--------------------------------------------------

Type: TaskType.FAILING_CHECKS
Repo: All-Hands-AI/OpenHands
Number: #6530
Title: feat: add sound and browser notifications for agent state changes
--------------------------------------------------

Type: TaskType.UNRESOLVED_COMMENTS
Repo: All-Hands-AI/OpenHands
Number: #6536
Title: fix: Remove nested git repositories before adding files in SWE-bench
--------------------------------------------------

Type: TaskType.UNRESOLVED_COMMENTS
Repo: All-Hands-AI/OpenHands
Number: #6572
Title: Changed Dockerfile template so using ubuntu:22.04 as runtime base image does not have docker build error
-----

Link of any specific issues this addresses


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:5b8e97b-nikolaik   --name openhands-app-5b8e97b   docker.all-hands.dev/all-hands-ai/openhands:5b8e97b

@enyst
Copy link
Collaborator

enyst commented Feb 20, 2025

At a quick look, this looks like it would work locally, but I'm not sure. Could you please confirm or not?

Just curious, how did OpenHands agent test, in what setup?

Copy link
Collaborator

@rbren rbren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue I'm realizing here is that we don't have a repo list sorted by pushed_at, so we don't know which repos to focus on :/

Any ideas on how to retrieve the top 5 most relevant repos that the user has connected? When I connect my personal acct with ~500 repos, openhands really struggles

@rbren
Copy link
Collaborator

rbren commented Feb 20, 2025

I wonder if another option is to do this query across all repos, looking for PRs owned by the user, or issues assigned to them

@malhotra5
Copy link
Contributor Author

malhotra5 commented Feb 24, 2025

This PR has been updated as follows

  1. We look for PRs/Issue assigned for the user across ALL repos; the PRs and Issues fetched are based on whether they were most recently updated
  2. Unit test to check expected behavior

I also had openhands write a small script to test whether this would output the expected data and it worked well

import asyncio
import os
from pydantic import SecretStr

from openhands.integrations.github.github_service import GitHubService

async def main():
    token = SecretStr(os.environ['GITHUB_TOKEN'])
    service = GitHubService(token=token)
        
    print("\nFetching suggested tasks...")
    tasks = await service.get_suggested_tasks()
    
    print("\nFound tasks:")
    if not tasks:
        print("No tasks found")
    for task in tasks:
        print(f"\n{task.task_type} in {task.repo}:")
        print(f"#{task.issue_number}: {task.title}")

if __name__ == "__main__":
    asyncio.run(main())

and it output the following data

Fetching suggested tasks...

Found tasks:

TaskType.UNRESOLVED_COMMENTS in All-Hands-AI/OpenHands:
#6844: [Feat]: Adding endpoint for suggested tasks Openhands could tackle

TaskType.UNRESOLVED_COMMENTS in malhotra5/test-repo:
#45: Update README title to "Github App Resolver Test"

TaskType.UNRESOLVED_COMMENTS in malhotra5/test-repo:
#32: Add whats_up.txt file

TaskType.OPEN_PR in malhotra5/test-repo:
#43: Fix #38: Create test.md ...

cc @enyst

@malhotra5 malhotra5 requested review from enyst and rbren February 24, 2025 20:04
@malhotra5 malhotra5 merged commit e49b924 into main Feb 26, 2025
14 checks passed
@malhotra5 malhotra5 deleted the feature/suggested-tasks-api branch February 26, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants