Skip to content

An open-source, faster Devin alternative

TypeScript

add missing fields

Brian Reardon70e7589fa153
diff --git a/.github/workflows/deploy-server.yml b/.github/workflows/deploy-server.yml
index 3d1cf371..7fd2f01e 100644
--- a/.github/workflows/deploy-server.yml
+++ b/.github/workflows/deploy-server.yml
@@ -167,16 +167,17 @@ jobs:
fi
echo "Created sandbox: $SB"
- # Exec with retry
+ # Exec with retry — use -s (not -sf) so we see error responses
RESULT=""
- for attempt in 1 2 3; do
+ for attempt in 1 2 3 4 5; do
sleep 5
- RESULT=$(curl -sf --max-time 15 \
+ RAW=$(curl -s --max-time 15 \
-H "Content-Type: application/json" \
-H "X-API-Key: ${{ secrets.API_KEY }}" \
-X POST "${API_URL}/api/sandboxes/$SB/exec/run" \
- -d '{"cmd":"echo","args":["deploy-ok"],"timeout":10}' | jq -r .stdout 2>/dev/null || echo "")
- echo "Attempt $attempt: '$RESULT'"
+ -d '{"cmd":"echo","args":["deploy-ok"],"timeout":10}')
+ RESULT=$(echo "$RAW" | jq -r .stdout 2>/dev/null || echo "")
+ echo "Attempt $attempt: stdout='$RESULT' raw='$RAW'"
echo "$RESULT" | grep -q "deploy-ok" && break
done
diff --git a/internal/controlplane/scaler.go b/internal/controlplane/scaler.go
index 435f7030..650324ca 100644
--- a/internal/controlplane/scaler.go
+++ b/internal/controlplane/scaler.go
@@ -1103,8 +1103,8 @@ func (s *Scaler) liveMigrateSandbox(ctx context.Context, sandboxID, sourceWorker
// 3. Worker heartbeat (all sandboxes on a worker share its golden base)
sourceGoldenVersion := preCopyResp.GoldenVersion
if sourceGoldenVersion == "" && s.store != nil {
- if session, err := s.store.GetSandboxSession(ctx, sandboxID); err == nil && session.GoldenVersion != "" {
- sourceGoldenVersion = session.GoldenVersion
+ if session, err := s.store.GetSandboxSession(ctx, sandboxID); err == nil && session.GoldenVersion != nil && *session.GoldenVersion != "" {
+ sourceGoldenVersion = *session.GoldenVersion
log.Printf("scaler: migrate %s: goldenVersion from PG: %s", sandboxID, sourceGoldenVersion)
}
}
diff --git a/internal/db/store.go b/internal/db/store.go
index 324c3655..c80ec557 100644
--- a/internal/db/store.go
+++ b/internal/db/store.go
@@ -486,7 +486,7 @@ type SandboxSession struct {
LastPatchSequence int `json:"lastPatchSequence"`
MigratingToWorker string `json:"migratingToWorker,omitempty"`
PatchError *string `json:"patchError,omitempty"`
- GoldenVersion string `json:"goldenVersion,omitempty"`
+ GoldenVersion *string `json:"goldenVersion,omitempty"`
}
func (s *Store) CreateSandboxSession(ctx context.Context, sandboxID string, orgID uuid.UUID, userID *uuid.UUID, template, region, workerID string, config, metadata json.RawMessage) (*SandboxSession, error) {
@@ -640,7 +640,7 @@ func (s *Store) MarkOrphanedSandboxes(ctx context.Context, liveWorkers map[strin
func (s *Store) GetSandboxSession(ctx context.Context, sandboxID string) (*SandboxSession, error) {
session := &SandboxSession{}
err := s.pool.QueryRow(ctx,
- `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error
+ `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error, golden_version
FROM sandbox_sessions WHERE sandbox_id = $1 ORDER BY started_at DESC LIMIT 1`, sandboxID,
).Scan(&session.ID, &session.SandboxID, &session.OrgID, &session.UserID, &session.Template,
&session.Region, &session.WorkerID, &session.Status, &session.Config, &session.Metadata,
@@ -656,12 +656,12 @@ func (s *Store) ListSandboxSessions(ctx context.Context, orgID uuid.UUID, status
var err error
if status != "" {
rows, err = s.pool.Query(ctx,
- `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error
+ `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error, golden_version
FROM sandbox_sessions WHERE org_id = $1 AND status = $2 ORDER BY started_at DESC LIMIT $3 OFFSET $4`,
orgID, status, limit, offset)
} else {
rows, err = s.pool.Query(ctx,
- `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error
+ `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error, golden_version
FROM sandbox_sessions WHERE org_id = $1 ORDER BY started_at DESC LIMIT $2 OFFSET $3`,
orgID, limit, offset)
}
@@ -1394,7 +1394,7 @@ func (s *Store) SetSandboxCheckpointID(ctx context.Context, sandboxID string, ch
// ListSandboxesByCheckpoint returns all non-stopped sandboxes forked from a checkpoint.
func (s *Store) ListSandboxesByCheckpoint(ctx context.Context, checkpointID uuid.UUID) ([]SandboxSession, error) {
rows, err := s.pool.Query(ctx,
- `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error
+ `SELECT id, sandbox_id, org_id, user_id, template, region, worker_id, status, config, metadata, started_at, stopped_at, error_msg, based_on_checkpoint_id, last_patch_sequence, patch_error, golden_version
FROM sandbox_sessions WHERE based_on_checkpoint_id = $1 AND status IN ('running', 'hibernated') ORDER BY started_at DESC`,
checkpointID)
if err != nil {