Skip to content

Commit d82958b

Browse files
committed
fix: send the correct payload when creating workspaces from workspaces
The workspace-provider daemon expects fromWorkspaceIDs instead of workspace_ids. Signed-off-by: Donnie Adams <donnie@acorn.io>
1 parent f8b95c9 commit d82958b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/sdkserver/workspaces.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"net/http"
7-
"strings"
87

98
gcontext "github.com/gptscript-ai/gptscript/pkg/context"
109
"github.com/gptscript-ai/gptscript/pkg/loader"
@@ -52,14 +51,16 @@ func (s *server) createWorkspace(w http.ResponseWriter, r *http.Request) {
5251
reqObject.ProviderType = "directory"
5352
}
5453

54+
b, err := json.Marshal(map[string]any{
55+
"provider": reqObject.ProviderType,
56+
"fromWorkspaceIDs": reqObject.FromWorkspaceIDs,
57+
})
58+
5559
out, err := s.client.Run(
5660
r.Context(),
5761
prg,
5862
s.getServerToolsEnv(reqObject.Env),
59-
fmt.Sprintf(
60-
`{"provider": "%s", "workspace_ids": "%s"}`,
61-
reqObject.ProviderType, strings.Join(reqObject.FromWorkspaceIDs, ","),
62-
),
63+
string(b),
6364
)
6465
if err != nil {
6566
writeError(logger, w, http.StatusInternalServerError, fmt.Errorf("failed to run program: %w", err))

0 commit comments

Comments
 (0)