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).
This commit is contained in:
yetone
2026-10-15 05:10:28 +08:00
parent 8d2a4a7da3
commit 21aa402856
+4 -1
View File
@@ -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()