Task container backend: put task containers behind one interface #1864

Open
opened 2026-11-12 04:53:47 +00:00 by sam · 1 comment
Owner

Problem

Daemon.ContainerPool is a concrete *container.Pool, an infrastructure type, rather than a domain interface. The daemon calls Acquire, Release, Reown, ContainerAddrs and HostGateway. The last three expose Docker and host details: Reown chowns a host worktree path, and ContainerAddrs and HostGateway exist only to wire the in-process State Store relay to a Docker bridge. That ties the task flow to one local Docker Engine and spreads Docker concerns through the daemon.

Wanted

A small task.Backend interface in internal/domain: start a task container from an image, env, workspace reference and network policy; wait for it; stop it and hand the workspace back ready to commit. The Docker Engine pool implements it and owns image pulls, the concurrency cap, the reaper, the sandbox network and relay, worktree ownership and endpoint addressing. The daemon holds only the interface.

Only the Docker Engine backend is in scope. Multi-host comes later by adding an existing backend (Kubernetes or Nomad, Docker Cloud Sandboxes, NVIDIA OpenShell) behind the same interface, not by building a node agent or scheduler.

Spec with diagrams: https://claude.ai/artifact/4HdjiJkxpgyEKhPRaT1FiT

Order

  1. #1877: delete Kit, leaving one task path.
  2. #1867: default tasks behind the egress relay, which removes ContainerAddrs, HostGateway and the in-process relay.
  3. #1866: NATS auth callout.
  4. This issue: extract the interface, with no behaviour change.

Done when

  • daemon imports no internal/container type, and holds a domain interface.
  • The interface has no Docker, host-path or container-address types.
  • Reown is part of the backend's stop or hand-back step.
  • A default task runs end to end unchanged.
## Problem `Daemon.ContainerPool` is a concrete `*container.Pool`, an infrastructure type, rather than a domain interface. The daemon calls `Acquire`, `Release`, `Reown`, `ContainerAddrs` and `HostGateway`. The last three expose Docker and host details: `Reown` chowns a host worktree path, and `ContainerAddrs` and `HostGateway` exist only to wire the in-process State Store relay to a Docker bridge. That ties the task flow to one local Docker Engine and spreads Docker concerns through the daemon. ## Wanted A small `task.Backend` interface in `internal/domain`: start a task container from an image, env, workspace reference and network policy; wait for it; stop it and hand the workspace back ready to commit. The Docker Engine pool implements it and owns image pulls, the concurrency cap, the reaper, the sandbox network and relay, worktree ownership and endpoint addressing. The daemon holds only the interface. Only the Docker Engine backend is in scope. Multi-host comes later by adding an existing backend (Kubernetes or Nomad, Docker Cloud Sandboxes, NVIDIA OpenShell) behind the same interface, not by building a node agent or scheduler. Spec with diagrams: https://claude.ai/artifact/4HdjiJkxpgyEKhPRaT1FiT ## Order 1. #1877: delete Kit, leaving one task path. 2. #1867: default tasks behind the egress relay, which removes `ContainerAddrs`, `HostGateway` and the in-process relay. 3. #1866: NATS auth callout. 4. This issue: extract the interface, with no behaviour change. ## Done when - `daemon` imports no `internal/container` type, and holds a domain interface. - The interface has no Docker, host-path or container-address types. - `Reown` is part of the backend's stop or hand-back step. - A default task runs end to end unchanged.
sam added a new dependency 2026-11-12 09:35:22 +00:00
sam changed title from Worker nodes: run task sandboxes on more than one host to Task container backend: put task containers behind one interface 2026-11-12 09:53:51 +00:00
sam added a new dependency 2026-11-12 09:54:04 +00:00
Author
Owner

Decided:

  1. Backend per instance. One backend is live at a time.
  2. Workspace by shallow clone from source. The worker shallow-clones the task branch inside the container. The forge read credential is injected by the egress proxy (sentinel in the container, clone-only, scoped to the repository, revoked with the run). Changes return to the daemon as a git bundle; the daemon checks protected paths, commits and pushes as today. The host worktree bind mount and Reown go, and the Docker backend uses the same path.

The workspace part needs its own issue once #1867 lands, since it changes how every task gets its code.


Generated by Claude Code

Decided: 1. **Backend per instance.** One backend is live at a time. 2. **Workspace by shallow clone from source.** The worker shallow-clones the task branch inside the container. The forge read credential is injected by the egress proxy (sentinel in the container, clone-only, scoped to the repository, revoked with the run). Changes return to the daemon as a git bundle; the daemon checks protected paths, commits and pushes as today. The host worktree bind mount and `Reown` go, and the Docker backend uses the same path. The workspace part needs its own issue once #1867 lands, since it changes how every task gets its code. --- _Generated by [Claude Code](https://claude.ai/code)_
sam added the mediumfeature labels 2026-11-12 15:51:30 +00:00
sam added the deferred label 2026-11-15 17:26:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1864