feat(stats): record api-resolved model id in turn-stats

This commit is contained in:
damocles 2026-06-08 20:00:24 +02:00 committed by mara
commit 4e0f2ac9ca
3 changed files with 102 additions and 0 deletions

View file

@ -52,6 +52,12 @@ pub fn build_row(
open_threads_count: Option<u64>,
open_reminders_count: Option<u64>,
) -> TurnStatRow {
// Prefer the API-resolved model id (e.g. `claude-opus-4-8`) captured
// from this turn's assistant events over the requested `--model`
// name/alias, so the model-mix + cost rollup label the concrete
// version that ran. Falls back to the requested name on a degenerate
// turn that produced no assistant event.
let model = bus.last_resolved_model().unwrap_or(model);
let cost = bus.last_cost_usage().unwrap_or_default();
let ctx = bus.last_ctx_usage().unwrap_or(cost);
let tool_calls = bus.take_tool_calls();