feat(sandbox): route host-shell surfaces into microVM via shell wrapper

This commit is contained in:
Chris Scott committed 2026-08-14 18:26:21 -04:00
1 parent aa3fb48a62
commit ae117d6a78
57 files changed
+711 -784

No files matched your search

@@ -13,6 +13,7 @@ vi.mock('../../src/services/opencode-single-server', () => ({
import {
restartOpenCode,
restartOpenCodeAfterCommit,
setOpenCodeRestartCoordinator,
} from '../../src/services/opencode-restart'
import type { OpenCodeRestartCoordinator } from '../../src/services/opencode-restart-coordinator'
@@ -91,3 +92,29 @@ describe('restartOpenCode', () => {
expect(managerMock.clearStartupError).toHaveBeenCalled()
})
})
describe('restartOpenCodeAfterCommit', () => {
beforeEach(() => {
vi.clearAllMocks()
setOpenCodeRestartCoordinator(null)
})
afterEach(() => {
setOpenCodeRestartCoordinator(null)
})
it('reports success without a restart error when the restart completes', async () => {
managerMock.checkHealth.mockReturnValue(true)
await expect(restartOpenCodeAfterCommit(createSupervisor(true))).resolves.toEqual({ restartFailed: false })
})
it('reports the failure instead of throwing so the caller can still return the persisted entity', async () => {
managerMock.getLastStartupError.mockReturnValue('OpenCode health check failed')
const result = await restartOpenCodeAfterCommit(createSupervisor(false))
expect(result.restartFailed).toBe(true)
expect(result.restartError).toBe('OpenCode health check failed')
})
})