Deep Review: 20261004-001957-pr-5565

Date2026-10-04 00:19
Repolima-vm/lima
Round1 (of pr-5565)
Author@mvanhorn
PR#5565 — fix: stop guest time sync from stepping the clock back by RPC latency
Branchfix/5543-guest-timesync-latency
Commits3a5e97c3 fix: stop guest time sync from stepping the clock back by RPC latency
Review SHA3a5e97c378f31ff1b5a2bac866fac3778be9d01a
ReviewersClaude Opus 5.5 (effort: high), Codex GPT 6 Astra (effort: high), Gemini 3.1 Pro (effort: default), Gemini 3.5 Flash (effort: default)
VerdictMerge with fixes — the approach helps under steady load, but its stale estimate can now set the guest ahead of the host and step it back later
Wall-clock time55 min 29 s


Executive Summary

The PR sends host_time ahead by half the smaller of the last two round trips, so steady RPC latency no longer steps the guest clock back each tick. When that estimate, one or two ticks old, exceeds the current request delay (after a slow first sync, when load ends, or when replies run slow), the guest is set ahead of the host and a later tick steps it back. Two small patches fix this, at some cost to the gain.


Critical Issues

None.


Important Issues

I1. The second sync compensates from a single sample, so a slow first sync steps the guest ahead and then back Codex GPT 6 Astra Claude Opus 5.5 Gemini 3.5 Flash Gemini 3.1 Pro
}

// oneWayDelay estimates host-to-guest delay as half the lesser of the two most
// recent round trips. It is 0 when the latest sample is not positive, so the
// first send is uncompensated and a single stall cannot aim the next tick ahead.
func oneWayDelay(prev, last time.Duration) time.Duration {
	if last <= 0 {
		return 0
	}
	if prev > 0 && prev < last {
		return prev / 2
	}
	return last / 2
}

