# avoid token profile percentage overflow

`9b84620`→[main](/content/gh/entireio/cli/commits/main/index.html)·

peyton-alt·3w ago·2 files·+16 added/-1 removed

## Sessions

1bbc15069665View transcript

## Changes

2

- cmd/entire/cli

- Mtokens_profile.go+1/-1

- Mtokens_profile_test.go+15

```
229 unmodified lines

230
231
232
233
233
234
235
236

229 unmodified lines

\tif tokens.APICalls >= 20 {
\t\taddTokensProfileSignal(signals, "api-call-amplification", checkpointID, denominator)
\t}
\tif tokens.Total > 0 && tokens.SubagentTotal*100 >= tokens.Total*10 {
\t\tif tokenShareAtLeastOneTenth(tokens.SubagentTotal, tokens.Total) {
\t\t\taddTokensProfileSignal(signals, "subagent-heavy", checkpointID, denominator)
\t\t}
\t}
```

Mcmd/entire/cli/tokens_profile.go+1/-1

```
13 unmodified lines

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

13 unmodified lines

\t"github.com/entireio/cli/redact"
\nfunc TestAddTokensProfileTokenSignalsSubagentHeavyAvoidsOverflow(t *testing.T) {
\t\tt.Parallel()
\n\t\tmaxInt := int(^uint(0) >> 1)
\t\tsignals := map[string]*tokensProfileSignal{}
\t\taddTokensProfileTokenSignals(signals, id.MustCheckpointID("999aaa000001"), &sessionTokensUsage{
\t\t\tTotal:         maxInt,
\t\t\tSubagentTotal: maxInt,
\t\t}, 1)
\n\t\tif signals["subagent-heavy"] == nil {
\t\t\tt.Fatalf("expected subagent-heavy signal, got %+v", signals)
\t\t}
}

func TestTokensProfileCmd_TextOutputAggregatesCommittedCheckpoints(t *testing.T) {
\trepo, _ := runExplainAutoTestRepo(t)
\tctx := context.Background()
```

Mcmd/entire/cli/tokens_profile_test.go+15
