Skip to content

An open-source, faster Devin alternative

TypeScript

fix unhandled cases

Brian Reardonbeb4e8879cf0
diff --git a/internal/api/image_builder.go b/internal/api/image_builder.go
index 744a3d26..2321afb3 100644
--- a/internal/api/image_builder.go
+++ b/internal/api/image_builder.go
@@ -442,6 +442,11 @@ func (s *Server) buildImage(ctx context.Context, orgID uuid.UUID, manifest *Imag
workerID = "w-local-1"
}
_, _ = s.store.CreateSandboxSession(ctx, buildSandboxID, orgID, nil, cfg.Template, region, workerID, cfgJSON, []byte("{}"))
+ if s.workerRegistry != nil {
+ if w := s.workerRegistry.GetWorker(workerID); w != nil && w.GoldenVersion != "" {
+ _ = s.store.SetSandboxGoldenVersion(ctx, buildSandboxID, w.GoldenVersion)
+ }
+ }
}
// Emit build start log
diff --git a/internal/api/sandbox.go b/internal/api/sandbox.go
index 1e236a6f..50a3498e 100644
--- a/internal/api/sandbox.go
+++ b/internal/api/sandbox.go
@@ -1663,6 +1663,9 @@ func (s *Server) wakeSandboxRemote(c echo.Context, sandboxID string, req types.W
// Mark hibernation as restored, update session
_ = s.store.MarkHibernationRestored(c.Request().Context(), sandboxID)
_ = s.store.UpdateSandboxSessionForWake(c.Request().Context(), sandboxID, worker.ID)
+ if worker.GoldenVersion != "" {
+ _ = s.store.SetSandboxGoldenVersion(c.Request().Context(), sandboxID, worker.GoldenVersion)
+ }
// Refresh the proxy route cache with the new worker — wake may have moved
// the sandbox to a different worker than where it was hibernated, and any
diff --git a/internal/proxy/controlplane_proxy.go b/internal/proxy/controlplane_proxy.go
index a661a5c6..f4eb78ee 100644
--- a/internal/proxy/controlplane_proxy.go
+++ b/internal/proxy/controlplane_proxy.go
@@ -225,6 +225,9 @@ func (p *ControlPlaneProxy) wakeHibernatedSandbox(ctx context.Context, sandboxID
// Update DB: mark hibernation restored, update session to running on new worker
_ = p.store.MarkHibernationRestored(ctx, sandboxID)
_ = p.store.UpdateSandboxSessionForWake(ctx, sandboxID, worker.ID)
+ if worker.GoldenVersion != "" {
+ _ = p.store.SetSandboxGoldenVersion(ctx, sandboxID, worker.GoldenVersion)
+ }
workerURL := worker.HTTPAddr
if workerURL == "" {
diff --git a/internal/proxy/sandbox_api_proxy.go b/internal/proxy/sandbox_api_proxy.go
index 78181c31..611d70f9 100644
--- a/internal/proxy/sandbox_api_proxy.go
+++ b/internal/proxy/sandbox_api_proxy.go
@@ -430,6 +430,9 @@ func (p *SandboxAPIProxy) wakeHibernatedSandbox(ctx context.Context, sandboxID s
_ = p.store.MarkHibernationRestored(ctx, sandboxID)
_ = p.store.UpdateSandboxSessionForWake(ctx, sandboxID, worker.ID)
+ if worker.GoldenVersion != "" {
+ _ = p.store.SetSandboxGoldenVersion(ctx, sandboxID, worker.GoldenVersion)
+ }
if worker.HTTPAddr == "" {
return nil, "", fmt.Errorf("worker %s has no HTTP address", worker.ID)