Skip to content

Phase 2 — uf sandbox: match the image's opencode major to the host, fail clearly on a mismatch #1180

Open

Description

@jflowers

Umbrella: #797
Phase: 2 — Scaffold & installer (alongside #801)

Problem

uf sandbox runs opencode serve --port 4096 inside quay.io/unbound-force/opencode-dev:latest (internal/sandbox/config.go DefaultImage) and connects from the host with opencode attach <url> (internal/sandbox/podman.go, internal/sandbox/devpod.go). The server API and clients are one of v2's breaking changes, so the host's opencode and the container's must be the same major version. Today nothing checks that, and the image tag is :latest with an unpinned opencode inside (fixed by the containerfile issue linked from #797).

#801 checks the devcontainer's opencode serve flags; this issue covers the sandbox command itself.

Scope

  • Read the host's opencode major (opencode --version) and choose the matching image tag (:v1 / :v2) by default; an explicit --image still wins.
  • Before attach, compare the host's version with the server's (image label or health endpoint) and fail with a clear message on a mismatch instead of an obscure attach error.
  • Check opencode serve / attach flags and the health-check endpoint under v2.
  • Port collisions: the sandbox binds host port 4096. During Phase 4 — Dogfood: org switches binaries to OpenCode v2 #806 two users on one host (v1 and ocv2) can run sandboxes at once; pick a free port (or fall back to one) instead of failing, and report which port is used.
  • Tests for both majors, plus the mismatch error.
  • uf doctor: report the host opencode major and the sandbox image it maps to.

Done when

uf sandbox works from a v1 host and from a v2 host with no flags, and a mismatched pair fails early with a message naming both versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementopencode-v2-migration

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions