You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ROADMAP-06 — P0 — Turn token usage is written to every tool-call step row (double counting) #98
Series:ROADMAP — filed from the 2026-10-27 whole-project assessment · Backlog task: M14-T06 · Priority: P0 · Effort: extra small
Problem
When a turn requests multiple tool calls, the entire turn's usage is written onto every generated step row: sum(steps.input_tokens) > runs.total_input_tokens. Any dashboard or cost report built by summing steps lies; runs totals are correct by accident.
There is also no model/cost attribution anywhere (tracked separately in ROADMAP-12) — this issue fixes the attribution math only.
A turn's usage is recorded once (turn-level step), per-call step rows carry per-call latency/outcome only (0 for token columns or a shared-usage marker chosen by design)
Invariant test: for any run, sum(steps.*) <= runs.total_* holds with equality semantics documented
Existing trace consumers/tests updated
Suggested branch / commit
fix/step-token-attribution · fix(core): record turn token usage once, not per tool-call step
Activity