Commit Graph
55 Commits
Author SHA1 Message Date
sam 7dbb17a4cb feat: pluggable storage backends with Docker volumes and /data/ layout
Introduces the storage.Backend interface for pluggable container mount
management. The Docker implementation (DockerBackend) is the MVP —
no NFS/SMB/S3, just Docker volumes + bind mounts.

/data/ volume layout:
  /data/worktree/  — bind mount of host worktree (always)
  /data/repo/      — per-repo Docker volume (when persistent_storage = true)
  /data/cache/go/  — shared GOMODCACHE volume
  /data/cache/node/— shared npm cache volume
  /data/cache/pnpm/— shared pnpm store volume
  /data/cache/pip/ — shared pip cache volume
  /data/cache/cargo/— shared Rust cargo cache volume
  /data/task.json  — boot-time brief (existing WriteTaskJSON)

Changes:
- internal/storage/: Backend interface, DockerBackend, Mount types,
  ecosystem-to-cache-volume mapping, ConvertMounts helper
- container.Pool.Acquire: now accepts []storage.Mount instead of
  hardcoding a single bind mount — mount list comes from the storage
  backend
- daemon.process(): calls d.Storage.Setup() to build the mount list,
  passes Ecosystem + PersistentStorage from repo config
- config.Repo.PersistentStorage: when true, a named Docker volume
  (archie-repo-<owner>-<repo>) is mounted at /data/repo and survives
  task completion
- main.go: creates DockerBackend when containers are enabled

21 tests: interface contract, ecosystem cache mounts (go/node/
python/rust/custom), worktree bind mount ordering, persistent
storage on/off/empty-owner guard, mount list sort+dedup, adversarial
(nonexistent worktree, empty ecosystem, unknown ecosystem).

Why: daemon-managed cache volumes mean warm GOMODCACHE/npm cache
across tasks. Per-repo persistent volumes preserve expensive build
artifacts. The interface leaves room for future backends without
rewiring container orchestration.
2026-07-22 04:28:30 +10:00
sam 4edad31b66 fix: wire dead code — GracePeriod, task.json, plugin specs
GracePeriod now enforced in Release(): if > 0, container stays alive
for the configured duration after task completion before being killed,
per PRD section 1.

WriteTaskJSON now called from daemon.process() before container
Acquire, writing the task payload to <workspace>/task.json per
PRD section 3 /data/ layout.

PluginSpecs populated from TaskContext.SkillPlugins into the
Request sent to the agent. PluginSpec type added to protocol.go.
pluginSpecs() converts skill.Plugin → agentexec.PluginSpec for
transport. PRD section 5 Layer 1.
2026-07-22 03:31:27 +10:00
sam fab7a0ae6f feat: close Gaps 2, 6, and 8
Gap 8 (frontmatter plugins key): add Plugins []string to
Metadata.Archie struct. Parses the plugins list from SKILL.md
YAML frontmatter per PRD section 5.

Gap 2 (grace period): add GracePeriod field to container.Config,
distinct from MaxUptime. MaxUptime = total container lifetime cap.
GracePeriod = idle time after task completion before kill.
Documented per PRD sections 1 and 4.

Gap 6 (task.json): add TaskPayload struct and WriteTaskJSON
function to internal/container. Daemon writes the task payload
to <workspace>/task.json before container start, matching the
PRD section 3 /data/task.json boot brief.
2026-07-22 03:25:44 +10:00
sam c8b22aeb8e fix: three quick-wins to close PRD gaps
Gap 2 (MaxUptime): container created with context deadline when
MaxUptime > 0 — Docker kills the container on expiry.

Gap 6 (/data/ volume): mount worktree at /data/worktree instead of
/workspace, matching PRD section 3 volume layout.

Gap 4 (per-task subjects): change SubjectForAgentRequest from per-stage
(archie.agent.<id>.<stage>) to per-task (archie.agent.<id>.request).
Stage name is carried in the AgentRequestMessage payload. PRD section 2.
2026-07-22 02:57:41 +10:00
sam de57f72cce feat: add Docker container sandbox for archie-agent
Dockerfile: multi-stage fat image (golang:1.26 builder → ubuntu:24.04)
with Go 1.26, Python 3.12/3.13 via deadsnakes, UV, Node 22, pnpm,
TypeScript, esbuild, git, gh, golangci-lint, gofumpt.

Container pool (internal/container): manages Docker container lifecycle
via moby/moby client. Per-task containers with bind-mounted workspaces.

- Acquire: create, start, mount workspace, inject NATS + API key env
- Release: stop, remove (AutoRemove as safety net)
- Orphan recovery on daemon startup (label: archie-daemon=true)
- MaxConcurrency enforcement, MaxUptime config (unused in MVP)
- Image pull with "missing"/"always" policy

Config: [containers] block (enabled, image, max_concurrency, max_uptime,
pull_policy). Validation: requires agent.mode = "nats" and [nats] url.

Daemon: acquires container before workflow.Run, releases after.
Container environment auto-populated from provider API keys.
2026-07-22 02:39:17 +10:00