Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

usage: CodexModelEffort's allocation bar is a packed row a call, not a visit (#2278)

yetonecb167fcbd82d
diff --git a/internal/usage/codex_effort_rows_test.go b/internal/usage/codex_effort_rows_test.go
index 979de8d6b..b1a699de5 100644
--- a/internal/usage/codex_effort_rows_test.go
+++ b/internal/usage/codex_effort_rows_test.go
@@ -8,6 +8,7 @@ import (
"slices"
"testing"
"time"
+ "unsafe"
"github.com/yetone/magpie/internal/sessions"
)
@@ -88,11 +89,15 @@ func TestCodexModelEffortLetsUnrelatedCallsGo(t *testing.T) {
if got := CodexModelEffort(All); len(got["main-a"]) != 1 {
t.Fatalf("main-a's consumption: %+v", got)
}
- visit := measure(func() { Visit(time.Time{}, func(Record) {}) })
+ // a packed row a call: the bar was a visit of the log, but a visit
+ // decodes into a lent buffer now (#2278), and took 74 KB or 289 KB as
+ // a pool kept it or not
+ rows := uint64(calls+1) * uint64(unsafe.Sizeof(packedRow{}))
build := measure(func() { CodexModelEffort(All) })
- t.Logf("a build allocated %d bytes, a visit %d", build, visit)
- // the visit itself, the thread's own rows and the sets of its ids
- if build > visit+visit/2+256<<10 {
- t.Fatalf("a build over %d unrelated calls allocated %d bytes, a visit of the log %d", calls, build, visit)
+ t.Logf("a build allocated %d bytes, the log's rows are %d", build, rows)
+ // the thread's own rows and the sets of its ids, less than a packed
+ // row for each unrelated call
+ if build > rows {
+ t.Fatalf("a build over %d unrelated calls allocated %d bytes, a packed row each is %d", calls, build, rows)
}
}