feat(desktop): add session-wide token and time breakdowns to the trace panel #4386
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.73) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.73 · 424 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.073
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4386"
general
weight: 0.35
bowenliang123
Summary
The trace (Inspector) panel added with two figures — estimated cost and cache-hit rate — while token totals and elapsed time lived only in per-turn rows. The panel now opens with two donut charts:
Ring and legend are linked in both directions: hovering either highlights that segment and dims the rest. A hairline minimum sweep keeps tiny nonzero shares visible, and the hovered segment draws a thin line so the highlight lands — the legend keeps the true figures either way.
Data sources stay session-scoped and independent of which trace pages are loaded:
input − cacheReadresidual (providers that report only the cached share leave the ledger miss at zero), floored by the ledger miss when no prompt total was reported.UsageSummaryV2gainstotalDurationMs(summed attempt latency from both the legacy store and the canonical ledger) andtoolUsage(session-scoped totals from a newTelemetryRepo.toolSummaryover the tool-invocation ledger, attached by the usage coordinator). They ride the Runtime Host usage protocol on the summary rather than being derived client-side from thebucketsquery: the summary is the closest seam, and the figures it returns are exact rather than a client-side re-projection of buckets that already merge legacy and canonical rows with request-weighted latency.totalDurationMsis a required key — the compatibility-epoch bump refuses hosts that predate it at the handshake.toolUsagestays optional for a data reason: tool rows predate connection attribution, so aconnectionSlug-scoped query omits the split instead of sending an unscoped one.<img width="490" height="473" alt="image" src="https://github.com/user-attachments/assets/c4aa6904-e476-41ae-b247-00ec61b5f18f" />
Verification
@maka/core,@maka/storage,@maka/runtime-host,@maka/desktop(all four desktop tsconfigs); Biome clean.toolSummary, protocol optional keys, ring arc geometry and minimum-sweep floors).main, after = this branch).AI use
Select exactly one:
Tool(s) and scope: ZCode authored the implementation (desktop renderer + runtime-host protocol/coordinator + storage + core aggregates) and the tests, human-directed and reviewed locally by @bowenliang123 before opening. The commit carries the
Generated-by: ZCodetrailer.Checklist
Does this PR entail a change in behavior?