Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-sandbox): use pool template for Fleet claims (#2530)

r33drichards562912531291
diff --git a/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py b/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py
index 633d85cba3..f3c92001df 100644
--- a/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py
+++ b/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py
@@ -18,7 +18,6 @@ from cua_sandbox.image import Image
from cua_sandbox.transport.cyclops_http_client import CyclopsHttpClient
from cua_sandbox.transport.fleet import FleetTransport
from cyclops_sdk import (
- ClaimSpec,
CreateClaimRequest,
CreatePoolRequest,
CyclopsClient,
@@ -29,7 +28,6 @@ from cyclops_sdk import (
PoolTemplate,
PreservedJson,
SandboxService,
- SandboxTemplateRef,
ServiceProtocol,
)
@@ -220,17 +218,7 @@ class FleetCloudTransport(FleetTransport):
self._claim = await self._sdk.get_claim(self._pool)
else:
self._claim = await self._sdk.create_claim(
- CreateClaimRequest(
- pool=self._pool,
- spec=ClaimSpec(
- sandbox_template_ref=SandboxTemplateRef(
- name=self._pool.metadata.name
- ),
- warmpool=None,
- bind_deadline=600,
- lifecycle=None,
- ),
- )
+ CreateClaimRequest(pool=self._pool, spec=None)
)
bound = await self._sdk.wait_claim(self._claim)
await self._sdk.wait_service_ready(bound, "server", self._time_to_start)
diff --git a/libs/python/cua-sandbox/tests/test_fleet_cloud_transport.py b/libs/python/cua-sandbox/tests/test_fleet_cloud_transport.py
index f6f79486fa..4bc01962b0 100644
--- a/libs/python/cua-sandbox/tests/test_fleet_cloud_transport.py
+++ b/libs/python/cua-sandbox/tests/test_fleet_cloud_transport.py
@@ -1,5 +1,6 @@
import pytest
from cua_sandbox import Image
+from cua_sandbox.transport import fleet_cloud
from cua_sandbox.transport.fleet_cloud import FleetCloudTransport
from cyclops_sdk import Sandbox
@@ -29,6 +30,37 @@ def test_rejects_unsupported_images(image):
FleetCloudTransport._validate_image(image)
+async def test_connect_uses_generated_pool_template_claim_default(monkeypatch):
+ pool = type("Pool", (), {"metadata": type("Metadata", (), {"name": "demo"})()})()
+ requests = []
+
+ class Client:
+ async def create_pool(self, request):
+ return pool
+
+ async def wait_pool(self, created_pool):
+ return created_pool
+
+ async def create_claim(self, request):
+ requests.append(request)
+ return "claim"
+
+ async def wait_claim(self, claim):
+ return Sandbox(namespace="demo", claim=claim, name="sandbox", services=["server"])
+
+ async def wait_service_ready(self, sandbox, service, time_to_start):
+ assert service == "server"
+
+ client = Client()
+ monkeypatch.setattr(fleet_cloud, "_FleetClient", lambda: client)
+
+ await FleetCloudTransport(image=Image.from_registry("example:latest"), name="demo").connect()
+
+ assert len(requests) == 1
+ assert requests[0].spec is None
+
+
@pytest.mark.asyncio
async def test_cleanup_stops_after_claim_failure():
transport = FleetCloudTransport(image=Image.from_registry("example:latest"), name="demo")