// compensatedHostTime is the predicted guest receipt time sent as host_time.
func compensatedHostTime(sentAt time.Time, delay time.Duration) time.Time {
	return sentAt.Add(delay)

On tick 2 prev is still 0, so line 101 returns half the only sample. The doc comment's claim that a single stall cannot aim the next tick ahead holds only from tick 3. The first sync runs while the guest is still booting. After a slow first round trip, tick 2 aims host_time ahead and the guest steps forward; with no guest NTP, tick 3 steps it back. An 8 s stall on the first reply gives +3.995 s, then −3.995 s, where the merge-base does not step. Below the threshold the guest stays ahead. Round trips of 220 ms then 40 ms leave it 90 ms ahead, against 110 ms behind at the merge-base and on time with the fix.

Reproducer
// Save as pkg/hostagent/timesync_probe_test.go; run: go test ./pkg/hostagent/ -run TestProbeTimeSync -v
package hostagent

import (
	"context"
	"io"
	"testing"
	"time"

	"github.com/sirupsen/logrus"

	guestagentapi "github.com/lima-vm/lima/v2/pkg/guestagent/api"
)

type trip struct{ out, back time.Duration }

// simulateTicks runs syncGuestClock once per trip against a guest that applies
// GuestServer.SyncTime's 100ms rule, and returns each step the guest clock
// took (negative is backward). ntp returns the guest to true time between
// ticks; compensate=false sends the send time itself, as the merge-base did.
func simulateTicks(trips []trip, ntp, compensate bool) []time.Duration {
	var steps []time.Duration
	var offset, prev, last time.Duration
	start := time.Date(2026, time.October, 3, 0, 0, 0, 0, time.UTC)
	for i, tr := range trips {
		if ntp {
			offset = 0
		}
		sentAt := start.Add(time.Duration(i) * timeSyncInterval)
		doSync := func(_ context.Context, hostTime time.Time) (*guestagentapi.TimeSyncResponse, error) {
			if !compensate {
				hostTime = sentAt
			}
			receipt := sentAt.Add(tr.out)
			drift := receipt.Add(offset).Sub(hostTime)
			if drift > 100*time.Millisecond || drift < -100*time.Millisecond {
				steps = append(steps, -drift)
				offset = hostTime.Sub(receipt)
			}
			return &guestagentapi.TimeSyncResponse{}, nil
		}
		prev, last = syncGuestClock(context.Background(), doSync, prev, last, scriptedNow(sentAt, sentAt.Add(tr.out+tr.back)))
	}
	return steps
}

func TestProbeTimeSync(t *testing.T) {
	logrus.SetOutput(io.Discard)
	ms := time.Millisecond
	steady := trip{250 * ms, 250 * ms}
	fast := trip{5 * ms, 5 * ms}
	for _, tc := range []struct {
		name  string
		trips []trip
		ntp   bool
	}{
		{"steady 250ms each way, guest NTP", []trip{steady, steady, steady, steady}, true},
		{"first reply stalls 8s, no guest NTP", []trip{{10 * ms, 7990 * ms}, fast, fast}, false},
		{"first sync 250ms each way, no guest NTP", []trip{steady, fast, fast}, false},
	} {
		t.Run(tc.name, func(t *testing.T) {
			base := simulateTicks(tc.trips, tc.ntp, false)
			pr := simulateTicks(tc.trips, tc.ntp, true)
			t.Logf("merge-base steps: %v", base)
			t.Logf("reviewed steps:   %v", pr)
			if len(pr) > len(base) {
				t.Errorf("reviewed code steps the guest clock %d times, merge-base %d", len(pr), len(base))
			}
		})
	}
}
$ go test ./pkg/hostagent/ -run TestProbeTimeSync -v
=== RUN   TestProbeTimeSync
=== RUN   TestProbeTimeSync/steady_250ms_each_way,_guest_NTP
    timesync_probe_test.go:64: merge-base steps: [-250ms -250ms -250ms -250ms]
    timesync_probe_test.go:65: reviewed steps:   [-250ms]
=== RUN   TestProbeTimeSync/first_reply_stalls_8s,_no_guest_NTP
    timesync_probe_test.go:64: merge-base steps: []
    timesync_probe_test.go:65: reviewed steps:   [3.995s -3.995s]
    timesync_probe_test.go:67: reviewed code steps the guest clock 2 times, merge-base 0
=== RUN   TestProbeTimeSync/first_sync_250ms_each_way,_no_guest_NTP
    timesync_probe_test.go:64: merge-base steps: [-250ms 245ms]
    timesync_probe_test.go:65: reviewed steps:   [-250ms 495ms -245ms]
    timesync_probe_test.go:67: reviewed code steps the guest clock 3 times, merge-base 2
--- FAIL: TestProbeTimeSync (0.00s)
    --- PASS: TestProbeTimeSync/steady_250ms_each_way,_guest_NTP (0.00s)
    --- FAIL: TestProbeTimeSync/first_reply_stalls_8s,_no_guest_NTP (0.00s)
    --- FAIL: TestProbeTimeSync/first_sync_250ms_each_way,_no_guest_NTP (0.00s)
FAIL
FAIL	github.com/lima-vm/lima/v2/pkg/hostagent	0.482s
FAIL

Fix: compensate only from two positive samples, and update the two assertions that pinned single-sample compensation. The probe and the shipped tests pass with it.

Patch
diff --git a/pkg/hostagent/timesync.go b/pkg/hostagent/timesync.go
index 3f63c309..365ead64 100644
--- a/pkg/hostagent/timesync.go
+++ b/pkg/hostagent/timesync.go
@@ -89,16 +89,13 @@ func syncGuestClock(ctx context.Context, doSync func(context.Context, time.Time)
 }
 
 // oneWayDelay estimates host-to-guest delay as half the lesser of the two most
-// recent round trips. It is 0 when the latest sample is not positive, so the
-// first send is uncompensated and a single stall cannot aim the next tick ahead.
+// recent round trips. It is 0 until both samples are positive, so a single
+// slow round trip, the first one included, cannot aim the next tick ahead.
 func oneWayDelay(prev, last time.Duration) time.Duration {
-	if last <= 0 {
+	if prev <= 0 || last <= 0 {
 		return 0
 	}
-	if prev > 0 && prev < last {
-		return prev / 2
-	}
-	return last / 2
+	return min(prev, last) / 2
 }
 
 // compensatedHostTime is the predicted guest receipt time sent as host_time.
diff --git a/pkg/hostagent/timesync_test.go b/pkg/hostagent/timesync_test.go
index 814d56cf..8d510f83 100644
--- a/pkg/hostagent/timesync_test.go
+++ b/pkg/hostagent/timesync_test.go
@@ -52,7 +52,7 @@ func TestOneWayDelay(t *testing.T) {
 	t.Run("startup and empty window", func(t *testing.T) {
 		assert.Equal(t, oneWayDelay(0, 0), time.Duration(0))
 		assert.Equal(t, compensatedHostTime(sentAt, 0), sentAt)
-		assert.Equal(t, oneWayDelay(0, 300*time.Millisecond), 150*time.Millisecond)
+		assert.Equal(t, oneWayDelay(0, 300*time.Millisecond), time.Duration(0))
 	})
 
 	t.Run("non-positive latest sample", func(t *testing.T) {
@@ -74,7 +74,7 @@ func TestSyncGuestClock(t *testing.T) {
 		assert.Equal(t, got, sentAt)
 		assert.Equal(t, prev, time.Duration(0))
 		assert.Equal(t, last, 300*time.Millisecond)
-		assert.Equal(t, oneWayDelay(prev, last), 150*time.Millisecond)
+		assert.Equal(t, oneWayDelay(prev, last), time.Duration(0))
 	})
 
 	t.Run("third stable sample keeps the one-way delay", func(t *testing.T) {
I2. A stale estimate sets the guest ahead of the host when load ends or replies run slow, and a later tick steps it back Claude Opus 5.5 Codex GPT 6 Astra Gemini 3.5 Flash

// syncGuestClock sends the predicted guest receipt time and shifts the RTT window
// after SyncTime returns a nil error. An RPC error leaves the window unchanged.
func syncGuestClock(ctx context.Context, doSync func(context.Context, time.Time) (*guestagentapi.TimeSyncResponse, error), prevIn, lastIn time.Duration, now func() time.Time) (prev, last time.Duration) {
	prev, last = prevIn, lastIn
	sentAt := now()
	// host_time is the predicted receipt time (issue 5543).
	hostTime := compensatedHostTime(sentAt, oneWayDelay(prev, last))
	resp, err := doSync(ctx, hostTime)
	if err != nil {
		logrus.WithError(err).Debug("Time sync: RPC failed")
		return prev, last
	}

The delay comes from round trips 10 and 20 s old. When it exceeds the current request leg by more than 100 ms, the guest (pkg/guestagent/api/server/server.go:128-130) sets its clock to a host_time ahead of the host's own clock. The merge-base never could, because its host_time was never later than the guest's receipt. Load ending triggers this, and so do replies slower than requests, since rtt/2 charges half the reply leg to the request. Without guest NTP, a later tick steps it back. Which model Lima guests follow is open (Design Observations).

	resp := &api.TimeSyncResponse{
		Adjusted: false,
		DriftMs:  drift.Milliseconds(),
	}

	const driftThreshold = 100 * time.Millisecond
	if drift > driftThreshold || drift < -driftThreshold {
		if err := timesync.SetSystemTime(hostTime); err != nil {
			logrus.WithError(err).Warn("SyncTime: failed to set system time")
			resp.Error = err.Error()
			return resp, nil
		}
		resp.Adjusted = true
Reproducer
// Save as pkg/hostagent/timesync_overshoot_probe_test.go; run: go test ./pkg/hostagent/ -run TestProbeOvershoot -v
package hostagent

import (
	"context"
	"io"
	"testing"
	"time"

	"github.com/sirupsen/logrus"

	guestagentapi "github.com/lima-vm/lima/v2/pkg/guestagent/api"
)

type leg struct{ out, back time.Duration }

// guestSteps runs syncGuestClock once per entry against a guest that applies
// GuestServer.SyncTime's 100ms rule, and returns each step the guest clock
// took (negative is backward). ntp returns the guest to true time between
// ticks; compensate=false sends the send time itself, as the merge-base did.
func guestSteps(legs []leg, ntp, compensate bool) []time.Duration {
	var steps []time.Duration
	var offset, prev, last time.Duration
	start := time.Date(2026, time.October, 3, 0, 0, 0, 0, time.UTC)
	for i, l := range legs {
		if ntp {
			offset = 0
		}
		sentAt := start.Add(time.Duration(i) * timeSyncInterval)
		doSync := func(_ context.Context, hostTime time.Time) (*guestagentapi.TimeSyncResponse, error) {
			if !compensate {
				hostTime = sentAt
			}
			receipt := sentAt.Add(l.out)
			drift := receipt.Add(offset).Sub(hostTime)
			if drift > 100*time.Millisecond || drift < -100*time.Millisecond {
				steps = append(steps, -drift)
				offset = hostTime.Sub(receipt)
			}
			return &guestagentapi.TimeSyncResponse{}, nil
		}
		prev, last = syncGuestClock(context.Background(), doSync, prev, last, scriptedNow(sentAt, sentAt.Add(l.out+l.back)))
	}
	return steps
}

func TestProbeOvershoot(t *testing.T) {
	logrus.SetOutput(io.Discard)
	ms := time.Millisecond
	slow, fast, slowReply := leg{250 * ms, 250 * ms}, leg{5 * ms, 5 * ms}, leg{10 * ms, 790 * ms}
	for _, tc := range []struct {
		name string
		legs []leg
		ntp  bool
	}{
		{"steady 250ms each way, guest NTP", []leg{slow, slow, slow, slow}, true},
		{"load ends, no guest NTP", []leg{fast, fast, slow, slow, slow, fast, fast}, false},
		{"slow replies end, no guest NTP", []leg{fast, fast, slowReply, slowReply, slowReply, fast, fast}, false},
	} {
		t.Run(tc.name, func(t *testing.T) {
			base := guestSteps(tc.legs, tc.ntp, false)
			pr := guestSteps(tc.legs, tc.ntp, true)
			t.Logf("merge-base steps: %v", base)
			t.Logf("reviewed steps:   %v", pr)
			if len(pr) > len(base) {
				t.Errorf("reviewed code steps the guest clock %d times, merge-base %d", len(pr), len(base))
			}
		})
	}
}
$ go test ./pkg/hostagent/ -run TestProbeOvershoot -v
=== RUN   TestProbeOvershoot
=== RUN   TestProbeOvershoot/steady_250ms_each_way,_guest_NTP
    timesync_overshoot_probe_test.go:63: merge-base steps: [-250ms -250ms -250ms -250ms]
    timesync_overshoot_probe_test.go:64: reviewed steps:   [-250ms]
=== RUN   TestProbeOvershoot/load_ends,_no_guest_NTP
    timesync_overshoot_probe_test.go:63: merge-base steps: [-250ms 245ms]
    timesync_overshoot_probe_test.go:64: reviewed steps:   [-245ms 245ms 245ms -245ms]
    timesync_overshoot_probe_test.go:66: reviewed code steps the guest clock 4 times, merge-base 2
=== RUN   TestProbeOvershoot/slow_replies_end,_no_guest_NTP
    timesync_overshoot_probe_test.go:63: merge-base steps: []
    timesync_overshoot_probe_test.go:64: reviewed steps:   [390ms -390ms]
    timesync_overshoot_probe_test.go:66: reviewed code steps the guest clock 2 times, merge-base 0
--- FAIL: TestProbeOvershoot (0.00s)
    --- PASS: TestProbeOvershoot/steady_250ms_each_way,_guest_NTP (0.00s)
    --- FAIL: TestProbeOvershoot/load_ends,_no_guest_NTP (0.00s)
    --- FAIL: TestProbeOvershoot/slow_replies_end,_no_guest_NTP (0.00s)
FAIL
FAIL	github.com/lima-vm/lima/v2/pkg/hostagent	0.447s
FAIL

Fix: cap the delay at the guest's drift threshold, shared as a constant in pkg/guestagent/api, so an overestimate alone cannot cross it. In the steady case, 250 ms each way then steps back 150 ms per tick instead of once. The patch is independent of I1's; with both applied, both probes and the package tests pass.

Patch
diff --git a/pkg/guestagent/api/server/server.go b/pkg/guestagent/api/server/server.go
index 60478d97..00e4a460 100644
--- a/pkg/guestagent/api/server/server.go
+++ b/pkg/guestagent/api/server/server.go
@@ -125,8 +125,7 @@ func (s *GuestServer) SyncTime(_ context.Context, req *api.TimeSyncRequest) (*ap
 		DriftMs:  drift.Milliseconds(),
 	}
 
-	const driftThreshold = 100 * time.Millisecond
-	if drift > driftThreshold || drift < -driftThreshold {
+	if drift > api.TimeSyncDriftThreshold || drift < -api.TimeSyncDriftThreshold {
 		if err := timesync.SetSystemTime(hostTime); err != nil {
 			logrus.WithError(err).Warn("SyncTime: failed to set system time")
 			resp.Error = err.Error()
diff --git a/pkg/guestagent/api/timesync.go b/pkg/guestagent/api/timesync.go
new file mode 100644
index 00000000..b2fbe9a8
--- /dev/null
+++ b/pkg/guestagent/api/timesync.go
@@ -0,0 +1,10 @@
+// SPDX-FileCopyrightText: Copyright The Lima Authors
+// SPDX-License-Identifier: Apache-2.0
+
+package api
+
+import "time"
+
+// TimeSyncDriftThreshold is how far the guest clock may be from a SyncTime
+// request's host_time before the guest agent sets its clock to host_time.
+const TimeSyncDriftThreshold = 100 * time.Millisecond
diff --git a/pkg/hostagent/timesync.go b/pkg/hostagent/timesync.go
index 3f63c309..c27ffb03 100644
--- a/pkg/hostagent/timesync.go
+++ b/pkg/hostagent/timesync.go
@@ -65,7 +65,10 @@ func syncGuestClock(ctx context.Context, doSync func(context.Context, time.Time)
 	prev, last = prevIn, lastIn
 	sentAt := now()
 	// host_time is the predicted receipt time (issue 5543).
-	hostTime := compensatedHostTime(sentAt, oneWayDelay(prev, last))
+	// The delay comes from earlier round trips. Capping it at the guest's
+	// threshold stops an overestimate from stepping the guest ahead of the host.
+	delay := min(oneWayDelay(prev, last), guestagentapi.TimeSyncDriftThreshold)
+	hostTime := compensatedHostTime(sentAt, delay)
 	resp, err := doSync(ctx, hostTime)
 	if err != nil {
 		logrus.WithError(err).Debug("Time sync: RPC failed")
diff --git a/pkg/hostagent/timesync_test.go b/pkg/hostagent/timesync_test.go
index 814d56cf..a46f2f96 100644
--- a/pkg/hostagent/timesync_test.go
+++ b/pkg/hostagent/timesync_test.go
@@ -84,7 +84,7 @@ func TestSyncGuestClock(t *testing.T) {
 			got = hostTime
 			return &guestagentapi.TimeSyncResponse{}, nil
 		}, prev, last, scriptedNow(sentAt, sentAt.Add(360*time.Millisecond)))
-		assert.Equal(t, got, compensatedHostTime(sentAt, 180*time.Millisecond))
+		assert.Equal(t, got, compensatedHostTime(sentAt, guestagentapi.TimeSyncDriftThreshold))
 		assert.Equal(t, prev, 360*time.Millisecond)
 		assert.Equal(t, last, 360*time.Millisecond)
 		assert.Equal(t, oneWayDelay(prev, last), 180*time.Millisecond)

Suggestions

S1. Fixes #5543 closes the issue while a single latency spike still steps the guest back by almost its full delay Claude Opus 5.5

The estimate predicts each RPC from earlier ones, so it cannot see a spike in the current one. In Claude's executed simulation, a 4 s round trip between 10 ms ticks steps the guest back 1.995 s, against 2 s at the merge-base. The issue's largest adjustments (1388, 4102 and 9577 ms) look like that, and the issue proposes two guards for them (persistent same-signed drift, or never stepping back by less than the measured latency) that this PR does not add. Merging with Fixes #5543 closes the issue on those cases.

Fix: write Refs #5543 in the commit and the PR body, or keep the issue open for the spike case.

S2. Several test assertions are arithmetic identities, and no test applies the guest's step rule Claude Opus 5.5 Codex GPT 6 Astra Gemini 3.5 Flash

	t.Run("stable link", func(t *testing.T) {
		delay := oneWayDelay(360*time.Millisecond, 360*time.Millisecond)
		assert.Equal(t, delay, 180*time.Millisecond)
		hostTime := compensatedHostTime(sentAt, delay)
		assert.Equal(t, hostTime, sentAt.Add(180*time.Millisecond))
		// Receipt at sentAt+180ms has drift 0, inside the guest's 100ms threshold.
		assert.Equal(t, sentAt.Add(180*time.Millisecond).Sub(hostTime), time.Duration(0))
	})

	t.Run("sustained latency increase", func(t *testing.T) {
		assert.Equal(t, oneWayDelay(80*time.Millisecond, 360*time.Millisecond), 40*time.Millisecond)
		delay := oneWayDelay(360*time.Millisecond, 360*time.Millisecond)

Once line 24 passes, line 26 cannot fail. Lines 34-38 build guestNow 140 ms behind and then assert the drift is −140 ms, without noting that −140 ms crosses the threshold and makes the guest step. Every TestSyncGuestClock subtest is a single call with a hand-set window, so nothing feeds one tick's output into the next or applies GuestServer.SyncTime's threshold-and-set rule. That is why I1 and I2 pass the suite.

Fix: replace the identity assertions with a multi-tick test that models the guest's rule, like the probes in I1 and I2, and assert on the guest's step sequence.

S3. syncTimeOnce assigns its named results only to return them Gemini 3.5 Flash
	client, err := a.getOrCreateClient(ctx)
	if err != nil {
		logrus.WithError(err).Debug("Time sync: failed to get client")
		return prev, last
	}
	prevRTT, lastRTT = syncGuestClock(ctx, client.SyncTime, prev, last, time.Now)
	return prevRTT, lastRTT
}

// syncGuestClock sends the predicted guest receipt time and shifts the RTT window
// after SyncTime returns a nil error. An RPC error leaves the window unchanged.
func syncGuestClock(ctx context.Context, doSync func(context.Context, time.Time) (*guestagentapi.TimeSyncResponse, error), prevIn, lastIn time.Duration, now func() time.Time) (prev, last time.Duration) {

Fix: return syncGuestClock(ctx, client.SyncTime, prev, last, time.Now).

S4. The negative-RTT clamp guards a value production cannot produce Claude Opus 5.5
	if err != nil {
		logrus.WithError(err).Debug("Time sync: RPC failed")
		return prev, last
	}

	// A response Error string still counts: the round trip completed.
	prev, last = last, max(now().Sub(sentAt), 0)

	if resp.Error != "" {
		logrus.Warnf("Time sync: guest failed to set time: %#q (drift was %dms)", resp.Error, resp.DriftMs)
		return prev, last
	}

time.Now() contains a monotonic reading, and Sub between two such values uses it, so the elapsed time cannot go negative in production. Only the injected clock in the negative sample is stored as zero subtest reaches the clamp, yet the commit body spends a sentence on it.

Fix: drop the clamp, the subtest and the commit-body sentence.


Design Observations

Concerns

Strengths


Testing Assessment

  1. Required (I1, I2, S2): a multi-tick test that applies the guest's threshold-and-set rule and asserts the guest's step sequence, covering the slow first sync, load ending, and slow replies. The change exists to alter what the guest clock does, and no current assertion can fail on over-compensation.
  2. Optional, kept: a spike case asserting the step on the spike tick itself (S1), which records what the change does not fix.
  3. What I ran: go test -count=1 on ./pkg/hostagent/... and ./pkg/guestagent/... at the review SHA passed, as did gofmt -l and go vet ./pkg/hostagent/. CI shows 36 checks passing and 2 skipped.
  4. Mutations: I1's patch breaks timesync_test.go:55 and :77, which pinned single-sample compensation; I2's cap breaks :87. Each patch updates those lines.
  5. Test output: the guest error string still records the sample subtest prints a logrus warning to stderr.

Documentation Assessment

The oneWayDelay doc comment (pkg/hostagent/timesync.go:91-93) is false for the second tick; I1's patch rewrites it. No page under website/content or docs mentions time sync, so no user documentation needs a change.


Commit Structure

One commit, signed off, which settles the DCO comment. The body names functions and walks through the mechanism, which the diff already shows, while the bug itself appears only in the PR body. Since the PR lands as a squashed commit, the PR body's second paragraph (a loaded host steps the guest clock back by the RPC latency) belongs in the commit body. The body also repeats I1's single-stall claim and S4's negative-sample sentence.


Acknowledged Limitations


Unresolved Feedback


Agent Performance Retro

Claude Opus 5.5

Claude did the most to frame the question this PR raises. Besides I1, it alone filed the latency-drop overshoot as a finding (I2) and the spike gap (S1), and its 2000-tick simulation across two guest models showed that the PR's net effect flips with whatever moves the guest clock between ticks. That simulation really ran; the session log has its output. It rated the spike gap Important, although the PR does not make spikes worse. Its I2 patch used a shared guestagentapi.DriftThreshold constant that its own fix text asked for but did not write, and its idea of timing the Info call missed that Info runs a guest port scan.

Codex GPT 6 Astra

Codex found I1 with the sharpest reproducer. Its first reply stalls for 8 s and the merge-base does not step at all, which separates the defect from any question about guest NTP. It also modeled slow replies followed by recovery and got the forward-then-back pair that became I2's third case, but it filed that under Design Observations instead of as a finding. It could not run go test (empty module cache, GOPROXY=off) and said so instead of claiming a pass; its Python and Go models did run.

Gemini 3.1 Pro

The first attempt hung after ten tool calls, about three minutes in, and the relaunch finished. Its one finding traced a real I1 case, a slow first sync followed by a fast one that leaves the guest 90 ms ahead below the threshold, and its arithmetic matches the simulator. But it blamed the uncompensated first sync instead of the single-sample second one, and its fix primes the window with Info calls, whose round trip includes the guest's port scan. It also praised the negative-RTT clamp and called the tests comprehensive; S4 and S2 show otherwise.

Gemini 3.5 Flash

Flash found I1 and the two small simplifications (the built-in min, folded into I1's patch, and S3), and it raised the latency-drop overshoot as a design concern. Its I1 repro block quotes a failure at timesync_test.go:130, but its session log does not show a write to that file, so no run produced that output. The assertion would fail as quoted, which my probe confirms. The two Gemini models did not converge on anything beyond I1, and there they reached it by different routes.

Summary

Claude Opus 5.5Codex GPT 6 AstraGemini 3.1 ProGemini 3.5 Flash
Duration5m 58s5m 06s7m 25s8m 00s
Findings2I 3S2I 1S1I2I 2S
Tool calls17 (Bash 14, Read 3)7 (shell 7)12 (runshellcommand 12)27 (readfile 9, grepsearch 8, runshellcommand 7)
Design observations5323
False positives0000
Unique insights4101
Files reviewed2222
Coverage misses0000
Totals2I 3S2I 1S1I2I 2S
Downgraded1000
Dropped0000

Reconciliation: Claude pass 1, spike gap (its I3): important → suggestion S1, because the PR neither introduces nor worsens the spike step. Codex pass 1, slow replies then recovery (a design concern): → part of I2, important. Gemini 3.5 Flash pass 1, overshoot on latency collapse (a design concern): → part of I2, important. Gemini 3.1 Pro pass 1, permanent skew from the first sync (its I1): merged into I1, with its first-sync diagnosis and its Info priming fix rejected. Gemini 3.5 Flash pass 1, built-in min (its S1): folded into I1's patch.


Review Process Notes

Skill improvements

Repo context updates

Notes on this report