ac4af582301a4e8a29245dbba767eba31334ddf9
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c93d9e0c0b |
usage: an unchanged Codex effort ask is told the kept answer, not a copy (#2278)
CodexModelEffort copied every thread's consumption for each ask (cloneEffort), though the kept answer is only replaced by a later build, never written, and its callers (the Sessions list, overview and a session's details) only index it and copy their thread's slice (addCodexModelEffort, addCodexSummaryModelEffort). On the #2278 bench (15G .codex) the copies were ~230 MB allocated every 80 s of an open Sessions page. Asks are now told the kept map itself; the doc comment says it is read-only. TestCodexModelEffortReadsLedgerOnlyWhenCallsChange wrote into the answer to check a caller's copy was its own. That guarantee is now the GUI's: TestCodexModelEffortCopiedPerSession checks a session and a summary get their own slice. TestCodexModelEffortAsksShareTheKeptAnswer checks two unchanged asks get the same map. Run at this tree on mote (macOS 27, Go 1.26.8): - go test -count=1 ./internal/usage ./internal/sessions ./internal/gui: usage ok, sessions ok; gui red only in TestMainWindowCorners/ macOS_26_SDK, which is #3949 (filed, red on macOS 27 on main). - GOOS=linux,windows,darwin go vet -tags nogui ./internal/usage ./internal/gui: ok. Broken by hand: maps.Clone back in the kept-answer return makes TestCodexModelEffortAsksShareTheKeptAnswer red ("told a copy"); dropping the GUI's slices.Clone makes TestCodexModelEffortCopiedPerSession red ("written through a session's copy: 999"). Not run: the full ./... suite, and the bench A/B (the 230 MB is from the v0.1.1967 heap profile, not yet re-measured). |
||
|
|
0dc4cec85d |
usage: a row's Codex thread is kept as a 4-byte place, not a string (#2278)
Every row of a chunk had a 16-byte string header for its Codex
thread. A day's rows are a few hundred threads, one after another. At
the scale of #2278 (34k session files, 1M Codex rows), these headers
were the largest single holder in the heap, 24.5 MB of 184 MB live.
codexActors now keeps a []uint32 into the chunk's thread names. The
row before's thread is checked first, then the names. A clone shares
the names clipped, so adding a name to one never writes into the
other. The disk format is unchanged: each row's thread is still
written as a string.
Measured on mote, at 7e58591dc's parent with this change. The history
is synthetic: 25,000 Codex rollouts and 9,000 Claude Code sessions, 40
turns each (13 GB), plus a 115 MB usage.jsonl of 240k gateway calls on
the newest 3,000 of each. Cold `magpie web --no-open` in a sandbox
HOME, with `magpie heap` taken at 130 s:
- main: live heap 195.2 MB (both runs), physical footprint peak 389 to
417 MB.
- this change: live heap 175.6 MB, physical footprint peak 366 MB.
The reporter's 0.1.1318 peaked at 2.85 GB RSS on such a history.
Run at the pushed head (rebased onto
|
||
|
|
57a70aaf10 |
usage: a new Codex thread keeps the chunks read before (#3493)
Codex's thread identities were in the request index's meta, so every new
Codex thread, each subagent's included, dropped every chunk, and the next
Usage page read the whole history again: 7s on the reporter-sized
history here (15,553 session files, 418k calls). A chunk's rows don't
hold the identities; the page gives them to its rows as it is built
(cloneCodexChunks, codexIdentities). They now go in the key alone, which
drops only the built pages.
TestCodexNewThreadKeepsReadChunks writes a child thread, reads the page,
then writes its parent: only the parent's file is read again, and the
child's row names the parent's session. Red with the identities put back
in meta (both files read again).
Run at this head (origin/main
|
||
|
|
019199e0f7 |
usage: Codex threads' model/effort consumption is read again only when a call, price or identity changed (#1591)
e3d3f75fd added model_effort to /api/sessions, /one, /manage and
/overview. Each answer read the whole ledger (LedgerOf(All) for the list),
and the Sessions page asks for the list and the overview every 15s while it
is open, so a long history was worked out again on every refresh.
CodexModelEffort now keeps its last answer per period under the key the
request index already keys its pages on (gateway log version, the agents'
call files, other computers' days, Codex identities, prices, the day).
That key is read by readRequestState, taken out of queryPage unchanged. An
answer from a log read part way is not kept, as cachedVias does. Callers
get their own copy.
Run at this commit on
|
||
|
|
644f4316f9 |
sessions, usage, gui: separate Codex thread relationships and consumption (#1591)
Preserve native Codex thread IDs and explicit parent chains. Associate gateway calls with their actual thread by unique response ID before legacy matching; fold identical native history copies and keep ambiguous actors unknown. Existing Sessions APIs expose optional Codex roles, parent/root relationships and per-thread model/effort consumption. The overview uses its existing calendar range. Usage request APIs expose query-time actor classification and reuse session/subagent/parent_agent for Codex. Other agents, pricing, gateway routing, UI assets, raw Usage logs and model-only aggregation retain their semantics. Verified after rebasing onto main |