f2eb56c6bbde1300dddc402861b59cd4e45e0215
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ec15f87393 |
sessions: a Codex Desktop fork's replayed parent checkpoints book no usage, so a thread_spawn session isn't counted ~1000x (#2234, zlxdengtianhei)
A token_count event that can't be paired with a response record fell
back to the cumulative total's delta whenever a previous total existed,
even when the event's own last_token_usage was there. A Codex Desktop
subagent fork (thread_spawn) writes two cumulative counters into one
rollout: its parent's, replayed with last=0, and its own. Each switch
from the fork's lower counter back up to the parent's booked the gap,
tens of millions of tokens, as one call. The reporter's day read 187.4B
tokens where ~10.3B was real.
last_token_usage is the request's own usage, exact even when zero, so it
is used whenever it is valid; only a missing or invalid last falls back
to the delta, and with no previous total to the total itself, as before.
Run:
- TestCodexUsageForkReplayCountsOnlyLast (new), on the reporter's own five
lines (testdata/codex-fork-replay-checkpoints.jsonl, numbers untouched),
checking both Calls and the session summary. Old code: FAIL "calls
booked {Input:832145 Output:281374 CacheRead:82834688 ...}, want
{Input:3273 Output:1201 CacheRead:72448 ...}". New: PASS, on macOS and
on the Windows box with every TestCodex* test.
- TestCodexUsageUnpairedCountKeepsLegacyDelta and the other Codex usage
tests still pass; go test -tags nogui ./... on macOS with this series:
every package ok.
- gofmt -l, go vet ./... on darwin, linux (nogui) and windows: clean.
Not run: a reindex of the reporter's full dataset; the numbers above are
from their excerpt.
|
||
|
|
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 |
||
|
|
67004a7e8f |
sessions: count Codex RECORD and compaction usage without a history parent (#695)
* fix: 按本地事件配对统计 Codex 响应与压缩用量 * fix: 限制用量索引内存并精简磁盘缓存 * fix: 淘汰解析索引后仍释放请求行缓存 |