From e437e9eabe27944ffd3f6265c273945608bf0d89 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sat, 23 May 2026 05:08:29 +0000 Subject: [PATCH 1/2] fix(github-token): add HTTP client timeout to prevent indefinite blocking http.DefaultClient has no timeout, so a slow/unresponsive GitHub API could block the handler goroutine forever. Use an http.Client with a 30-second timeout in generateAppInstallationToken. Co-Authored-By: Claude Opus 4.7 --- workspace-server/internal/handlers/github_token.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workspace-server/internal/handlers/github_token.go b/workspace-server/internal/handlers/github_token.go index ce9492a9d..f00714a96 100644 --- a/workspace-server/internal/handlers/github_token.go +++ b/workspace-server/internal/handlers/github_token.go @@ -159,7 +159,8 @@ func generateAppInstallationToken() (string, time.Time, error) { req, _ := http.NewRequest("POST", fmt.Sprintf("https://api.github.com/app/installations/%d/access_tokens", installID), nil) req.Header.Set("Authorization", "Bearer "+signed) req.Header.Set("Accept", "application/vnd.github+json") - resp, err := http.DefaultClient.Do(req) + client := &http.Client{Timeout: 30 * time.Second} + resp, err := client.Do(req) if err != nil { return "", time.Time{}, err } -- 2.52.0 From 76a31686719a377548012ee95f152d9db99290bd Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sat, 23 May 2026 19:47:18 +0000 Subject: [PATCH 2/2] fix(tests): add model to compute validation test to satisfy MODEL_REQUIRED gate TestWorkspaceCreate_WithInvalidCompute_ReturnsBadRequest was missing a model field, so it hit the 422 MODEL_REQUIRED gate (added 2026-05-22) before reaching compute validation. Adding \"model\":\"gpt-4\" lets the test reach the intended 400 BadRequest from invalid instance_type. Co-Authored-By: Claude Opus 4.7 --- workspace-server/internal/handlers/workspace_compute_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace-server/internal/handlers/workspace_compute_test.go b/workspace-server/internal/handlers/workspace_compute_test.go index 97ffc4132..5d758fd6c 100644 --- a/workspace-server/internal/handlers/workspace_compute_test.go +++ b/workspace-server/internal/handlers/workspace_compute_test.go @@ -110,6 +110,7 @@ func TestWorkspaceCreate_WithInvalidCompute_ReturnsBadRequest(t *testing.T) { c, _ := gin.CreateTestContext(w) body := `{ "name":"Oversized Agent", + "model":"gpt-4", "compute":{"instance_type":"p4d.24xlarge"} }` c.Request = httptest.NewRequest("POST", "/workspaces", bytes.NewBufferString(body)) -- 2.52.0