fix(delivery): clean up agent delivery volumes on workspace deletion#266
Merged
Conversation
✅ Deploy Preview for devsydev canceled.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR adds configurable helper image support to the Docker-based agent delivery system. A new ChangesHelper Image Configuration and Delivery
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…elivery Introduces a pluggable delivery strategy that replaces the monolithic inject.sh handshake with phase-aware delivery methods, eliminating race conditions identified in DEVSY-082. Three implementations: - LocalDockerDelivery: named volume pre-placement before container start - RemoteDockerDelivery: docker cp post-start for remote daemons - LegacyShellDelivery: wraps existing inject.sh path for custom drivers Includes factory, integration into setup.go/single.go, and E2E tests.
The existing up-* tests already exercise the delivery path through setupContainer → injectAgentIntoContainer. No need for separate tests.
Delete() now calls cleanupDeliveryVolume() after container removal,
which invokes the delivery strategy's Cleanup() method to remove
orphaned devsy-agent-{workspaceID} volumes. Cleanup is best-effort:
errors are logged but never fail the delete operation.
deleteForRecreate() inherits this fix via its existing call to Delete().
When a container is already absent (externally deleted or crashed), Delete() returned early before reaching the cleanup call. Using defer ensures cleanupDeliveryVolume() runs regardless of whether the container exists, preventing orphaned volumes in that scenario.
…oconst lint Resolves golangci-lint goconst violations in delete_test.go.
HelperImage field in ProviderDockerDriverConfig is threaded through FactoryOptions to LocalDockerDelivery. populateVolume() tries the configured helper container first (defaulting to busybox:latest), then falls back to writing the binary directly to the Docker volume mountpoint on the local filesystem. The direct-copy fallback is safe because LocalDockerDelivery is only used when Docker is local.
Fixes consumed io.Reader bug: binary data is now read once into a byte slice, then a fresh bytes.NewReader is passed to the helper container attempt. populateVolumeDirectCopy accepts []byte directly. Adds behavioral test for the fallback path using a fake docker script that fails on 'run' but returns a temp dir on 'volume inspect', verifying the binary lands with correct content and 0755 permissions.
skevetter
force-pushed
the
f5d9-cf0b-ws-a-local-docker
branch
from
May 12, 2026 21:53
c17c38b to
9133d8d
Compare
skevetter
marked this pull request as ready for review
May 12, 2026 23:00
This was referenced May 16, 2026
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.
Summary
cleanupDeliveryVolume()deferto ensure cleanup runs even when the container is already absentdeleteForRecreate()inherits cleanup through its existingDelete()callSummary by CodeRabbit
Release Notes