Files
magpie/internal
yetone b5adaa8bd9 provider: Codex's idle check reads a sessions folder in one listing
While Codex is idle each look of KeepOnAnAccountWithRoom asks whether a
session was written in the last 30 minutes, and the answer walked every
session file of the history: a directory read, a joined path and an
lstat() each. With a real-account HOME that walk was the largest thing
an idle magpie allocated once dsh's model build went (readdir 3.5 MB,
paths and lstat names 2.5 MB of 15 MB in 4 minutes), and a long history
(~20k rollouts) is as many syscalls a look.

codexSessionsQuietListed reads each folder with dirent.Stats
(getattrlistbulk on macOS, Lstat's own times), and the walk stays where
there is no bulk listing (Linux, Windows) or a folder can't be read so.
The listings are not kept between looks.

Run:
- mote: go test -count=1 ./internal/provider ok (148s); GOOS=windows and
  GOOS=linux (-tags nogui) go vet ./internal/provider ok; gofmt clean
- xiaomi-gpu (Windows): go test -run TestCodexSessionsQuiet ok (walk path)
Broken by hand: the listed path never counting a file new, both
TestCodexSessionsQuietFor and TestCodexSessionsQuietListed are red.
Not tried: Linux (WSL box down); its path is the unchanged walk.
2026-11-11 08:18:24 +08:00
..
…
…
…
…
2026-11-11 08:14:28 +08:00
…
…