Every Sessions and Requests poll built the Codex thread identities again
over every rollout (CodexIdentities, CallSourcesAndCodexIdentities, List,
Stats, ListAgent, Get), though nothing had changed since the last poll.
codexIdentitySnapshot now keeps the identities it built for the last four
file lists, with what each Codex rollout gave them from: its key, the
cached identity's value and whether it conflicts. A list whose rollouts
give the same is handed the kept map. The maps are now shared, so only
read: CodexIdentities' comment says so, and the old test that deleted from
one is replaced by TestCodexIdentitiesKeptWhileNoRolloutChanges.
Run at this head (5637cca14 + this change):
- mote: GOOS=linux/windows/darwin go vet -tags nogui ./internal/sessions/
./internal/usage/ ok; go test -timeout 45m ./internal/sessions/
./internal/usage/ ./internal/usageapi/ ok.
- magpie-desktop (Linux): the same three packages ok.
- Broken by hand: madeFrom not comparing what a rollout gave, so a
changed rollout got the kept map: the new test is red ("a rollout
changed and the identities kept from before were handed out").
- A/B on mote, the #2278 bench (real history copy, 10 endpoints polled
every 5s, 4 gateway calls/s from 60s), v0.1.1968 vs v0.1.1968 + this,
load ~27: codexIdentitySnapshot's allocations 280 MB -> 0 per 80s;
total allocated 7942 -> 7538 MB per 80s; peak footprint 761 -> 733 MB;
madvise 11.0% -> 9.2% of CPU samples; avg CPU 40.8% -> 39.3%. Poll
times within the box's noise (0.43s vs 0.44s mean).
Not run: the full suite and the GUI suite (no GUI change).