spec: runtime-neutral OpenCode instance lifecycle (#376) #388

Closed
opened 2026-07-19 10:30:55 +02:00 by dries · 0 comments
Owner

Spec for #376 (parent epic #375). Full document: spec/runtime-neutral-lifecycle/requirements.md.

Summary

Make ocman the authoritative, runtime-neutral owner of each managed project OpenCode instance, replacing the tmux+lsof+random-port lifecycle with:

  • internal/ocruntime Runtime interface (Launch(spec)→Instance, Probe, Stop) — one interface, native-tmux impl now, container plugs in via #375.
  • Ocman-allocated ports (bind→close→--port N); managed path drops lsof.
  • Health = GET /config 200, not listener presence.
  • Persisted state.db registry with probe-on-recovery (never trust stale port/PID).
  • singleflight per repo root for at-most-one concurrent launch.
  • Reshaped EnsureProjectOpencodeResult (Endpoint URL + opaque Instance; tmux → observability).
  • RestartProjectOpencode on hostsvc.Host, owner-routed.
  • HostCaps.OpencodeLaunch split from Tmux.
  • Auth-shaped empty secret seam reserved for #377 (kept separate).

Primary seam: hostsvc.Host.EnsureProjectOpencode (reshaped result, hardened body). Native tmux stays behaviorally compatible (AC-9).

Next: break into tracer-bullet tickets (to-tickets).

Spec for #376 (parent epic #375). Full document: `spec/runtime-neutral-lifecycle/requirements.md`. ## Summary Make ocman the authoritative, runtime-neutral owner of each managed project OpenCode instance, replacing the tmux+`lsof`+random-port lifecycle with: - **`internal/ocruntime` `Runtime` interface** (`Launch(spec)→Instance`, `Probe`, `Stop`) — one interface, native-tmux impl now, container plugs in via #375. - **Ocman-allocated ports** (bind→close→`--port N`); managed path drops `lsof`. - **Health = `GET /config` 200**, not listener presence. - **Persisted `state.db` registry** with **probe-on-recovery** (never trust stale port/PID). - **`singleflight` per repo root** for at-most-one concurrent launch. - **Reshaped `EnsureProjectOpencodeResult`** (`Endpoint` URL + opaque `Instance`; tmux → observability). - **`RestartProjectOpencode`** on `hostsvc.Host`, owner-routed. - **`HostCaps.OpencodeLaunch`** split from `Tmux`. - Auth-shaped **empty `secret`** seam reserved for #377 (kept separate). Primary seam: `hostsvc.Host.EnsureProjectOpencode` (reshaped result, hardened body). Native tmux stays behaviorally compatible (AC-9). Next: break into tracer-bullet tickets (`to-tickets`).
dries closed this issue 2026-07-19 18:10:57 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dries/ocman#388
No description provided.