Content-Length: 364667 | pFad | https://github.com/All-Hands-AI/OpenHands/pull/10517

B2 [Bug, GitHub]: fix missing context in cloud resolver by malhotra5 · Pull Request #10517 · All-Hands-AI/OpenHands · GitHub
Skip to content

Conversation

malhotra5
Copy link
Contributor

@malhotra5 malhotra5 commented Aug 20, 2025

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

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

  • Fix cases where GitHub Cloud Resolver doesn't consider context around comments

Summarize what the PR does, explaining any non-trivial design decisions.
This PR does the following

  1. consolidates all the issue related prompts into one template
  2. add previous issue/review comments to the template
  3. adds pr/issue title and body to template
  4. removes requirement where agent must use token to fetch this information

Fixes ALL-2905

@malhotra5 can click here to continue refining the PR


To run this PR locally, use the following command:

GUI with Docker:

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:d5b1702-nikolaik   --name openhands-app-d5b1702   docker.all-hands.dev/all-hands-ai/openhands:d5b1702

CLI with uvx:

uvx --python 3.12 --from git+https://github.com/All-Hands-AI/OpenHands@github-resolver-improvements openhands

…ed templates

- Add get_issue_comments() method to fetch issue comments
- Add get_issue_title_and_body() method to get issue details
- Add get_review_thread_comments() method for PR review threads
- Consolidate GitHub templates: issue_prompt.j2 and issue_conversation_instructions.j2
- Enhanced PR update template with review thread context
- Remove deprecated template files
@malhotra5 malhotra5 changed the title Add GitHub resolver improvements: enhanced API methods and consolidated templates [Bug, GitHub]: fix missing context in cloud resolver for Aug 20, 2025
@malhotra5 malhotra5 changed the title [Bug, GitHub]: fix missing context in cloud resolver for [Bug, GitHub]: fix missing context in cloud resolver Aug 20, 2025
openhands-agent and others added 10 commits August 25, 2025 20:43
- Implements method to retrieve comments from a review thread by thread_id
- Thread consists of root comment and all its replies in chronological order
- Handles edge cases like non-existent thread IDs gracefully
- Tested with real GitHub API data from PR #10517

Co-authored-by: openhands <openhands@all-hands.dev>
- Replace REST API approach with GraphQL for proper review thread filtering
- Add pr_review_thread_comments_graphql_query to queries.py
- Update method to accept GraphQL thread ID (string) instead of comment ID (int)
- Method now correctly retrieves all comments within a specific review thread
- Tested with actual review thread PRRT_kwDOLfkiw85YgBi- containing 3 comments
- Handles edge cases and maintains backward compatibility with Comment objects

Co-authored-by: openhands <openhands@all-hands.dev>
- Changed method signature to only accept comment_id parameter
- Added new GraphQL query get_thread_from_comment_graphql_query
- Implemented iterative traversal of reply chain to collect all thread comments
- Uses existing execute_graphql_query method for consistency
- Returns complete thread sorted by creation date
- Includes duplicate prevention and infinite loop protection
- Fixed mypy type annotation for current_comment_id

Co-authored-by: openhands <openhands@all-hands.dev>
- Removed unnecessary duplicate prevention logic since we traverse linearly up the chain
- Removed visited_ids set as infinite loops are not possible in a linear chain
- Simplified while loop condition to just check current_comment_id
- Loop naturally terminates when replyTo is null (root comment reached)

Co-authored-by: openhands <openhands@all-hands.dev>
- Add new GraphQL queries for getting review threads and thread comments
- Rewrite get_review_thread_comments to use existing query first, then traverse to root comment if replyTo exists
- Add new queries to get all review threads and find matching thread by comment ID
- Retrieve all comments from thread with pagination support
- Include databaseId in GraphQL queries for proper comment ID handling
- Add helper method _convert_comments_to_objects for code reuse
- Update method signature to include owner, repo, pr_number parameters
- Fix mypy type errors by using separate variable names for GraphQL variables

Co-authored-by: openhands <openhands@all-hands.dev>
- Update get_review_threads_graphql_query to support pagination with first/after parameters
- Add pageInfo with hasNextPage and endCursor to GraphQL query response
- Modify get_review_thread_comments method to paginate through all review threads
- Continue searching across pages until the matching thread is found
- Ensures all review threads are checked, not just the first 10

Co-authored-by: openhands <openhands@all-hands.dev>
- Handle case where replyTo field is None instead of accessing it directly
- Use .get() method to safely check for replyTo existence
- Prevents TypeError when comment has no parent reply

Co-authored-by: openhands <openhands@all-hands.dev>
@malhotra5 malhotra5 marked this pull request as ready for review August 26, 2025 06:07
@malhotra5 malhotra5 enabled auto-merge (squash) August 27, 2025 06:52
@malhotra5 malhotra5 disabled auto-merge August 27, 2025 06:53
@malhotra5 malhotra5 enabled auto-merge (squash) August 27, 2025 06:55
@malhotra5 malhotra5 merged commit 9afedea into main Aug 27, 2025
18 checks passed
@malhotra5 malhotra5 deleted the github-resolver-improvements branch August 27, 2025 07:07
enyst pushed a commit to enyst/playground that referenced this pull request Sep 4, 2025
)

Co-authored-by: openhands <openhands@all-hands.dev>
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.

3 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/All-Hands-AI/OpenHands/pull/10517

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy