# avoid token profile percentage overflow

`6378f3e`·

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

## Sessions

1bbc15069665View transcript

[?\
okay proceedCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ed29b-5de8-7272-9e6c-89a843c92842#timeline-1bbc15069665/index.html)

## Changes

2

- cmd/entire/cli

- Mtokens_profile.go+1/-1

- Mtokens_profile_test.go+15

```go
229 unmodified lines

230
231
232
233
233
234
235
236

229 unmodified lines

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

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

"github.com/entireio/cli/redact"
}

func TestAddTokensProfileTokenSignalsSubagentHeavyAvoidsOverflow(t *testing.T) {
	t.Parallel()

maxInt := int(^uint(0) >> 1)
	signals := map[string]*tokensProfileSignal{}
	addTokensProfileTokenSignals(signals, id.MustCheckpointID("999aaa000001"), &sessionTokensUsage{
		Total:         maxInt,
		SubagentTotal: maxInt,
	}, 1)

if signals["subagent-heavy"] == nil {
		 t.Fatalf("expected subagent-heavy signal, got %+v", signals)
	}
}

func TestTokensProfileCmd_TextOutputAggregatesCommittedCheckpoints(t *testing.T) {
	repo, _ := runExplainAutoTestRepo(t)
	ctx := context.Background()
```

Mcmd/entire/cli/tokens_profile_test.go+15
