OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Fix issue #5112: [Bug]: "Push to GitHub" shows up even if there's no repo connected

Open openhands-agent opened this issue 1 year ago • 7 comments

This pull request fixes #5112.

The issue has been successfully resolved. The PR addresses the core problem by fixing the logic for when the "Push to GitHub" button should be displayed. The key changes were:

  1. Adding a new hasConnectedRepo prop that specifically checks for an actual connected repository (via githubData)
  2. Modifying the display logic to require both GitHub connection AND a connected repository
  3. This ensures the button only appears when functionally useful (when there's actually a repository to push to)

The solution is both technically sound and matches the original issue description, which noted that the button should only appear when there's a repository connected to the project, not just when a user is logged into GitHub. The changes are minimal but effective, focusing on the exact problem without introducing unnecessary complexity.

For a human reviewer, this PR can be summarized as: "This PR fixes the 'Push to GitHub' button visibility logic by ensuring it only appears when both conditions are met: the user is logged into GitHub AND the current project has a connected repository. Previously, the button would show up just by being logged into GitHub, which wasn't the intended behavior."

Automatic fix generated by OpenHands 🙌


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

openhands-agent avatar Nov 27 '24 23:11 openhands-agent

This LGTM but I'd like a check from @amanape as well if possible.

neubig avatar Nov 27 '24 23:11 neubig

The original issue (#5112) is not resolved with this PR since the push action the issue references is the one in the chat interface: https://github.com/All-Hands-AI/OpenHands/blob/b9b6cfd406814f453a1cfe46842cd7a7126b957b/frontend/src/components/features/chat/chat-interface.tsx#L99-L103

This PR changes the behavior of the "Push to GitHub" action in the project menu card (bottom-right of the app) after the user signs in with GitHub. In my opinion, the expected behavior here remains unclear. Initially, these were the intended states I implemented, but it doesn’t make much sense to display the project card if no repository was selected in the first place. We should clarify and revise the following:

  • Should the project card be displayed if no repository is selected?
    • Note: The card’s state will remain static during a session since repository selection is only possible from the home screen at the start.
  • Should we separate the "Download ZIP" button from the project card?

CC: @rbren

amanape avatar Dec 02 '24 06:12 amanape

@openhands-agent please merge main and fix conflicts

rbren avatar Dec 03 '24 15:12 rbren

OpenHands started fixing the pr! You can monitor the progress here.

github-actions[bot] avatar Dec 03 '24 15:12 github-actions[bot]

@amanape yeah I think we should still show the card, even if GitHub is not selected. It'll be a little bare but I'd like to put more info in there down the line

Putting "Download zip" and "Push to GH" inside that little context menu is a little too hidden, but without other designs I say we keep them there for now

rbren avatar Dec 03 '24 15:12 rbren

New OpenHands update

openhands-agent avatar Dec 03 '24 15:12 openhands-agent

The workflow to fix this issue encountered an error. Please check the workflow logs for more information.

github-actions[bot] avatar Dec 03 '24 15:12 github-actions[bot]

This would be a nice fix to get in. Anyone can take it to the finish line?

mamoodi avatar Dec 09 '24 21:12 mamoodi

Another ping. Who is supposed to be leading this PR? @amanape , @neubig , @rbren

mamoodi avatar Dec 16 '24 16:12 mamoodi

I'll take it but close this PR since it does not address the original problem

amanape avatar Dec 16 '24 16:12 amanape