From 21aa402856c2a3b3a7ab5e9a1509d5fb8dc875cf Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 15 Oct 2026 05:10:28 +0800 Subject: [PATCH] gui tests: the Codex subagent details test writes its rollouts now, not on 2026-10-15, so main is green in UTC (#1591) 3c4b4dc97's TestCodexSubagentDetailsReachSessionAPIs held usage's clock at 2026-10-15 12:00 local and wrote the rollouts then, but /api/sessions/overview reads sessions.StatsFor, whose 7-day window ends at the real today. On CI (UTC, still 10-14) the fixture day was tomorrow and the child was left out: "overview token top omitted the active Codex child", red on macOS and ubuntu at 84f14e555 and aae49d086. In UTC+8 it passed, and from 10-23 it would have failed everywhere. The test now holds the clock at time.Now(). What was run, at origin/main 8d2a4a7da: - before: TZ=UTC go test -run TestCodexSubagentDetailsReachSessionAPIs ./internal/gui fails as on CI; Asia/Shanghai passes. - after: the test passes under TZ UTC, Asia/Shanghai, America/Los_Angeles and Pacific/Kiritimati; go test -tags nogui ./internal/gui (local TZ and UTC) and ./internal/sessions (UTC): ok. go vet ./internal/gui: clean. - Siblings: no other internal/gui test holds a fixed date and reads /api/sessions. Not run: the rest of ./... (test-only change in one file). --- internal/gui/sessions_codex_details_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/gui/sessions_codex_details_test.go b/internal/gui/sessions_codex_details_test.go index a32b59227..4f59739e9 100644 --- a/internal/gui/sessions_codex_details_test.go +++ b/internal/gui/sessions_codex_details_test.go @@ -42,7 +42,10 @@ func TestCodexSubagentDetailsReachSessionAPIs(t *testing.T) { home := sandboxHome(t) codex := filepath.Join(home, ".codex") t.Setenv("CODEX_HOME", codex) - now := holdUsageClock(t, time.Date(2026, 10, 15, 12, 0, 0, 0, time.Local)) + // sessions.StatsFor counts the last days up to the real today, so the + // rollouts are written now, not on a fixed date that is in the future + // in one time zone and past the 7-day window a week later. + now := holdUsageClock(t, time.Now().Truncate(time.Second)) catalog.Reset() t.Cleanup(catalog.Reset) sessions.Reset()