mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
* feat(sandbox): add KVM-backed agent sandboxing via microsandbox * feat(sandbox): route host-shell surfaces into microVM via shell wrapper * feat(sandbox): route host-shell surfaces into microVM via shell wrapper * fix(sandbox): harden enforcement validation and backup handling * fix(sandbox): bound lifecycle queue and harden install/backup paths Bound the OpenCode supervisor lifecycle queue to one running plus one pending operation so repeated restarts cannot stack unbounded HTTP requests, while exempting stop() so shutdown is never dropped. Reject enforcement backups that carry no recoverable removed sections, matching the existing fail-closed handling of unparseable backups. Install OpenCode through a private mktemp staging directory instead of the predictable /tmp/opencode path. Use named path/os imports in the files added by this branch. * refactor(sandbox): remove OpenCode version allowlist gating under enforcement * fix(settings): use resolved opencode binary and verify installed version * refactor(sandbox): scope enforcement to agent bash tool only * fix(sandbox): plan bash against factory directory and attest runtime tmpfs; align permission reply API * fix(sandbox): pin neutral entrypoint and persist opencode upgrades across rebuilds * fix(sandbox): align canonical spec with msb 0.6.8 runtime defaults * feat(sandbox): show unwrapped sandboxed bash commands in message UI * refactor(sandbox): pin shell shim to sandbox agent bash without rewriting commands * feat(sandbox): route notifications through a host-side manager tool * feat(sandbox): route all assistant capabilities through the ocm tool Add an allow-listed request action to the generated ocm plugin so agents reach settings, assistant reload, repos, git-info, workspaces, and schedules through the tool instead of curling the internal API with a bearer token, which is impossible under sandboxing. Rewrite the curl-based skills to use the ocm request action and drop the apiBaseUrl plumbing. Remove the now-unread .opencode/internal-token file and the sandbox tmpfs mask that hid it; attestation now rejects any tmpfs other than the runtime /tmp mount. * fix(sidebar): wire new-session and new-schedule actions to every page AssistantRedirect never registered a listener for the sidebar's new-session event, so the desktop sidebar CTA on /assistant was a no-op; the Schedules pages had the same gap for new-schedule. Make useSidebarAction the single source of truth for action keys and event dispatch, and warn when an action is dispatched with no mounted handler so an unhandled CTA fails loudly instead of silently. Wire the missing listeners to the existing per-page handlers. * feat(sandbox): forward git credentials into the microVM and add sandbox guest image * feat(sandbox): add git credential forwarding toggle to settings
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { executeCommand } from '../../src/utils/process'
|
|
|
|
describe('executeCommand signal handling', () => {
|
|
it('reports a signal-terminated child as a non-zero exit code when exit codes are ignored', async () => {
|
|
const result = await executeCommand(['sh', '-c', 'kill -KILL $$'], {
|
|
ignoreExitCode: true,
|
|
silent: true,
|
|
})
|
|
const structured = typeof result === 'string' ? { exitCode: 0, stdout: result, stderr: '' } : result
|
|
|
|
expect(structured.exitCode).not.toBe(0)
|
|
expect(structured.stderr).toContain('Command terminated by signal SIGKILL')
|
|
})
|
|
|
|
it('rejects a signal-terminated child when exit codes are enforced', async () => {
|
|
await expect(executeCommand(['sh', '-c', 'kill -KILL $$'], { silent: true })).rejects.toThrow(
|
|
'Command failed with signal SIGKILL',
|
|
)
|
|
})
|
|
|
|
it('resolves a zero exit code as success when exit codes are ignored', async () => {
|
|
const result = await executeCommand(['sh', '-c', 'true'], { ignoreExitCode: true, silent: true })
|
|
|
|
expect(result).toEqual({ exitCode: 0, stdout: '', stderr: '' })
|
|
})
|
|
})
|