fix: update live-connection hint for managed opencode #395

Merged
dries merged 9 commits from fix-live-connection-hint into main 2026-07-19 18:08:23 +02:00
Owner

The composer showed a stale opencode --port 0 message, but ocman now launches and manages the OpenCode instance per project itself. Updated the user-facing LiveConnectionHint and the two doc-comment references.

The composer showed a stale `opencode --port 0` message, but ocman now launches and manages the OpenCode instance per project itself. Updated the user-facing `LiveConnectionHint` and the two doc-comment references.
Introduce internal/ocruntime abstracting how a project's OpenCode
instance is hosted (Runtime interface + native-tmux implementation).
The native runtime launches opencode on an ocman-allocated port,
probes GET /config for health, and stops the tmux session. Adds
port-threading tmux launch seams (OpencodeCommandForPort,
LaunchOpencodeCmdEnvWith) without changing existing launchers.

Plug point for the container runtime in epic #375. Refs #389, #376.
Reshape the ensure seam so all callers get a reachable endpoint + opaque
instance instead of a discovered port + tmux name, and drive the managed
lifecycle through ocruntime.Runtime instead of lsof discovery.

- EnsureProjectOpencodeResult -> {Endpoint, RepoRoot, Runtime, Launched}
  with a Port() accessor for callers that still thread a raw port.
- local.Host holds an injected ocruntime.Runtime (default native tmux) +
  a singleflight.Group and an in-memory managed-instance registry
  (persistence is #391).
- EnsureProjectOpencode body: singleflight(repoRoot) -> reuse when Probe
  reports healthy -> else allocate port, Launch, wait-for-Probe. The
  managed path no longer depends on lsof; health verifies the OpenCode
  API, not listener presence.
- Add HostCaps.OpencodeLaunch, distinct from Tmux, surfaced via
  /api/capabilities.
- Update all callers (worktree create, MCP ensurer, server wiring, remote
  host + stubs) and reshape the ensure/host tests to a fake-Runtime model
  (concurrency, reuse, stale-relaunch, health-timeout).
Stops a project's tracked managed opencode instance then re-ensures it,
launching a fresh one. Runs under the same singleflight key as ensure
(via the inner restartLocked body, avoiding an sf.Do-in-sf.Do deadlock),
soft-fails on Stop and store.Delete, and clears both the in-memory cache
and the persisted store row before relaunch. Routed via Router.ForDir and
marshaled across the remote gRPC JSON seam like EnsureProjectOpencode.

Refs #392 #376
Refs #394 #376.
fix: update live-connection hint for managed opencode
Some checks failed
CI / Backend (pull_request) Failing after 1m52s
CI / Build Desktop (macOS arm64) (pull_request) Successful in 1m57s
CI / Frontend (pull_request) Has been cancelled
CI / Playwright E2E (pull_request) Has been cancelled
CI / Build (pull_request) Has been cancelled
CI / Coverage Results (pull_request) Has been cancelled
CI / Semantic Tag (pull_request) Has been cancelled
11f25baf12
test: drop redundant rune conversions to satisfy unconvert lint
Some checks failed
CI / Build Desktop (macOS arm64) (pull_request) Successful in 1m53s
CI / Frontend (pull_request) Successful in 6m40s
CI / Backend (pull_request) Successful in 9m10s
CI / Coverage Results (pull_request) Successful in 23s
CI / Build (pull_request) Successful in 3m53s
CI / Playwright E2E (pull_request) Failing after 4m42s
CI / Semantic Tag (pull_request) Has been skipped
2f6b631ff3

Coverage ratchet: pass

Suite Baseline This PR Δ
frontend 66.04% 66.06% +0.02
go 77.50% 77.50% +0.00

Tolerance: -0.1%. Baseline stored on gh-pages.

<!-- coverage-ratchet --> ### Coverage ratchet: ✅ pass | Suite | Baseline | This PR | Δ | | |---|---|---|---|---| | frontend | 66.04% | 66.06% | +0.02 | ✅ | | go | 77.50% | 77.50% | +0.00 | ✅ | _Tolerance: -0.1%. Baseline stored on `gh-pages`._
test(e2e): seed opencodeLaunch host capability in fixtures
All checks were successful
CI / Build Desktop (macOS arm64) (pull_request) Successful in 1m52s
CI / Backend (pull_request) Successful in 4m8s
CI / Frontend (pull_request) Successful in 5m32s
CI / Coverage Results (pull_request) Successful in 29s
CI / Playwright E2E (pull_request) Successful in 7m38s
CI / Build (pull_request) Successful in 3m50s
CI / Semantic Tag (pull_request) Successful in 5s
18db68ffcf
dries merged commit 39cf7a515a into main 2026-07-19 18:08:23 +02:00
Sign in to join this conversation.
No description provided.