Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(sandbox): keep Image file sizes JSON-safe (#3839)
r33drichards1d6e81ea513a
diff --git a/clusters/base/cua-images/crd.yaml b/clusters/base/cua-images/crd.yamlindex e7794059df..3dfb91ce02 100644--- a/clusters/base/cua-images/crd.yaml+++ b/clusters/base/cua-images/crd.yaml@@ -197,7 +197,7 @@ spec:type: integerformat: int64minimum: 0- maximum: 9223372036854775807+ maximum: 9007199254740991destination:type: stringpattern: ^/.*diff --git a/libs/python/cua-sandbox/cua_sandbox/generated/image_models.py b/libs/python/cua-sandbox/cua_sandbox/generated/image_models.pyindex 00d59458a1..3fb95fd015 100644--- a/libs/python/cua-sandbox/cua_sandbox/generated/image_models.py+++ b/libs/python/cua-sandbox/cua_sandbox/generated/image_models.py@@ -1,5 +1,5 @@# Source: clusters/base/cua-images/crd.yaml-# Source SHA-256: c97a1f9bcfd48cd4890807a9f4bfe38c71ba380fd3b47efb217de0eaf4bcc2b3+# Source SHA-256: 8708e5fbbb57064531cc8b7c97a0fcfe2ae878caf8f328c1527f01e2035eb5ed# generated by datamodel-codegen:# filename: image.schema.json@@ -58,7 +58,7 @@ class Source(BaseModel):min_length=1,max_length=2048,)- size_bytes: conint(ge=0, le=9223372036854775807) = Field(..., alias="sizeBytes")+ size_bytes: conint(ge=0, le=9007199254740991) = Field(..., alias="sizeBytes")class File(BaseModel):@@ -259,7 +259,7 @@ class ImageResource(BaseModel):_GENERATED_IMAGE_SCHEMA = _json.loads(- '{\n "$id": "https://cua.ai/schemas/images.cua.ai/v1alpha1/image.json",\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "additionalProperties": false,\n "properties": {\n "apiVersion": {\n "const": "images.cua.ai/v1alpha1",\n "type": "string"\n },\n "kind": {\n "const": "Image",\n "type": "string"\n },\n "metadata": {\n "additionalProperties": false,\n "properties": {\n "annotations": {\n "additionalProperties": {\n "maxLength": 4096,\n "type": "string"\n },\n "maxProperties": 64,\n "type": "object"\n },\n "labels": {\n "additionalProperties": {\n "maxLength": 4096,\n "type": "string"\n },\n "maxProperties": 64,\n "type": "object"\n },\n "name": {\n "maxLength": 63,\n "minLength": 1,\n "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",\n "type": "string"\n },\n "namespace": {\n "maxLength": 63,\n "minLength": 1,\n "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",\n "type": "string"\n }\n },\n "required": [\n "name",\n "namespace"\n ],\n "title": "ImageObjectMeta",\n "type": "object"\n },\n "spec": {\n "additionalProperties": false,\n "properties": {\n "build": {\n "additionalProperties": false,\n "properties": {\n "diskSize": {\n "default": "40Gi",\n "pattern": "^[1-9][0-9]*(Gi|Ti)$",\n "type": "string"\n },\n "timeoutSeconds": {\n "default": 7200,\n "maximum": 86400,\n "minimum": 60,\n "type": "integer"\n }\n },\n "title": "ImageBuildOptions",\n "type": "object"\n },\n "metadata": {\n "additionalProperties": false,\n "properties": {\n "tags": {\n "additionalProperties": {\n "maxLength": 256,\n "type": "string"\n },\n "maxProperties": 32,\n "type": "object"\n }\n },\n "title": "ImageUserMetadata",\n "type": "object"\n },\n "recipe": {\n "additionalProperties": false,\n "properties": {\n "distro": {\n "maxLength": 64,\n "minLength": 1,\n "type": "string"\n },\n "env": {\n "additionalProperties": {\n "maxLength": 8192,\n "type": "string"\n },\n "maxProperties": 128,\n "type": "object"\n },\n "files": {\n "items": {\n "additionalProperties": false,\n "properties": {\n "destination": {\n "maxLength": 4096,\n "pattern": "^/.*",\n "type": "string"\n },\n "source": {\n "additionalProperties": false,\n "properties": {\n "digest": {\n "pattern": "^sha256:[0-9a-f]{64}$",\n "type": "string"\n },\n "reference": {\n "maxLength": 2048,\n "minLength": 1,\n "pattern": "^uploads/[a-z0-9]([-a-z0-9]*[a-z0-9])?/[A-Za-z0-9_-]+$",\n "type": "string"\n },\n "sizeBytes": {\n "format": "int64",\n "maximum": 9223372036854775807,\n "minimum": 0,\n "type": "integer"\n }\n },\n "required": [\n "reference",\n "digest",\n "sizeBytes"\n ],\n "title": "ImageFileReference",\n "type": "object"\n }\n },\n "required": [\n "source",\n "destination"\n ],\n "title": "ImageFile",\n "type": "object"\n },\n "maxItems": 128,\n "type": "array"\n },\n "kind": {\n "enum": [\n "vm"\n ],\n "type": "string"\n },\n "layers": {\n "items": {\n "additionalProperties": false,\n "oneOf": [\n {\n "not": {\n "anyOf": [\n {\n "required": [\n "appId"\n ]\n },\n {\n "required": [\n "command"\n ]\n }\n ]\n },\n "properties": {\n "type": {\n "enum": [\n "apt_install",\n "pip_install",\n "uv_install"\n ]\n }\n },\n "required": [\n "packages"\n ]\n },\n {\n "not": {\n "anyOf": [\n {\n "required": [\n "packages"\n ]\n },\n {\n "required": [\n "command"\n ]\n }\n ]\n },\n "properties": {\n "type": {\n "enum": [\n "app_install"\n ]\n }\n },\n "required": [\n "appId"\n ]\n },\n {\n "not": {\n "anyOf": [\n {\n "required": [\n "packages"\n ]\n },\n {\n "required": [\n "appId"\n ]\n }\n ]\n },\n "properties": {\n "type": {\n "enum": [\n "run"\n ]\n }\n },\n "required": [\n "command"\n ]\n }\n ],\n "properties": {\n "appId": {\n "maxLength": 256,\n "minLength": 1,\n "type": "string"\n },\n "command": {\n "maxLength": 16384,\n "minLength": 1,\n "type": "string"\n },\n "packages": {\n "items": {\n "maxLength": 256,\n "minLength": 1,\n "type": "string"\n },\n "maxItems": 256,\n "minItems": 1,\n "type": "array"\n },\n "type": {\n "enum": [\n "apt_install",\n "pip_install",\n "uv_install",\n "app_install",\n "run"\n ],\n "type": "string"\n }\n },\n "required": [\n "type"\n ],\n "title": "ImageLayer",\n "type": "object"\n },\n "maxItems": 128,\n "type": "array"\n },\n "osType": {\n "enum": [\n "linux"\n ],\n "type": "string"\n },\n "ports": {\n "items": {\n "maximum": 65535,\n "minimum": 1,\n "type": "integer"\n },\n "maxItems": 32,\n "type": "array",\n "uniqueItems": true\n },\n "version": {\n "maxLength": 64,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "osType",\n "distro",\n "version",\n "kind",\n "layers"\n ],\n "title": "ImageRecipe",\n "type": "object"\n }\n },\n "required": [\n "recipe"\n ],\n "title": "ImageSpec",\n "type": "object"\n },\n "status": {\n "additionalProperties": false,\n "properties": {\n "artifacts": {\n "additionalProperties": false,\n "properties": {\n "oci": {\n "additionalProperties": false,\n "properties": {\n "digest": {\n "pattern": "^sha256:[0-9a-f]{64}$",\n "type": "string"\n },\n "reference": {\n "maxLength": 2048,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "reference",\n "digest"\n ],\n "title": "ImageOciArtifact",\n "type": "object"\n },\n "volumeSnapshot": {\n "additionalProperties": false,\n "properties": {\n "name": {\n "maxLength": 253,\n "minLength": 1,\n "type": "string"\n },\n "namespace": {\n "maxLength": 63,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "namespace",\n "name"\n ],\n "title": "ImageVolumeSnapshotArtifact",\n "type": "object"\n }\n },\n "title": "ImageArtifacts",\n "type": "object"\n },\n "buildIdentity": {\n "maxLength": 63,\n "type": "string"\n },\n "conditions": {\n "items": {\n "additionalProperties": false,\n "properties": {\n "lastTransitionTime": {\n "format": "date-time",\n "type": "string"\n },\n "message": {\n "maxLength": 32768,\n "type": "string"\n },\n "observedGeneration": {\n "format": "int64",\n "minimum": 0,\n "type": "integer"\n },\n "reason": {\n "maxLength": 128,\n "minLength": 1,\n "type": "string"\n },\n "status": {\n "enum": [\n "True",\n "False",\n "Unknown"\n ],\n "type": "string"\n },\n "type": {\n "maxLength": 64,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "type",\n "status",\n "reason",\n "lastTransitionTime"\n ],\n "title": "ImageCondition",\n "type": "object"\n },\n "type": "array"\n },\n "logs": {\n "additionalProperties": false,\n "properties": {\n "livePodName": {\n "maxLength": 253,\n "type": "string"\n },\n "retainedReference": {\n "maxLength": 2048,\n "type": "string"\n }\n },\n "title": "ImageLogs",\n "type": "object"\n },\n "observedGeneration": {\n "format": "int64",\n "minimum": 0,\n "type": "integer"\n },\n "phase": {\n "enum": [\n "Pending",\n "Validating",\n "Building",\n "PushingOCI",\n "Importing",\n "Quiescing",\n "Snapshotting",\n "Ready",\n "Failed",\n "Cancelling"\n ],\n "type": "string"\n },\n "recipeDigest": {\n "pattern": "^sha256:[0-9a-f]{64}$",\n "type": "string"\n }\n },\n "title": "ImageStatus",\n "type": "object"\n }\n },\n "required": [\n "spec",\n "apiVersion",\n "kind",\n "metadata"\n ],\n "title": "ImageResource",\n "type": "object"\n}\n'+ '{\n "$id": "https://cua.ai/schemas/images.cua.ai/v1alpha1/image.json",\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "additionalProperties": false,\n "properties": {\n "apiVersion": {\n "const": "images.cua.ai/v1alpha1",\n "type": "string"\n },\n "kind": {\n "const": "Image",\n "type": "string"\n },\n "metadata": {\n "additionalProperties": false,\n "properties": {\n "annotations": {\n "additionalProperties": {\n "maxLength": 4096,\n "type": "string"\n },\n "maxProperties": 64,\n "type": "object"\n },\n "labels": {\n "additionalProperties": {\n "maxLength": 4096,\n "type": "string"\n },\n "maxProperties": 64,\n "type": "object"\n },\n "name": {\n "maxLength": 63,\n "minLength": 1,\n "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",\n "type": "string"\n },\n "namespace": {\n "maxLength": 63,\n "minLength": 1,\n "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",\n "type": "string"\n }\n },\n "required": [\n "name",\n "namespace"\n ],\n "title": "ImageObjectMeta",\n "type": "object"\n },\n "spec": {\n "additionalProperties": false,\n "properties": {\n "build": {\n "additionalProperties": false,\n "properties": {\n "diskSize": {\n "default": "40Gi",\n "pattern": "^[1-9][0-9]*(Gi|Ti)$",\n "type": "string"\n },\n "timeoutSeconds": {\n "default": 7200,\n "maximum": 86400,\n "minimum": 60,\n "type": "integer"\n }\n },\n "title": "ImageBuildOptions",\n "type": "object"\n },\n "metadata": {\n "additionalProperties": false,\n "properties": {\n "tags": {\n "additionalProperties": {\n "maxLength": 256,\n "type": "string"\n },\n "maxProperties": 32,\n "type": "object"\n }\n },\n "title": "ImageUserMetadata",\n "type": "object"\n },\n "recipe": {\n "additionalProperties": false,\n "properties": {\n "distro": {\n "maxLength": 64,\n "minLength": 1,\n "type": "string"\n },\n "env": {\n "additionalProperties": {\n "maxLength": 8192,\n "type": "string"\n },\n "maxProperties": 128,\n "type": "object"\n },\n "files": {\n "items": {\n "additionalProperties": false,\n "properties": {\n "destination": {\n "maxLength": 4096,\n "pattern": "^/.*",\n "type": "string"\n },\n "source": {\n "additionalProperties": false,\n "properties": {\n "digest": {\n "pattern": "^sha256:[0-9a-f]{64}$",\n "type": "string"\n },\n "reference": {\n "maxLength": 2048,\n "minLength": 1,\n "pattern": "^uploads/[a-z0-9]([-a-z0-9]*[a-z0-9])?/[A-Za-z0-9_-]+$",\n "type": "string"\n },\n "sizeBytes": {\n "format": "int64",\n "maximum": 9007199254740991,\n "minimum": 0,\n "type": "integer"\n }\n },\n "required": [\n "reference",\n "digest",\n "sizeBytes"\n ],\n "title": "ImageFileReference",\n "type": "object"\n }\n },\n "required": [\n "source",\n "destination"\n ],\n "title": "ImageFile",\n "type": "object"\n },\n "maxItems": 128,\n "type": "array"\n },\n "kind": {\n "enum": [\n "vm"\n ],\n "type": "string"\n },\n "layers": {\n "items": {\n "additionalProperties": false,\n "oneOf": [\n {\n "not": {\n "anyOf": [\n {\n "required": [\n "appId"\n ]\n },\n {\n "required": [\n "command"\n ]\n }\n ]\n },\n "properties": {\n "type": {\n "enum": [\n "apt_install",\n "pip_install",\n "uv_install"\n ]\n }\n },\n "required": [\n "packages"\n ]\n },\n {\n "not": {\n "anyOf": [\n {\n "required": [\n "packages"\n ]\n },\n {\n "required": [\n "command"\n ]\n }\n ]\n },\n "properties": {\n "type": {\n "enum": [\n "app_install"\n ]\n }\n },\n "required": [\n "appId"\n ]\n },\n {\n "not": {\n "anyOf": [\n {\n "required": [\n "packages"\n ]\n },\n {\n "required": [\n "appId"\n ]\n }\n ]\n },\n "properties": {\n "type": {\n "enum": [\n "run"\n ]\n }\n },\n "required": [\n "command"\n ]\n }\n ],\n "properties": {\n "appId": {\n "maxLength": 256,\n "minLength": 1,\n "type": "string"\n },\n "command": {\n "maxLength": 16384,\n "minLength": 1,\n "type": "string"\n },\n "packages": {\n "items": {\n "maxLength": 256,\n "minLength": 1,\n "type": "string"\n },\n "maxItems": 256,\n "minItems": 1,\n "type": "array"\n },\n "type": {\n "enum": [\n "apt_install",\n "pip_install",\n "uv_install",\n "app_install",\n "run"\n ],\n "type": "string"\n }\n },\n "required": [\n "type"\n ],\n "title": "ImageLayer",\n "type": "object"\n },\n "maxItems": 128,\n "type": "array"\n },\n "osType": {\n "enum": [\n "linux"\n ],\n "type": "string"\n },\n "ports": {\n "items": {\n "maximum": 65535,\n "minimum": 1,\n "type": "integer"\n },\n "maxItems": 32,\n "type": "array",\n "uniqueItems": true\n },\n "version": {\n "maxLength": 64,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "osType",\n "distro",\n "version",\n "kind",\n "layers"\n ],\n "title": "ImageRecipe",\n "type": "object"\n }\n },\n "required": [\n "recipe"\n ],\n "title": "ImageSpec",\n "type": "object"\n },\n "status": {\n "additionalProperties": false,\n "properties": {\n "artifacts": {\n "additionalProperties": false,\n "properties": {\n "oci": {\n "additionalProperties": false,\n "properties": {\n "digest": {\n "pattern": "^sha256:[0-9a-f]{64}$",\n "type": "string"\n },\n "reference": {\n "maxLength": 2048,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "reference",\n "digest"\n ],\n "title": "ImageOciArtifact",\n "type": "object"\n },\n "volumeSnapshot": {\n "additionalProperties": false,\n "properties": {\n "name": {\n "maxLength": 253,\n "minLength": 1,\n "type": "string"\n },\n "namespace": {\n "maxLength": 63,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "namespace",\n "name"\n ],\n "title": "ImageVolumeSnapshotArtifact",\n "type": "object"\n }\n },\n "title": "ImageArtifacts",\n "type": "object"\n },\n "buildIdentity": {\n "maxLength": 63,\n "type": "string"\n },\n "conditions": {\n "items": {\n "additionalProperties": false,\n "properties": {\n "lastTransitionTime": {\n "format": "date-time",\n "type": "string"\n },\n "message": {\n "maxLength": 32768,\n "type": "string"\n },\n "observedGeneration": {\n "format": "int64",\n "minimum": 0,\n "type": "integer"\n },\n "reason": {\n "maxLength": 128,\n "minLength": 1,\n "type": "string"\n },\n "status": {\n "enum": [\n "True",\n "False",\n "Unknown"\n ],\n "type": "string"\n },\n "type": {\n "maxLength": 64,\n "minLength": 1,\n "type": "string"\n }\n },\n "required": [\n "type",\n "status",\n "reason",\n "lastTransitionTime"\n ],\n "title": "ImageCondition",\n "type": "object"\n },\n "type": "array"\n },\n "logs": {\n "additionalProperties": false,\n "properties": {\n "livePodName": {\n "maxLength": 253,\n "type": "string"\n },\n "retainedReference": {\n "maxLength": 2048,\n "type": "string"\n }\n },\n "title": "ImageLogs",\n "type": "object"\n },\n "observedGeneration": {\n "format": "int64",\n "minimum": 0,\n "type": "integer"\n },\n "phase": {\n "enum": [\n "Pending",\n "Validating",\n "Building",\n "PushingOCI",\n "Importing",\n "Quiescing",\n "Snapshotting",\n "Ready",\n "Failed",\n "Cancelling"\n ],\n "type": "string"\n },\n "recipeDigest": {\n "pattern": "^sha256:[0-9a-f]{64}$",\n "type": "string"\n }\n },\n "title": "ImageStatus",\n "type": "object"\n }\n },\n "required": [\n "spec",\n "apiVersion",\n "kind",\n "metadata"\n ],\n "title": "ImageResource",\n "type": "object"\n}\n')_GENERATED_IMAGE_SCHEMA_VALIDATOR = _Draft202012Validator(_GENERATED_IMAGE_SCHEMA)GeneratedImageResource = ImageResourcediff --git a/libs/python/cua-sandbox/schemas/image-v1alpha1.schema.json b/libs/python/cua-sandbox/schemas/image-v1alpha1.schema.jsonindex 181e541c32..caff64a984 100644--- a/libs/python/cua-sandbox/schemas/image-v1alpha1.schema.json+++ b/libs/python/cua-sandbox/schemas/image-v1alpha1.schema.json@@ -126,7 +126,7 @@},"sizeBytes": {"format": "int64",- "maximum": 9223372036854775807,+ "maximum": 9007199254740991,"minimum": 0,"type": "integer"}diff --git a/libs/python/cua-sandbox/tests/test_image_crd.py b/libs/python/cua-sandbox/tests/test_image_crd.pyindex 2fbd40fd2d..bf621db279 100644--- a/libs/python/cua-sandbox/tests/test_image_crd.py+++ b/libs/python/cua-sandbox/tests/test_image_crd.py@@ -84,8 +84,7 @@ def test_image_crd_files_use_external_references() -> None:reference = file_item["properties"]["source"]["properties"]["reference"]assert reference["pattern"] == "^uploads/[a-z0-9]([-a-z0-9]*[a-z0-9])?/[A-Za-z0-9_-]+$"assert (- file_item["properties"]["source"]["properties"]["sizeBytes"]["maximum"]- == 9223372036854775807+ file_item["properties"]["source"]["properties"]["sizeBytes"]["maximum"] == 9007199254740991)assert "content" not in file_item["properties"]assert "path" not in file_item["properties"]["source"]["properties"]diff --git a/libs/python/cua-sandbox/tests/test_image_model_generation.py b/libs/python/cua-sandbox/tests/test_image_model_generation.pyindex 93088cf993..d41f0d9491 100644--- a/libs/python/cua-sandbox/tests/test_image_model_generation.py+++ b/libs/python/cua-sandbox/tests/test_image_model_generation.py@@ -129,24 +129,24 @@ def test_generated_models_reject_irrelevant_layer_fields(layer: dict[str, object)-def test_generated_models_accept_file_reference_at_kubernetes_int64_maximum() -> None:+def test_generated_models_accept_file_reference_at_json_safe_integer_maximum() -> None:reference = ImageFileReference.model_validate({"reference": "uploads/tenant-a/a","digest": "sha256:" + "a" * 64,- "sizeBytes": 9223372036854775807,+ "sizeBytes": 9007199254740991,})- assert reference.size_bytes == 9223372036854775807+ assert reference.size_bytes == 9007199254740991-def test_generated_models_reject_file_reference_larger_than_kubernetes_int64() -> None:+def test_generated_models_reject_file_reference_larger_than_json_safe_integer() -> None:with pytest.raises(ValidationError):ImageFileReference.model_validate({"reference": "uploads/tenant-a/a","digest": "sha256:" + "a" * 64,- "sizeBytes": 9223372036854775808,+ "sizeBytes": 9007199254740992,})