Skip to content

feat: extend uf sandbox with create/destroy lifecycle and CDE backend #95

Closed

Description

@jflowers

Context

Spec 028 delivered uf sandbox with start/stop/attach/extract/status for local Podman containers. However, the iterative demo loop workflow (/unleash → demo → /speckit.clarify → repeat) requires persistent workspaces that survive across OpenCode sessions and /unleash runs.

The current start/stop model is ephemeral — stop removes the container and all state. This forces the engineer through an extract/apply/recompile cycle on every iteration, breaking the tight feedback loop.

CDE (Eclipse Che / Red Hat Dev Spaces) is the primary workflow for this demo loop, not an optional deployment target. The Che workspace persists, the engineer reviews demos inside the Che IDE, and changes flow bidirectionally via git — no extraction needed.

Depends on: Spec 028 (closed, shipped), containerfile#1 (closed, shipped)
Related: Discussion #88

New Lifecycle Model

uf sandbox create    \u2192 provision persistent workspace
uf sandbox start     \u2192 start a stopped workspace
uf sandbox stop      \u2192 stop workspace (preserve state)
uf sandbox destroy   \u2192 tear down + delete all state
uf sandbox attach    \u2192 connect opencode TUI (existing)
uf sandbox status    \u2192 show state (existing)
uf sandbox extract   \u2192 Podman fallback only (existing)

Current (Spec 028) vs Proposed

Aspect Current Proposed
Lifecycle start (create+run), stop (stop+remove) create/start/stop/destroy
Persistence None — container deleted on stop State survives stop/start cycles
Backend Podman only Podman + CDE (Eclipse Che / Dev Spaces)
Source sync Volume mount (Podman) or extract (isolated) Bidirectional git (CDE)
Demo Host terminal only Che IDE: terminal tab + browser tab + API endpoints

The Demo Loop (Why This Matters)

1. uf sandbox create          \u2192 provision workspace (once)
2. uf sandbox attach          \u2192 opencode TUI on host
3. /unleash                   \u2192 agent implements to demo step
4. Human opens Che IDE:
   - Views files in editor
   - Runs CLI in terminal tab
   - Opens web app in browser tab
   - Tests API via curl
5. Human decides: "change X"
6. Human edits spec in Che IDE (git push)
   OR runs /speckit.clarify in opencode TUI
7. /unleash resumes from clarify
8. Human demos again (step 4)
9. Repeat until approved
10. /finale \u2192 merge

No extraction. No recompilation on host. No context loss between iterations. The workspace persists with Dewey index, Replicator state, git history, and compiled binaries intact.

CDE Backend Requirements

Workspace Provisioning

  • uf sandbox create --backend che provisions a Che workspace from the devfile
  • Factory URL or dashboard API for workspace creation
  • Workspace uses Che PVC for source code (not host volume mount)
  • Git bidirectional sync: engineer pushes from host or Che IDE, agent pushes from workspace

Dual Access Paths

  • opencode TUI: Engineer runs uf sandbox attach from host terminal \u2192 connects to opencode serve in the workspace
  • Che IDE: Engineer opens browser \u2192 views/edits files, runs terminal commands, demos web apps via exposed endpoints

Demo Support

  • CLI/TUI demos: Che IDE terminal tab
  • Web app demos: Exposed endpoint in additional browser tab
  • API demos: Exposed endpoint accessible via curl from Che terminal or host

Persistence

  • Workspace survives across:
    • Multiple /unleash runs
    • Multiple OpenCode sessions (detach/reattach)
    • stop/start cycles
    • Sleep/wake
  • Only destroy removes the workspace and its state

Platform Support

  • Eclipse Che (open source, self-hosted)
  • Red Hat OpenShift Dev Spaces (enterprise, managed)

Ollama Connectivity in CDE

host.containers.internal (Podman-specific) does not work in Kubernetes. The Ollama endpoint needs to be:

  • A Kubernetes service (if Ollama runs as a sidecar or separate pod)
  • An external URL (if Ollama runs outside the cluster)
  • Configurable via DEWEY_EMBEDDING_ENDPOINT env var in the devfile

API Key Management in CDE

  • Che user preferences for secret injection
  • Kubernetes secrets mounted as env vars in the workspace pod
  • GOOGLE_CLOUD_PROJECT, VERTEX_LOCATION, GOOGLE_APPLICATION_CREDENTIALS via K8s secrets

Scope

This is a Speckit strategic spec (029) — new backend architecture, new CLI verbs, CDE integration, persistence model.

Files Affected

Area Changes
internal/sandbox/ Add Create(), Destroy() functions. Refactor Start()/Stop() for persistence. Add CDE backend interface.
cmd/unbound-force/sandbox.go Add create, destroy subcommands. Add --backend flag (podman/che).
internal/sandbox/backends/ New: podman.go (extract current logic), che.go (new CDE backend)
Containerfile repo May need devfile updates for endpoint exposure, git sync

Open Questions

  1. Should --backend default to podman (current behavior) or auto-detect if Che is available?
  2. Should uf sandbox create accept a devfile path/URL or always use the one from the containerfile repo?
  3. How should git conflicts be handled when both engineer and agent push to the same branch?
  4. Should the Podman backend also support create/destroy (persistent named volumes) or stay ephemeral?
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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions