Skip to content

Creating backend abstraction for self hosted worker #29

Open
ianhodge wants to merge 3 commits intomainfrom
03-10-ian_creating_backend_abstraction_for_self_hosted_worker
Open

Creating backend abstraction for self hosted worker #29
ianhodge wants to merge 3 commits intomainfrom
03-10-ian_creating_backend_abstraction_for_self_hosted_worker

Conversation

@ianhodge
Copy link
Member

@ianhodge ianhodge commented Mar 10, 2026

What

Pure refactor: introduces a Backend interface and extracts all Docker logic from worker.go into a separate DockerBackend implementation. No behavior change.

Changes

  • internal/worker/backend.go — New Backend interface with ExecuteTask and Shutdown methods
  • internal/worker/docker.goDockerBackend struct with all Docker-specific logic extracted from worker.go (image pulling, sidecar management, container lifecycle, registry auth, etc.)
  • internal/worker/worker.go — Slimmed down: Worker struct now holds a backend Backend field instead of dockerClient/platform. New() creates a DockerBackend, executeTask delegates to w.backend.ExecuteTask(), Shutdown calls w.backend.Shutdown()

Testing

  • Builds clean (go build ./...)
  • Manually verified against staging — worker connects, receives task assignments, and executes them in Docker identically to before

Overall plan: non-containerized self-hosted agents

This PR is 1 of 3 to add direct (non-Docker) execution support:

  1. PR 1 (this PR): Backend interface + Docker extraction — pure refactor to enable the next two PRs
  2. PR 2: YAML config file support (--config-file) — adds gopkg.in/yaml.v3, config parsing/merging for worker_id, cleanup, docker.volumes, docker.environment
  3. PR 3: Direct backend (--backend direct) — runs agents directly on the host via the Oz CLI, with setup/teardown scripts, per-agent workspace directories, and environment file injection

Co-Authored-By: Oz oz-agent@warp.dev

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ianhodge ianhodge changed the title ian/creating_backend_abstraction_for_self_hosted_worker Backend interface + Docker extraction for direct backend support Mar 10, 2026
@ianhodge ianhodge changed the title Backend interface + Docker extraction for direct backend support Creating backend abstraction for self hosted worker Mar 10, 2026
@ianhodge ianhodge requested a review from bnavetta March 10, 2026 22:39
@ianhodge ianhodge marked this pull request as ready for review March 10, 2026 22:39
ianhodge and others added 2 commits March 13, 2026 10:34
Introduces a TaskParams struct that decouples the Backend interface from
the wire-format TaskAssignmentMessage. Common concerns (resolving env
vars, default Docker image, base CLI args) are now handled by
worker.prepareTaskParams() rather than individual backend implementations.

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants