Under the hood
Token usage totals for an agent turn are now validated before being added up, to avoid bad data corrupting the count
What
When Claude Code tallies up token usage during an agent's turn, it now checks the shape of the usage data first: it requires input_tokens to be a number, and treats a missing or null output_tokens as 0. Only after this check does it sum input, cache-creation, cache-read, and output tokens, instead of summing the raw values directly.
Why
This guards against malformed or incomplete usage data silently corrupting token counts or causing errors, keeping usage totals reliable.