mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
feat(sandbox): remove session VMs when the sandbox is turned off or idle
Turning a session's sandbox off now removes its microVM and Docker data volume in the background. The idle sweep removes idle session VMs instead of stopping them, covering stopped VMs and VMs left from before a Manager restart, and starts when the Manager boots. Removal is serialized against boots so a command planned during a removal gets a fresh VM.
This commit is contained in:
1 parent
493a51f803
commit
1d001bc43e
6 files changed
+390
-52
No files matched your search
@@ -254,7 +254,7 @@ describe('SandboxSettings', () => {
|
||||
|
||||
expect(screen.getByLabelText('Default CPUs')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('Default memory (GiB)')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('Stop idle sandbox VMs after (minutes)')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('Remove idle sandbox VMs after (minutes)')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('Max running sandbox VMs')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ export function SandboxSettings() {
|
||||
}))
|
||||
return
|
||||
}
|
||||
void saveSandbox({ idleStopMinutes: value }, 'Idle stop timeout saved')
|
||||
void saveSandbox({ idleStopMinutes: value }, 'Idle removal timeout saved')
|
||||
}
|
||||
|
||||
const commitMaxRunningVms = () => {
|
||||
@@ -278,7 +278,7 @@ export function SandboxSettings() {
|
||||
|
||||
<div className="flex items-center justify-between gap-3 border-t pt-3">
|
||||
<Label htmlFor="sandboxIdleStopMinutes" className="min-w-0 text-sm font-semibold">
|
||||
Stop idle sandbox VMs after (minutes)
|
||||
Remove idle sandbox VMs after (minutes)
|
||||
</Label>
|
||||
<Input
|
||||
id="sandboxIdleStopMinutes"
|
||||
@@ -315,10 +315,11 @@ export function SandboxSettings() {
|
||||
</div>
|
||||
|
||||
<p className="text-xs text-muted-foreground @min-[1000px]:col-span-2">
|
||||
Each sandboxed session gets its own microVM that mounts only that session's repository. Idle VMs stop
|
||||
automatically and restart on the next command; at most {helperMaxRunningVms} run at once. CPU and
|
||||
memory changes apply on the session's next sandboxed command and recreate its VM (the Docker data
|
||||
volume is kept).
|
||||
Each sandboxed session gets its own microVM that mounts only that session's repository. A VM unused
|
||||
for this long, or whose session's sandbox is turned off, is removed together with its Docker data, so
|
||||
installed packages and Docker images are lost; the next sandboxed command creates a fresh VM. At most{' '}
|
||||
{helperMaxRunningVms} run at once. CPU and memory changes apply on the session's next sandboxed command
|
||||
and recreate its VM (the Docker data volume is kept).
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user