Skip to content

An open-source, faster Devin alternative

TypeScript

make sure golden version is propogating

Brian Reardon26b46b22d2b1
diff --git a/internal/qemu/migration.go b/internal/qemu/migration.go
index b5a680f3..6723718b 100644
--- a/internal/qemu/migration.go
+++ b/internal/qemu/migration.go
@@ -477,7 +477,13 @@ func (m *Manager) PrepareIncomingMigration(ctx context.Context, sandboxID, rootf
return "", 0, fmt.Errorf("QMP connect: %w", err)
}
- // Store the VM (will be completed after migration arrives)
+ // Store the VM (will be completed after migration arrives).
+ // goldenVersion is set to this worker's current golden — after migration,
+ // PrepareIncomingMigrationWithS3 rebased the overlay to point at this
+ // worker's base, so the VM is effectively running against that golden.
+ // Without this, any checkpoint taken after migration would record an
+ // empty goldenVersion and subsequent cross-golden forks of that
+ // checkpoint can't locate the correct old base to rebase from.
now := time.Now()
vm := &VMInstance{
ID: sandboxID,
@@ -500,6 +506,7 @@ func (m *Manager) PrepareIncomingMigration(ctx context.Context, sandboxID, rootf
guestMAC: guestMAC,
guestCID: guestCID,
bootArgs: bootArgs,
+ goldenVersion: m.GoldenVersion(),
}
m.mu.Lock()
diff --git a/internal/qemu/snapshot.go b/internal/qemu/snapshot.go
index 9cbab40a..131d27e5 100644
--- a/internal/qemu/snapshot.go
+++ b/internal/qemu/snapshot.go
@@ -524,6 +524,7 @@ func (m *Manager) doWake(ctx context.Context, sandboxID, checkpointKey string, c
guestMAC: guestMAC,
guestCID: guestCID,
bootArgs: bootArgs,
+ goldenVersion: m.goldenVersion, // set on wake — VM runs on the current worker's base
}
vm.agent = agentClient
@@ -689,6 +690,7 @@ func (m *Manager) coldBootLocal(ctx context.Context, sandboxID string, timeout i
guestMAC: guestMAC,
guestCID: guestCID,
bootArgs: bootArgs,
+ goldenVersion: m.goldenVersion, // cold boot: VM runs on the current worker's base
}
agentClient, err := m.waitForAgentSocket(context.Background(), agentSockPath, 30*time.Second)