Commit Graph
1 Commits
Author SHA1 Message Date
yetone 1cfea01695 sessions: Codex's per-poll name and twin sets are kept from poll to poll (#2278)
Each Sessions poll lists every Codex rollout (~13k here) and made two
maps over them anew: distinctCodexFiles' first file of each name, and
codexFilesIn's set of plain rollouts a compressed twin defers to. Both
are now taken from a shelf, as pathSets are, and given back cleared;
the shelf lets them go after it idles.

Run on mote (M5 Pro, macOS 27), with a copy of the real accounts:
- go vet ./internal/sessions; go test ./internal/sessions: ok.
- TestDistinctCodexFilesKeepsItsSet (new): a call over 4,000 rollouts
  makes at most 4 allocations. Broken by hand (a new map each call): 47,
  red. The twin set has no test of its own; it uses pathSet as is.
- /api/sessions and /api/sessions/stats?days=30 from a fresh start, real
  history: byte-identical to v0.1.3503's code.
- 40 /api/sessions polls with X-Magpie-Had: 185.5 MB allocated before,
  152.4 MB with this; distinctCodexFiles is gone from the profile.
2026-11-10 11:18:14 +08:00