Repository navigation
fix(sandbox): support Clearwing workspace transfer on Kubernetes - #238
Open
jorge-garcia-le wants to merge 3 commits into
Open
jorge-garcia-le wants to merge 3 commits into
jorge-garcia-le wants to merge 3 commits into
Conversation
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.
Why this is needed
Clearwing’s workspace setup was built around Docker sandbox behavior. With Docker, a read-only source workspace can be exposed through a host-path bind mount, and the client can signal EOF after streaming an archive. Neither assumption holds for the Kubernetes backend.
A Kubernetes pod cannot mount an arbitrary path from the process that launched it. The Dagster worker’s workspace is inside a different pod, so it must be copied into the sandbox pod. The Kubernetes Python WSClient also supports writing stdin but has no half-close operation, so archive transfer must terminate by consuming a known byte count.
The Kubernetes backend additionally imposed
activeDeadlineSeconds = max(900, command_timeout * 3). With the default command timeout, Kubernetes killed the entire sandbox after 15 minutes even when the enclosing SourceHunt had a multi-hour timeout. Error paths during workspace transfer could also leave pods behind, and a hard worker crash could bypass Python cleanup completely.Summary
activeDeadlineSeconds; retain per-command and outer SourceHunt timeoutsVerification
.venv/bin/pytest -q tests/test_kubernetes_sandbox.py tests/test_hunter_sandbox.py— 34 passed.venv/bin/ruff check clearwing/sandbox/kubernetes.py clearwing/sandbox/hunter_sandbox.py tests/test_kubernetes_sandbox.py— passedgit diff --check— passedcvehunt_experimentrunLatest lifecycle hardening commit:
afd79ea.