codexAppRoute runs every 3s for as long as magpie does (the Codex app's
app-server watcher). It read the whole of Codex's config.toml with
os.ReadFile only to learn the file could be read; the keys it uses come
from filememo, which parses the file once per change. Codex keeps every
project's trust level in that file, and the owner's is 1.5 MB, so this
was 1.55 GB of the 33 GB a live magpie allocated in 53 minutes (heap
profile: KeepCodexAppOnItsProvider → codexAppStep → os.ReadFile). It is
now opened and closed: a file that can't be opened is still an unknown
route, a missing one still a known one.
Run on mote:
- TestCodexAppRouteReadsNoWholeConfig (new): a 1.6 MB config, 10 looks
allocate under 1 MB; a config with mode 0 gives no route.
- Broken by hand: ReadFile put back, red (14.4 MB for 10 looks); the
unreadable check dropped, red.
- go test -run CodexAppRoute ./internal/agent: ok.
- go test -count=1 -timeout 45m ./internal/agent ok (185.3s), at this tree rebased on 4a7d1c63a; gofmt -l clean; go vet ./internal/agent for darwin, linux and windows ok