Merge claudedo/38394081d47048fea82317c6c52e01a5

This commit is contained in:
mika kuns
2026-08-05 16:05:19 +02:00
28 changed files with 1318 additions and 20 deletions
@@ -219,6 +219,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
[ObservableProperty] private string? _branchLine;
[ObservableProperty] private int _turns;
[ObservableProperty] private int _tokens;
[ObservableProperty] private string? _tokensBreakdown;
[ObservableProperty] private int _diffAdditions;
[ObservableProperty] private int _diffDeletions;
[ObservableProperty] private int _commitsOnBranch;
@@ -619,7 +620,15 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
// Restore turn/token counts from the last run so a reloaded terminal task
// shows its real turns instead of "0/max".
Turns = latestRun?.TurnCount ?? 0;
Tokens = (latestRun?.TokensIn ?? 0) + (latestRun?.TokensOut ?? 0);
// Raw total = what actually counts against the 5h/7d Claude usage limit: cached
// context resend (cache-read + cache-write) dwarfs fresh input/output on a
// resumed session, so it must be included, not just the uncached input/output.
var tokensIn = latestRun?.TokensIn ?? 0;
var tokensOut = latestRun?.TokensOut ?? 0;
var cacheRead = latestRun?.CacheReadTokens ?? 0;
var cacheWrite = latestRun?.CacheWriteTokens ?? 0;
Tokens = tokensIn + tokensOut + cacheRead + cacheWrite;
TokensBreakdown = $"in {tokensIn} · out {tokensOut} · cache-read {cacheRead} · cache-write {cacheWrite}";
Monitor.ApplyOutcome(entity.Result, latestRun?.ErrorMarkdown);
Monitor.SetTaskId(row.Id);