OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Touched file in the editor causes that file to never be updated by in UI again

Open diwu-sf opened this issue 1 year ago • 6 comments

Is there an existing issue for the same bug?

  • [X] I have checked the existing issues.

Describe the bug and reproduction steps

On the latest main, let's say the workspace has a files with content.

  1. Ask the bot to do nothing, and then open the test file.
  2. Make some line edits in the file, then switch to another file.
  3. In UI, switch back to the edited file, it will show the previous edits.
  4. Check in the workspace file system, the content of the actual file will not have changed.
  5. Check what the UI is doing with HTTP request, and it is calling api/select-file?... and the response is correctly matching actual workspace content

UI editor though is still stuck rendering incorrect content. I think there's a bug somewhere with how the react state is caching the file content.

OpenHands Installation

Docker command in README

OpenHands Version

main

Operating System

None

Logs, Errors, Screenshots, and Additional Context

No response

diwu-sf avatar Oct 13 '24 05:10 diwu-sf

@diwu-sf , after you change the contents of the file in the UI, do you save the file by pressing Ctrl + s or Cmd + s , as you would on an IDE?

mamoodi avatar Oct 13 '24 17:10 mamoodi

I do believe we should make this more clear but if you save it, it will work.

mamoodi avatar Oct 13 '24 17:10 mamoodi

Okay i see what's happening:

  • if the user has modified a file, it's tainted in the UI and backend state doesn't overwrite the UI un-saved state
  • switching away from a modified file in the UI (without ctrl+s on the tainted file) doesn't reset that file, the state is still kept around in UI
  • from then on, even clicking the refresh file-tree button doesn't reset the in-memory unsaved state

Here's potential suggestions:

  • for "tainted" UI files with unsaved state, mark them in the UI explorer tree with a "orange dot" next to the name, with hover tooltip clarifying that it's got unsaved state
  • have a way to re-sync that file, perhaps "double clicking" on an unsaved file in the file tree will re-load it
  • or just have a full blown "right click context menu" or a file status bar at the top of the editor area

diwu-sf avatar Oct 13 '24 23:10 diwu-sf

amanape will be discussing this with the UI designer to see how to move forward on this. Thanks for bringing this up and writing out potential solutions!

mamoodi avatar Oct 14 '24 15:10 mamoodi

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 Nov 15 '24 02:11 github-actions[bot]

This issue was closed because it has been stalled for over 30 days with no activity.

github-actions[bot] avatar Nov 23 '24 01:11 github-actions[bot]

This is solved in main because the UI does not allow you to modify files anymore.

mamoodi avatar Dec 27 '24 15:12 mamoodi

Fixed in 0.18.0.

mamoodi avatar Jan 02 '25 17:01 mamoodi