Managed OpenCode server hosts¶
Open Cowork runs a managed OpenCode server as a child process. Two host entrypoints share the same core (runtime-managed-server-core) and differ only in how the supervisor is forked.
When each host is used¶
| Host | Module | Process model | Used by |
|---|---|---|---|
| Electron utilityProcess | packages/runtime-host/src/runtime-managed-server.ts | Electron utilityProcess.fork | Desktop main process |
| Node child_process | packages/runtime-host/src/runtime-node-managed-server.ts | child_process.fork | Cloud worker / non-Electron runtimes |
Shared:
runtime-managed-server-core.ts— lifecycle, protocol, restart policyruntime-managed-server-protocol.ts— parent/supervisor messagesruntime-managed-server-output.ts— log tail helpersruntime-managed-server-supervisor.ts— supervisor entry
Drift control (JOE-869)¶
- Keep the split — Electron utilityProcess isolation is intentional for desktop; cloud must not depend on Electron APIs.
- Maximize shared core tests — behavior changes land in core + shared tests; host modules stay thin fork adapters.
- Do not reimplement restart/protocol logic in either host module.
Desktop injects the utilityProcess forker at startup via setManagedOpencodeSupervisorForker. Cloud uses the Node host factory directly.