Cost is stored per session id, so more than just the last session's spend can be restored.
What's wrong with this entry?
Cost is now written to the session store as its own record keyed by session id, replacing global scratch fields that were keyed on the last session id and could therefore only restore the cost of whichever session ran most recently.
- The record is schema-checked and holds the session id, total cost in USD, API and tool durations, lines added and removed, per-model usage and a flag for models with unknown pricing.
- Written on exit, read back per session on resume, merged last-wins, and kept with "always" retention so it is not pruned.
- Whether the record gets emitted at all depends on a guard whose definition is renamed across modules and does not resolve; the merge and retention behaviour is unconditional.
cost-state
Strings lifted out of the shipped bundle, so the claim above can be checked against them.
Related
Other releases about the same thing. Found by shared names or similar wording; neither means one caused the other.
-
v2.1.239
Cost is computed as a multiplied token subtotal plus web search
Both mention cost tracking
-
v2.1.242
Cost summary can note that figures use your organization's rates
Both mention cost