OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Changes tab never works for repos cloned from github

Open JGKle opened this issue 7 months ago • 11 comments

Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).

  • [x] I have checked the existing issues.

Describe the bug and reproduction steps

I'm running OpenHands via the recommended Docker setup, plus mapping the workspace to a folder on the host system.

  • The "Changes" tab always shows "Your current workspace is not a git repository. Ask OpenHands to initialize a git repo to activate this UI" (there is definitely a repo there)
  • The logs show frequent messages like GET /api/conversations/75e98ef4d0044697bd457446897aa297/git/changes HTTP/1.1" 404 Not Found

I asked the agent if it could see the repo, and it ran git config --global --add safe.directory /workspace. After that it worked.

It seems this tab should show a clearer message if the repo needs to be marked as "safe", and ideally give a button/option to do so. Additionally, if not marked as safe, it shouldn't continuously log 404s.

OpenHands Installation

Docker command in README

OpenHands Version

0.36.0

Operating System

Linux

Logs, Errors, Screenshots, and Additional Context

No response

JGKle avatar May 02 '25 23:05 JGKle

Ah interesting. @metal450 when you have this, what directory does OpenHands start in? If you go to the terminal and do a pwd. Does it start within your repo folder or one directory above it?

mamoodi avatar May 05 '25 12:05 mamoodi

pwd prints /workspace. ls -a shows the repo (i.e. the .git folder is there)

JGKle avatar May 05 '25 13:05 JGKle

And your repo is straight in the /workspace directory?

mamoodi avatar May 05 '25 15:05 mamoodi

Yes. Or ls -a wouldn't show the .git folder there, lol ;)

JGKle avatar May 05 '25 15:05 JGKle

Image

this is the error from docker when I printed it. you can either catch it or just look for code 128. which is how im patching it in the meantimes openhands/runtime/utils/git_handler.py:_is_git_repo

SquallLeonhart13 avatar May 13 '25 23:05 SquallLeonhart13

Image

SquallLeonhart13 avatar May 14 '25 00:05 SquallLeonhart13

this might also be a related types problem

SquallLeonhart13 avatar May 14 '25 00:05 SquallLeonhart13

I have the same issue here with the default docker setup + local filesystem sandbox mountain, happy to help debug

peterhadlaw avatar May 16 '25 17:05 peterhadlaw

https://github.com/All-Hands-AI/OpenHands/blob/819bad077753a5329ea59ceeda9819a06b9c5805/openhands/runtime/utils/git_handler.py#L40

This is the file that is causing the problem in get_git_changes it calls the following function _is_git_repo. Im not a maintainer so I dont know if they will approve this type of patch, but maybe you can push it through.

Image

SquallLeonhart13 avatar May 16 '25 19:05 SquallLeonhart13

@SquallLeonhart13 Sorry, I'm not sure off-hand what is the right fix for this issue, but you are most welcome to propose a PR and/or to join our slack channel and maybe propose it (we have a channel eng-pr-review for example), or just discuss the issue before. (channel eng-help is generally for bugs or strange behavior)

enyst avatar May 16 '25 19:05 enyst

I also have the same issue with 0.39.1 version.

I accepted the suggestion from the main page to clone a repo. It was cloned under /workspace/my_project

I asked agent to do changes inside 'my_project' folder, which it did. The changes were always empty and I see a message your current workspace is not a git repository, ask... to create a git repo

iSevenDays avatar May 23 '25 21:05 iSevenDays

I believe this is fixed in https://github.com/All-Hands-AI/OpenHands/pull/8771

rbren avatar Jun 04 '25 17:06 rbren

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 05 '25 02:07 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 05 '25 02:08 github-actions[bot]