Skip to content

An open-source, faster Devin alternative

TypeScript

fix(controlplane): default networkEnabled to true when caller omits it (#206)

Mohamed Habibdac55aa9679b
diff --git a/internal/controlplane/server.go b/internal/controlplane/server.go
index 6ec984c2..d81fb4d9 100644
--- a/internal/controlplane/server.go
+++ b/internal/controlplane/server.go
@@ -99,13 +99,21 @@ func (s *Server) createSandbox(c echo.Context) error {
MemoryMB int `json:"memoryMB"`
CpuCount int `json:"cpuCount"`
Metadata map[string]string `json:"metadata"`
- NetworkEnabled bool `json:"networkEnabled"`
+ NetworkEnabled *bool `json:"networkEnabled"`
SecretStore string `json:"secretStore"` // secret store name — resolves secrets + egress config
}
if err := c.Bind(&req); err != nil {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid request: " + err.Error()})
}
+ // Default networkEnabled to true when caller omits the field. The worker
+ // currently sets up networking unconditionally, so a missing field that
+ // marshaled to false caused the UI to mislabel sandboxes as "Disabled".
+ if req.NetworkEnabled == nil {
+ t := true
+ req.NetworkEnabled = &t
+ }
+
orgID, ok := auth.GetOrgID(c)
if !ok {
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "auth required"})
@@ -194,7 +202,7 @@ func (s *Server) createSandbox(c echo.Context) error {
Envs: req.Envs,
MemoryMb: int32(req.MemoryMB),
CpuCount: int32(req.CpuCount),
- NetworkEnabled: req.NetworkEnabled,
+ NetworkEnabled: *req.NetworkEnabled,
EgressAllowlist: egressAllowlist,
SecretAllowedHosts: secretAllowedHosts,
})