-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add workspace setting in UI #1448
base: main
Are you sure you want to change the base?
Conversation
opendevin/sandbox/docker/exec_box.py
Outdated
@@ -61,7 +62,7 @@ def __init__( | |||
raise ex | |||
|
|||
self.instance_id = sid if sid is not None else str(uuid.uuid4()) | |||
|
|||
self.workspace_mount_path = workspace_mount_path or config.get(ConfigType.WORKSPACE_MOUNT_PATH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this isn't quite the logic I think we should have.
Instead, WORKSPACE_MOUNT_PATH
should be held constant, and the sandboxes should accept a relative directory, like
./app`
This way the user has a guarantee that we'll always mount on WORKSPACE_MOUNT_PATH or a subdirectory
Thanks for taking this on! Excited to add this bit |
b9aa55a
to
8cd7e47
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1448 +/- ##
=======================================
Coverage ? 64.24%
=======================================
Files ? 99
Lines ? 4072
Branches ? 0
=======================================
Hits ? 2616
Misses ? 1456
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Hey @johnnyaug , thanks for this! It seems that this is now out of sync, so if you could bring it back in sync with main we can take a look. |
Hey @neubig, sure - on it |
6250690
to
42da978
Compare
*/ | ||
export const getSettingsDifference = (settings: Partial<Settings>) => { | ||
const currentSettings = getSettings(); | ||
export const getSettingsDifference = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is for testability: The test for SettingsModal mocks getSettings.
Unfortunately, the internal call to getSettings from getSettingsDifference could not be mocked, because of this.
I think the new way is also better in terms of separation of concerns.
0c01662
to
494c1fe
Compare
opendevin/runtime/runtime.py
Outdated
return DockerExecBox( | ||
sid=sid, timeout=config.sandbox_timeout, workspace_mount_path=workspace | ||
) | ||
elif sandbox_type == 'local': | ||
return LocalBox(timeout=config.sandbox_timeout) | ||
return LocalBox(timeout=config.sandbox_timeout, workspace=workspace) | ||
elif sandbox_type == 'ssh': | ||
return DockerSSHBox(sid=sid, timeout=config.sandbox_timeout) | ||
return DockerSSHBox( | ||
sid=sid, timeout=config.sandbox_timeout, workspace_mount_path=workspace | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should call the input parameter here the same thing, since these are all Sandbox objects. Maybe relative_workspace
?
Then the mount path would be path.join(config.workspace_mount_path, relative_workspace)
I think it's also a good idea to keep the extra workspace directory param you're adding relative, rather than an absolute path. The base path varies between in-docker and out-of-docker, so it'd be nice to have a consistent reference to a subdirectory that's valid in both places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - done!
a63cc13
to
350bdb1
Compare
Sorry @johnnyaug I should have tried to get this in before my PR. The plumbing is a little different now--the runtime is instantiated outside the AgentController. Hopefully not too much work to merge |
350bdb1
to
9668472
Compare
@@ -71,6 +81,9 @@ def __init__( | |||
self.event_stream.subscribe(EventStreamSubscriber.RUNTIME, self.on_event) | |||
self._bg_task = asyncio.create_task(self._start_background_observation_loop()) | |||
|
|||
def set_workspace_subdir(self, workspace_subdir: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit it's not the best practice to change the state on an otherwise fixed-state object, so I'm happy to hear your suggestions.
@rbren, no worries - I hope this cuts it, please take another look |
@johnnyaug unfortunately the agent appears to continue editing the root directory even when I select a subdirectory... Every time we save new settings, the agent controller and runtime are recreated--maybe instead of setting |
9e12aa4
to
f879e19
Compare
8881bc7
to
afb12b6
Compare
ff9d91b
to
3ebd638
Compare
allow runcmd under workspace subdir wip wip wip Revert "wip" This reverts commit 135770ca5e0170a36827d4a1671b5e13fc944633. wip fix test test caught this! some reverts fix upload linta
a950ef1
to
9802ff1
Compare
@rbren, could you please take another look? |
Hi @johnnyaug, I have been tasked with testing this PR and will try to keep on top of testing it when you make changes. I'm running on MacOS. Here is my current structure:
There's a couple of issues:
I tested the Workspace root and one level deep directories and it works well. What I suggest is in the PR description, you describe how you expect the behavior of setting a new workspace directory should work. For example how you expect setting a directory one level deep vs three level deep should work. Make sure maintainers approve of that and then work out the issues. I will continue testing it as you resolve the issues as this seems like it would be very valuable. |
IMO we only really need to go one directory deep here. I think the best experience would be:
|
@johnnyaug in that case things will be simpler. So if you have this directory structure:
The UI will always remain the same and always shows:
Even if you select sub-folder-1. I believe you have most of it working. Just need to address the error and always only show the level1 folders. |
@rbren @mamoodi Just so we're all on the same page - the feature allows exactly what @rbren is suggesting and allows to go only one level deep in the setting. When using the file explorer, you can go as many levels deep as you like, but this is unrelated to this feature. @mamoodi Hey and thank you for looking into it! In your comments, when you refer to "selecting another directory" I wasn't sure whether you meant using the new subdirectory setting, or selecting using the file explorer. Please try to be unambiguous about it in the future. Anyway I will take a look at the issues you're describing and report back here. |
@johnnyaug my apologies if I wasn't clear! I am only using the new dropdown added in settings called "OpenDevin Workspace directory". I am unsure what you mean by using the file explorer. My Workspace structure is like so:
Notice that I've already selected test-dir for my workspace but now it allows me to select deep dir which is two levels deep compared to my workspace root. |
While you guys are at it, could I ask for favors? 😆
|
Resolves #1145.
This feature allows OpenDevin to operate in the immediate subdirectories of the WORKSPACE_BASE directory.
The immediate children of WORKSPACE_SUBDIR now appear in the settings, and the OpenDevin agent will consider the selected directory as the working directory on the following tasks.