Commit Graph
1 Commits
Author SHA1 Message Date
yetone fb4632ee0c agent, provider: Codex's polls and the usage quotas read what is kept
Heap profile diff of the live magpie (v0.1.2906, /v1/magpie/heap, two
idle minutes with the window open: 269 MB allocated):
- ownCodex found the codex provider through provider.All, a copy of every
  provider, on each look (~9 MB). Its picks are now kept per stamp
  (codexPicks, stampedLists), read only.
- Codex's model and effort fields copied magpie's whole model list on
  each Options call, every poll of the effort field (~11 MB). They read
  sharedModels, the list kept, which they only read.
- visibleQuotas built every provider's offered models to narrow Gemini's
  and Antigravity's quotas (~20 MB). exposedIDs builds the providers
  asked only.

Run (mote, at this tree):
- gofmt -l internal, go vet ./..., GOOS=windows and GOOS=linux go vet
  ./internal/agent/ ./internal/provider/: clean
- go test -count=1 -timeout 45m ./... (all three commits' tree): 85
  packages ok, internal/gateway 748s, internal/provider 193s. Two red:
  internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's macOS 27
  (#3949, filed before, untouched here), and internal/agent's
  TestCodexEffortOptionsReadTheKeptList, whose bar counted the
  environment's copy (see the effort test's comment), fixed in its test.
- then go test -count=1 -timeout 45m ./internal/agent/ with that fix:
  ok (200.1s)

Broken by hand:
- codexPicks through provider.Find again: 285 allocations, red
  (TestCodexOwnModelsFollowPicks, bar 20).
- the effort field on magpieModels again: 199896 bytes a look past
  its StampNow's 1712, red (TestCodexEffortOptionsReadTheKeptList, bar
  20000). The test takes the look's StampNow off: os.Environ copies the
  environment, and each t.Setenv before it in the package made that
  longer (an Unsetenv leaves its slot), ~56 KB a look in the whole
  package; run alone it is 1.7 KB.
- exposedIDs without the ids check: "other" built, red
  (TestExposedIDsBuildsOnlyTheProvidersAsked).

Not tried: the numbers on the live app after this build; that profile
is taken once it is released.
2026-11-06 12:48:51 +08:00