From 65c9a2e411eb28174d75dab5c65da1fc65516b40 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 18 Nov 2026 18:08:24 +0800 Subject: [PATCH] sessions: the WSL tests wait for the distro's first listing, however busy the machine TestWSLAgentsGoneListingDrops went red in a run of internal/sessions on mica at load ~48: "answered=true: want 7 sessions, got 0". The first List waits at most wslFirstWait (3s) for the WSL walk, as the Sessions page should, and on a busy machine the walk outlasts it, so the count read nothing yet. Every test built on wslDistro counts that first listing (TestWSLSessionsListed, the Antigravity and Kimi WSL tests), so wslDistro now gives it a minute; TestWSLFirstWaitIsWaitedOnce still sets its own 500ms after. Broken by hand: a 3.5s stall in WSLHomes gave the same red, "got 0", without this change and passed with it (mica-run, -run TestWSLAgentsGoneListingDrops). Alone, unstalled, the test passed 5 of 5 on the old and new code. Run: on mica (mica-run): go test -count=1 -run 'WSL|Antigravity|Agy|Gone' ./internal/sessions ok; gofmt clean. The full internal/sessions run where it went red is in the next commit's record. --- internal/sessions/wsl_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/sessions/wsl_test.go b/internal/sessions/wsl_test.go index 3dd17bef3..f2475c915 100644 --- a/internal/sessions/wsl_test.go +++ b/internal/sessions/wsl_test.go @@ -34,6 +34,11 @@ func wslDistro(t *testing.T) (home string, running *bool) { on := true WSLHomes = func() []WSLHome { return []WSLHome{{Distro: "Ubuntu", Home: home, Running: on}} } t.Cleanup(func() { wslSettle(); WSLHomes = nil; Reset() }) + // the tests read what the first listing found: on a busy machine the + // walk outlasts the 3s a page waits for it, and the count read 0 + was := wslFirstWait + wslFirstWait = time.Minute + t.Cleanup(func() { wslFirstWait = was }) Reset() return home, &on }