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(analytics): look up native Fleet warm pools (#7295)

Francesco Bonaccif93a22c834cb
diff --git a/libs/fleet/backend/handlers/attribution.go b/libs/fleet/backend/handlers/attribution.go
index dc0bd6d345..2f71d31c0c 100644
--- a/libs/fleet/backend/handlers/attribution.go
+++ b/libs/fleet/backend/handlers/attribution.go
@@ -125,7 +125,9 @@ func (reader fleetAttributionFactsReader) PoolExists(ctx context.Context, namesp
if pool == "" {
return false, fmt.Errorf("missing pool")
}
- path := fmt.Sprintf("/apis/cua.ai/v1/namespaces/%s/osgymworkspacepools/%s", url.PathEscape(namespace), url.PathEscape(pool))
+ // Fleet SDK pools are native OSGymSandboxWarmPool resources. Keep the
+ // qualification lookup aligned with the resource the SDK actually creates.
+ path := fmt.Sprintf("/apis/osgym.cua.ai/v1alpha1/namespaces/%s/osgymsandboxwarmpools/%s", url.PathEscape(namespace), url.PathEscape(pool))
response, err := reader.handlers.k8sImpersonate(ctx, http.MethodGet, path, nil, subject)
if err != nil {
return false, err
diff --git a/libs/fleet/backend/handlers/attribution_test.go b/libs/fleet/backend/handlers/attribution_test.go
index 651ae9e40f..3e0b072a7a 100644
--- a/libs/fleet/backend/handlers/attribution_test.go
+++ b/libs/fleet/backend/handlers/attribution_test.go
@@ -34,7 +34,7 @@ func TestFleetAttributionFactsReaderDerivesClaimFromSandboxOwnerAndExactPool(t *
_, _ = w.Write([]byte(`{"metadata":{"ownerReferences":[{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","name":"claim-1","uid":"claim-uid-1","controller":true}]}}`))
case "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxclaims/claim-1":
_, _ = w.Write([]byte(`{"metadata":{"name":"claim-1","uid":"claim-uid-1"},"status":{"phase":"Bound","sandbox":{"name":"sandbox-1"}}}`))
- case "/apis/cua.ai/v1/namespaces/pool-1/osgymworkspacepools/pool-1":
+ case "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxwarmpools/pool-1":
_, _ = w.Write([]byte(`{"metadata":{"name":"pool-1"}}`))
default:
http.NotFound(w, r)
@@ -60,7 +60,7 @@ func TestFleetAttributionFactsReaderDerivesClaimFromSandboxOwnerAndExactPool(t *
if err != nil || !exists {
t.Fatalf("pool exists = %v, err = %v", exists, err)
}
- if len(paths) != 3 || paths[0] != "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxes/sandbox-1" || paths[1] != "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxclaims/claim-1" || paths[2] != "/apis/cua.ai/v1/namespaces/pool-1/osgymworkspacepools/pool-1" {
+ if len(paths) != 3 || paths[0] != "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxes/sandbox-1" || paths[1] != "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxclaims/claim-1" || paths[2] != "/apis/osgym.cua.ai/v1alpha1/namespaces/pool-1/osgymsandboxwarmpools/pool-1" {
t.Fatalf("lookup paths = %#v", paths)
}
}