saturate recursive token totals · Entire
saturate recursive token totals
8c96845→main·
peyton-alt·3w ago·2 files·+19 added/-2 removed
Sessions
8af55c9fef63View transcript
[?
okay proceedCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ed29b-5de8-7272-9e6c-89a843c92842#timeline-8af55c9fef63/index.html)
Changes
2
cmd/entire/cli
Mstatus_style.go+4/-2
Mstatus_test.go+15
108 unmodified lines
109
110
111
112
113
112
113
114
115
116
117
118
108 unmodified lines
if tu == nil {
return 0
}
total := tu.InputTokens + tu.CacheCreationTokens + tu.CacheReadTokens + tu.OutputTokens
total += totalTokens(tu.SubagentTokens)
total := saturatingIntAdd(tu.InputTokens, tu.CacheCreationTokens)
total = saturatingIntAdd(total, tu.CacheReadTokens)
total = saturatingIntAdd(total, tu.OutputTokens)
total = saturatingIntAdd(total, totalTokens(tu.SubagentTokens))
return total
}
Mcmd/entire/cli/status_style.go+4/-2
890 unmodified lines
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
890 unmodified lines
}
}
func TestTotalTokens_SaturatesOverflow(t *testing.T) {
t.Parallel()
maxInt := int(^uint(0) >> 1)
tu := &agent.TokenUsage{
InputTokens: maxInt,
SubagentTokens: &agent.TokenUsage{
OutputTokens: 1,
},
}
if got := totalTokens(tu); got != maxInt {
t.Errorf("totalTokens() = %d, want %d", got, maxInt)
}
}
func TestActiveTimeDisplay(t *testing.T) {
t.Parallel()
Mcmd/entire/cli/status_test.go+15