Creating backend abstraction for self hosted worker #29
Open
Creating backend abstraction for self hosted worker #29
Conversation
bnavetta
reviewed
Mar 11, 2026
| // Backend defines the interface for task execution backends. | ||
| type Backend interface { | ||
| // ExecuteTask runs the agent for the given task assignment. | ||
| ExecuteTask(ctx context.Context, assignment *types.TaskAssignmentMessage) error |
Collaborator
There was a problem hiding this comment.
I think we should have a slight layer of abstraction between the TaskAssignmentMessage and the backend interface.
There are a couple common concerns we shouldn't have to handle in the backend implementations:
- Resolving common environment variables, like the Git config below
- Choosing a default Docker image (even if some backends will ignore this)
- Determining the base CLI args (even if the full command is backend-specific)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Pure refactor: introduces a
Backendinterface and extracts all Docker logic fromworker.gointo a separateDockerBackendimplementation. No behavior change.Changes
internal/worker/backend.go— NewBackendinterface withExecuteTaskandShutdownmethodsinternal/worker/docker.go—DockerBackendstruct with all Docker-specific logic extracted fromworker.go(image pulling, sidecar management, container lifecycle, registry auth, etc.)internal/worker/worker.go— Slimmed down:Workerstruct now holds abackend Backendfield instead ofdockerClient/platform.New()creates aDockerBackend,executeTaskdelegates tow.backend.ExecuteTask(),Shutdowncallsw.backend.Shutdown()Testing
go build ./...)Overall plan: non-containerized self-hosted agents
This PR is 1 of 3 to add direct (non-Docker) execution support:
--config-file) — addsgopkg.in/yaml.v3, config parsing/merging forworker_id,cleanup,docker.volumes,docker.environment--backend direct) — runs agents directly on the host via the Oz CLI, with setup/teardown scripts, per-agent workspace directories, and environment file injectionCo-Authored-By: Oz oz-agent@warp.dev