persisted managed-instance registry + probe-on-recovery (#376) #391

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

Parent

#388 (spec), #376. Spec AD-5.

What to build

Persist each managed project instance so it survives an ocman restart, but never trust a persisted row without re-verifying health.

  • state.db migration: a managed_opencode table keyed by canonical repo root, storing endpoint/port, pid, kind, runtime id, launched_at.
  • A small store type injected into local.Host (matches the existing dep-injection pattern).
  • EnsureProjectOpencode reads the persisted row and always re-probes (Runtime.Probe) before trusting it. Healthy → reuse (no launch). Dead → discard the row + relaunch. On launch, persist/update the row.

Acceptance criteria

  • Migration creates the table on a fresh state.db and is idempotent on an existing one.
  • A launched managed instance is persisted (repo root, port, pid, kind, runtime id, launched_at).
  • After an ocman restart (fresh Host, existing row): a probe-healthy row is reused with no relaunch.
  • A probe-dead persisted row is discarded and the project relaunches — stale port/pid never trusted.
  • Store round-trip + recovery (healthy-reuse / dead-relaunch) tests. Recovery paths proven red→green.

Blocked by

  • #390 (reshape ensure seam + hardened body)
## Parent #388 (spec), #376. Spec AD-5. ## What to build Persist each managed project instance so it survives an ocman restart, but never trust a persisted row without re-verifying health. - `state.db` migration: a `managed_opencode` table keyed by canonical repo root, storing endpoint/port, pid, kind, runtime id, launched_at. - A small store type injected into `local.Host` (matches the existing dep-injection pattern). - `EnsureProjectOpencode` reads the persisted row and **always re-probes** (`Runtime.Probe`) before trusting it. Healthy → reuse (no launch). Dead → discard the row + relaunch. On launch, persist/update the row. ## Acceptance criteria - [ ] Migration creates the table on a fresh `state.db` and is idempotent on an existing one. - [ ] A launched managed instance is persisted (repo root, port, pid, kind, runtime id, launched_at). - [ ] After an ocman restart (fresh Host, existing row): a probe-healthy row is reused with no relaunch. - [ ] A probe-dead persisted row is discarded and the project relaunches — stale port/pid never trusted. - [ ] Store round-trip + recovery (healthy-reuse / dead-relaunch) tests. Recovery paths proven red→green. ## Blocked by - #390 (reshape ensure seam + hardened body)
dries closed this issue 2026-07-19 18:10:58 +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#391
No description provided.