From 0226c98076e4f32e66a1e523b4c33ba4802b9a00 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Fri, 24 Jul 2026 11:21:21 +0200 Subject: [PATCH] fix(ui): restore turn/token counts on task reload Turns/Tokens were never populated from history, so a reloaded terminal task showed "0/max". Restore them from the latest task_run. --- src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs index d7a1b8f0..fc5ce670 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs @@ -536,6 +536,10 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable var latestRun = await runRepo.GetLatestByTaskIdAsync(row.Id, ct); ct.ThrowIfCancellationRequested(); LatestRunSessionId = latestRun?.SessionId; + // 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); Monitor.ApplyOutcome(entity.Result, latestRun?.ErrorMarkdown); Monitor.SetTaskId(row.Id);