feat(core): basic implementation of remote workspace support#15120
feat(core): basic implementation of remote workspace support#15120
Conversation
|
Looks super cool, remind me of a small thing I did with opencode "cloud sessions" but on cloudflare sandboxes. Want to ask with daytona would the plan be to let these sandboxes stay up for a long while after initial prompt, incase users want to continue with another prompt later, or it will be able to be destroyed then a new one spins up on a new prompt? |
| config, | ||
| } | ||
|
|
||
| setTimeout(async () => { |
There was a problem hiding this comment.
I don't love this setTimeout; it mirrors what the current worktree implementation does and is needed because the frontend assumes this will return immediately with Info and do the rest in the background. going to revisit this
|
@OpeOginni it's up the provider, you will be able to pass provider-specific configuration, so they might let you configure it. Otherwise it's whatever guarantees they have The reason we want to support this first-class is exactly because of the problems when a remote env shuts down. You don't your whole server to be killed along with it. We want to be able to resume the session seamlessly, recreating a new sandbox if needed, and we should be able to do that since we synced all the session data |
|
@jlongster Love that cant wait to see how you plug it in |
| export type Workspace = { | ||
| id: string | ||
| branch: string | null | ||
| projectId: string |
There was a problem hiding this comment.
stupid nit but we use projectID everywhere
Scaffolds out some core primitives we will need to allow running sessions in a remote workspace environment.
control-planedirWorkspaceentity stored in the db, along with some basic functions for working with themservecommand automatically starts listening to remote workspacesNote: all of this work is flagged behind a dev flag and should not be available for any prod builds
The idea here is that we want a remote env to fully own a running session. It will have its own db with its own session (or multiple sessions). However, we want to track these sessions in the local environment, and treat them exactly the same as other sessions.
To do this, we will sync session data back from a remote env into the local env. We will have a copy of this data in both places, with the remote env acting as the writer and the local env as the reader.
The local env will present the exact same routes as it does today. But when the session is actually running in a remote env, it will forward some of the routes into the remote env.
There are two types of requests:
getrequests: these only read data. we always want to handle these in the local env based on the local sync of the session datapost,patch,delete,put): these all mutate data. the local env should never mutate session data, it's only allowed to read it. we forward all of these to the remote env which mutates data, and that data will be synced back to the local copyWe aren't actually doing any of this syncing yet, this PR is just the groundwork for it