feat(sandbox): per-session sandbox VMs with resource settings and provider arbitration

- Sandbox new root sessions by default with a per-session composer toggle;
  child sessions inherit their root session's mode (OM-82)
- Run each sandboxed root session in its own microVM that mounts only the
  session's repository, with per-session CPU/memory overrides, Settings
  defaults, idle stop, and a cap on running VMs (OM-89)
- Arbitrate shell sandboxing with other plugins (opencode-forge) through the
  shared opencode.sandbox-arbiter.v1 registry so exactly one provider
  sandboxes each call regardless of load order; fail closed on claim errors
- Throw when another plugin rewrites a pinned sandbox shell setting
- Tag sandboxed tool results with the owning provider and show it in the badge
- Hint the agent to start Docker inside the VM only when OCM owns the session
This commit is contained in:
Chris Scott committed 2026-10-15 16:53:49 -04:00
1 parent ccdf75d803
commit b21fdf5b94
48 files changed
+5666 -3375

No files matched your search

@@ -265,6 +265,31 @@ describe('ToolCallPart background indicator', () => {
await waitFor(() => expect(screen.getByText('✓')).toBeInTheDocument())
expect(screen.queryByText('background')).not.toBeInTheDocument()
})
it('labels a sandboxed command with a non-manager provider', () => {
renderWithProviders(
<ToolCallPart part={completedShell({ sandbox: true, sandboxProvider: 'forge' })} messageID="msg_1" />,
)
const badge = screen.getByText('sandbox · forge')
expect(badge).toHaveAttribute('title', 'Executed inside the forge sandbox')
})
it('keeps the plain sandbox label for the manager provider', () => {
renderWithProviders(
<ToolCallPart part={completedShell({ sandbox: true, sandboxProvider: 'ocm' })} messageID="msg_1" />,
)
const badge = screen.getByText('sandbox')
expect(badge).toHaveAttribute('title', 'Executed inside the sandbox microVM')
})
it('keeps the plain sandbox label when no provider is reported', () => {
renderWithProviders(<ToolCallPart part={completedShell({ sandbox: true })} messageID="msg_1" />)
const badge = screen.getByText('sandbox')
expect(badge).toHaveAttribute('title', 'Executed inside the sandbox microVM')
})
})
describe('ToolCallPart open walkthrough action', () => {